Acad::ErrorStatus rx_makeArc(const AcGePoint3d pt1, const AcGePoint3d pt2, double bulge, const AcGeVector3d entNorm, AcGeCircArc3d& arc) { Acad::ErrorStatus es = Acad::eOk; // The points that are coming in are in ECS. These are actually // 2d points, may be with an elevation in the z coord. // // Therefore, let's create a 2d arc from these values and transform // the relevant data of the arc for creating a 3d arc. AcGeCircArc2d arc2d; AcGePoint2d p1, p2; assert(fabs(pt1[Z] - pt2[Z]) < 1.0e-10); p1.set(pt1[X], pt1[Y]); p2.set(pt2[X], pt2[Y]); arc2d.set(p1, p2, bulge); AcGePoint3d center((arc2d.center())[X], (arc2d.center())[Y], pt1[Z]); AcGePoint3d startPnt((arc2d.startPoint())[X], (arc2d.startPoint())[Y], pt1[Z]); AcGePoint3d endPnt((arc2d.endPoint())[X], (arc2d.endPoint())[Y], pt1[Z]); // If the arc is CW, flip the normal. AcGeVector3d norm; if (arc2d.startAng() > arc2d.endAng()) { norm.set(0, 0, -1); } else { norm.set(0, 0, 1); } double incAng = fabs(arc2d.endAng() - arc2d.startAng()); // Transform all the data to WCS. acdbEcs2Wcs(asDblArray(center), asDblArray(center), asDblArray(entNorm), Adesk::kFalse); acdbEcs2Wcs(asDblArray(startPnt), asDblArray(startPnt), asDblArray(entNorm), Adesk::kFalse); acdbEcs2Wcs(asDblArray(endPnt), asDblArray(endPnt), asDblArray(entNorm), Adesk::kFalse); acdbEcs2Wcs(asDblArray(norm), asDblArray(norm), asDblArray(entNorm), Adesk::kTrue); arc.set(center, norm, norm.perpVector(), (startPnt - center).length(), 0, incAng); return es; }
osg::ref_ptr<osg::Geode> TestCircularTorus() { osg::Vec3 center(0, 0, 0); osg::Vec3 startPnt(300, 0, 0); osg::Vec3 normal(0, 0, 1); double startRadius = 50.0, endRadius = 25.0, angle = M_PI / 2; osg::ref_ptr<osg::Geode> geode = new osg::Geode; geode->addDrawable(Geometry::BuildCircularTorus(center, startPnt, normal, startRadius, endRadius, angle, osg::Vec4(1, 1, 1, 0))); return geode; }
osg::ref_ptr<osg::Geode> TestRectangularTorus() { osg::Vec3 center(0, 0, 0); osg::Vec3 startPnt(300, 0, 0); osg::Vec3 normal(0, 0, 1); double startWidth = 100.0, startHeight = 50.0, angle = M_PI * 2; double endWidth = 50.0, endHeight = 25.0; osg::ref_ptr<osg::Geode> geode = new osg::Geode; geode->addDrawable(Geometry::BuildRectangularTorus(center, startPnt, normal, startWidth, startHeight, endWidth, endHeight, angle, osg::Vec4(1, 1, 1, 0))); return geode; }
bool DecalRoad::_getTerrainHeight( const F32 &x, const F32 &y, F32 &height ) { Point3F startPnt( x, y, 10000.0f ); Point3F endPnt( x, y, -10000.0f ); RayInfo ri; bool hit; hit = getContainer()->castRay(startPnt, endPnt, TerrainObjectType, &ri); if ( hit ) height = ri.point.z; return hit; }
double RulerLabel::calculateDistance() { if (vertex1.isSet() && vertex2.isSet()) { vec3d startPnt(0,0,0); vec3d endPnt(0,0,0); getVertexPoints(&startPnt, &endPnt); rulerDistance = dist(startPnt, endPnt); // rulerDistance = dist(vertex1.xform(startPnt), vertex2.xform(endPnt)); // rulerDistance = dist(vertex1.geomPtr->xformPoint(startPnt), vertex2.geomPtr->xformPoint(endPnt, vertex2.reflect)); } else { rulerDistance = 0; } return rulerDistance; }