如题,本帖主要内容为一些计算代码的开源,有简单的也有复杂的,保证原创!原代码开源在本人的blog,附网址(花生壳搭的,不稳定):http://xxxzzc.imwork.net:25245/zzc/
一楼占楼,陆续更新!
几何计算——线段长度
- #include <stdio.h>
- #include <math.h>
- typedef struct tagPOINT
- {
- double x;
- double y;
- }POINT;
- typedef struct tagLINE
- {
- POINT point_beg;
- POINT point_end;
- }LINE;
- double GetLineLength(const LINE* line_demo)
- {
- double dx, dy;
- dx = line_demo->point_end.x - line_demo->point_beg.x;
- dy = line_demo->point_end.y - line_demo->point_beg.y;
- return sqrt(dx * dx + dy * dy);
- }
|