
C++
齐天大圣~~
这个作者很懒,什么都没留下…
展开
-
安全方式fopen_s 读取TXT文件数据, fprintf_s写入数据到TXT操作
直接看代码示例// 读取操作vector<Point3f> w3Point;vector<Point2f> uvSL; float tempx=0.0, tempy=0.0; FILE *fp; errno_t err = fopen_s(&fp, "cvSideCenter.txt", "rt"); //读取...原创 2018-09-14 10:03:21 · 5490 阅读 · 0 评论 -
MFC框架下 OPenGL多线程编程
在新开线程示例,加入红色字体代码UINT CMicroDlg::ThreadshowOpenGL(LPVOID *lParm){ CMicroDlg* theDlg = (CMicroDlg*)lParm; //初始化 gl CDC* pDC = theDlg->GetDlgItem(IDC_STATIC_DISP_MAP)->GetDC(); ...原创 2018-12-29 22:41:45 · 458 阅读 · 0 评论 -
mfc cstring 与 float 互转
CString str1,str, str2; GetDlgItemText(IDC_EDIT1, str1); GetDlgItemText(IDC_EDIT2, str2); UINT value3 = _ttoi(str2); if ( 0 == value3) { return; } doubl...转载 2019-01-10 20:26:03 · 5491 阅读 · 2 评论 -
位置式PID反馈 及 增量式PID反馈(后者更加符合C++的表达)
转载 2019-01-02 19:59:51 · 444 阅读 · 0 评论 -
空间点到直线垂足坐标的解算方法
转自 https://blog.youkuaiyun.com/zhouschina/article/details/14647587假设空间某点O的坐标为(Xo,Yo,Zo),空间某条直线上两点A和B的坐标为:(X1,Y1,Z1),(X2,Y2,Z2),设点O在直线AB上的垂足为点N,坐标为(Xn,Yn,Zn)。点N坐标解算过程如下:// 二维空间点到直线的垂足struct Point{doub...转载 2019-01-07 20:19:43 · 3549 阅读 · 0 评论 -
Ubuntu 中使用终端编译并运行.c和.cpp文件
1、.c文件的编译与运行(1).c文件hello.c代码如下: #include<stdio.h> int main() { printf("Hello world !\n"); return 0; }在当前路径下编译.c文件:gcc -o hello hello.c编译完成后可以看到在和...转载 2019-01-29 17:06:02 · 8736 阅读 · 0 评论 -
Armadillo Matrix 与Eigen MatriXd 相互赋值
For example:#include <RcppArmadillo.h>#include <RcppEigen.h>// [[Rcpp::depends(RcppEigen)]]// [[Rcpp::depends(RcppArmadillo)]]// [[Rcpp::export]]Eigen::MatrixXd example_cast_eig...转载 2019-05-15 16:08:19 · 2019 阅读 · 0 评论 -
ubuntu16.04安装LCM
1.sudo apt-get install build-essential autoconf automake autopoint libglib2.0-dev libtool openjdk-8-jdk python-dev2.将下载好的lcm1.3.0包进行解压,然后进入解压的目录下,右键打开终端,执行以下步骤:(1) ./configure(2) make(3) ...转载 2019-05-31 16:27:24 · 1902 阅读 · 0 评论 -
开源的、跨平台的 C++ 工具包openFrameworks
使用起来非常简单https://www.cnblogs.com/lidabo/p/9134174.html转载 2019-07-18 22:48:45 · 336 阅读 · 0 评论 -
Clion+makefile
Clion 目前支持使用 cmake 来编译代码,如果习惯了自己写 makefile,那么还需要通过 cmake 的 add_custom_target 来调用make 命令来实现编译了。参考了http://stackoverflow.com/questions/26918459/using-local-makefile-for-clion-instead-of-cmake 的回答,简单调试修...转载 2019-08-29 20:20:06 · 3166 阅读 · 0 评论 -
点乘 和 叉乘 几何意义
转载 2018-12-18 11:23:56 · 1306 阅读 · 0 评论 -
vs2017 编译 FreeGlut3.0 + debug x64模式
1. cmake, FreeGlut 3.0源码安装包 点击 configure , 再次点击 generate,最后打开 freegult. sln . 在debug x64模式下, 从新全部生成一下,得到 lib 和dll 文件。 头文件 *.h 在源码里面有 ,所在文件夹是 ../GL下(自己找,不是编译生成的)2.配置.h/.lib/.dll环境(1)复制bin\...原创 2018-12-18 09:49:16 · 578 阅读 · 0 评论 -
用c++表达 Frenet frame
数学描述The formulas given above for T, N, and B depend on the curve being given in terms of the arclength parameter. This is a natural assumption in Euclidean geometry, because the arclength is a Eucli...原创 2018-11-19 15:37:25 · 2110 阅读 · 0 评论 -
Eigen 利用SVD矩阵分解 求伪逆代码
MatrixXd 是double类型,如果是float类型请改为 MatrixXf计算结果 可与matlab的 pinv() 函数 对比,计算结果是一致的。Eigen::MatrixXd MainWindow::pinv(Eigen::MatrixXd A){ Eigen::JacobiSVD<Eigen::MatrixXd> svd(A, Eigen::C...转载 2018-09-19 15:13:45 · 4575 阅读 · 2 评论 -
点 线 面 最小距离计算方法
转自 http://paulbourke.net/geometry/pointlineplane/Minimum Distance betweena Point and a LineWritten by Paul BourkeOctober 1988This note describes the technique and gives the solution to finding...转载 2018-10-12 10:26:27 · 1855 阅读 · 0 评论 -
用vector实现二维向量
如果一个向量的每一个元素是一个向量,则称为二维向量,例如vector<vector<int> >vv(3, vector<int>(4));//这里,两个“>”间的空格是不可少的将构造一个二维向量vv,它含有三个元素,每个元素含有4个int型元素的向量。编译器两次调用vector的构造函数构造对象vv,第一次调用构造函数构造了一个无名的含有4个0的v...转载 2018-10-29 15:36:39 · 506 阅读 · 0 评论 -
push_back 处理用vector构成的二维数组
int main(){ int index1 = 2; int index2 = 2; vector<vector<float>> vectorTemp; for (int i = 0; i < index1; i++) { vectorTemp.push_back(vector<f...原创 2018-10-29 21:46:59 · 5096 阅读 · 0 评论 -
开源软件、库搜索站
最近在windows上用C++实现一些算法,于是就发现这个网站,有很多开源的库。。。。可以直接用。网址: https://sourceforge.net/directory/os:windows/原创 2018-11-06 15:57:58 · 301 阅读 · 0 评论 -
Armadillo C++ 线性代数库,矩阵元素的乘法、除法
例如 A=[1;2] B=[4;4]矩阵对应元素除法A/B=[0.25;0.5]矩阵对应元素乘法A%B=[4;8]更多操作参考Armadillo官方Document。原创 2018-11-09 15:56:53 · 2322 阅读 · 0 评论 -
TeeChart替代品,MFC下好用的高速绘图控件-(Hight-Speed Charting)
转自 https://blog.youkuaiyun.com/czyt1988/article/details/8740500类库下载 https://www.codeproject.com/Articles/14075/High-speed-Charting-Control转载 2018-11-02 19:59:35 · 591 阅读 · 0 评论 -
Distance from a point to a line
The problem Let , and be the position vectors of the points A, B and C respectively, and L be the line passing through A and B. ...原创 2018-11-14 10:48:12 · 855 阅读 · 0 评论 -
向量间旋转角计算
向量的点乘和叉乘都是很有用的数学工具,不过他们也有局限性。关键是向量点乘可以得到两个向量之间的夹角, 而不是旋转角,这个角度是没有方向的,范围是[0-pi], 而这往往不是我们想要的, 实际问题中我们常常要计算从向量p1沿逆时针方向转到与向量p2方向一致的确切角度,我把这个角度定义为旋转角。 旋转角的计算既需要夹角,还需要两个向量的叉乘, 以确定p1和p2的角度方向关系。关于叉乘符号与向量的角...转载 2018-11-14 14:58:03 · 6422 阅读 · 0 评论 -
ubuntu+CLion开发C/C++项目
why CLion?CLion有众多好处,如Smart C和C ++编辑器、导航、重构、实时代码分析等,有跨平台IDE中的百兽之王之称。我准备使用CLion的主要理由有两点:其一,我一直使用JetBrains的IDE,如IntelliJ IDEA(java开发),pycharm(python开发),熟悉该公司的IDE,方便快速开发,专注于代码本身。其二,CLion使用CMake作为...转载 2019-08-29 20:24:44 · 1027 阅读 · 0 评论