admin 发表于 2024-3-16 08:50:47

三点角度0~2PI

AcGeVector3d v12(p2-p1);
AcGeVector3d v23(p3-p2);
double signedAngle = v12.angleTo(v23, AcGeVector3d::kZAxis); // 0~2PI
if (signedAngle > PI)
    signedAngle -= 2*PI; // -PI..+PI


AcGePoint3d ps, pe;// in
bool ccw; // in

AcGeVector3d v, vse(pe - ps);
AcGeVector3d v(-vse.y, vse.x, vse.z);
//v points to the left side of which is the outside if clockwise
if (ccw)
v = -v;
AcGePoint3d pt(ps + 0.5*vse);
AcDbRay *ray = new AcDbRay()
ray->setBasePoint(pt);
v.normalize();
ray->setUnitDir(v);
页: [1]
查看完整版本: 三点角度0~2PI