// 8-Feb-2013 Dale Fugier, http://mcneel.myjetbrains.com/youtrack/issue/RH-15661 RH_C_FUNCTION bool RHC_RhinoCreateSpiral0( ON_3DPOINT_STRUCT axis_start, ON_3DVECTOR_STRUCT axis_dir, ON_3DPOINT_STRUCT radius_point, double pitch, double turn_count, double radius0, double radius1, ON_NurbsCurve* pCurve ) { bool rc = false; if( pCurve ) { ON_3dPoint axisStart(axis_start.val); ON_3dVector axisDir(axis_dir.val); ON_3dPoint radiusPoint(radius_point.val); rc = RhinoCreateSpiral( axisStart, axisDir, radiusPoint, pitch, turn_count, radius0, radius1, *pCurve ); if( rc && pCurve ) rc = pCurve->IsValid() ? true : false; } return rc; }
bool Cone::Interpolate(const MiscLib::Vector< Cone > &cones, const MiscLib::Vector< float > &weights, Cone *ic) { Vec3f center(0, 0, 0); Vec3f axisDir(0, 0, 0); float omega = 0; for(size_t i = 0; i < cones.size(); ++i) { center += weights[i] * cones[i].Center(); axisDir += weights[i] * cones[i].AxisDirection(); omega += weights[i] * cones[i].Angle(); } axisDir.normalize(); return ic->Init(center, axisDir, omega); }
bool Cylinder::Interpolate(const MiscLib::Vector< Cylinder > &cylinders, const MiscLib::Vector< float > &weights, Cylinder *ic) { Vec3f axisPos(0, 0, 0); Vec3f axisDir(0, 0, 0); float r = 0; for(size_t i = 0; i < cylinders.size(); ++i) { axisPos += weights[i] * cylinders[i].AxisPosition(); axisDir += weights[i] * cylinders[i].AxisDirection(); r += weights[i] * cylinders[i].Radius(); } axisDir.normalize(); return ic->Init(axisDir, axisPos, r); }