RH_C_FUNCTION void ON_Quaternion_SetRotation( ON_Quaternion* q, const ON_PLANE_STRUCT* plane0, const ON_PLANE_STRUCT* plane1) { if( q && plane0 && plane1 ) { ON_Plane temp0 = FromPlaneStruct(*plane0); ON_Plane temp1 = FromPlaneStruct(*plane1); q->SetRotation(temp0, temp1); } }
RH_C_FUNCTION bool ON_Intersect_PlanePlane(const ON_PLANE_STRUCT* planeA, const ON_PLANE_STRUCT* planeB, ON_Line* line) { bool rc = false; if( line && planeA && planeB ) { ON_Plane tempA = FromPlaneStruct(*planeA); ON_Plane tempB = FromPlaneStruct(*planeB); rc = ::ON_Intersect(tempA, tempB, *line); } return rc; }
RH_C_FUNCTION bool ON_Intersect_PlanePlanePlane(const ON_PLANE_STRUCT* planeA, const ON_PLANE_STRUCT* planeB, const ON_PLANE_STRUCT* planeC, ON_3dPoint* intersectionPoint) { bool rc = false; if( intersectionPoint && planeA && planeB && planeC ) { ON_Plane tempA = FromPlaneStruct(*planeA); ON_Plane tempB = FromPlaneStruct(*planeB); ON_Plane tempC = FromPlaneStruct(*planeC); rc = ::ON_Intersect(tempA, tempB, tempC, *intersectionPoint); } return rc; }
RH_C_FUNCTION bool ON_Curve_IsEllipse( const ON_Curve* pCurve, int ignore, ON_PLANE_STRUCT* plane, ON_Ellipse* ellipse, double tolerance ) { bool rc = false; if( pCurve ) { // ignore = 0 (none) // ignore = 1 (ignore plane) // ignore = 2 (ignore plane and ellipse) if( ignore>0 ) plane = NULL; if( ignore>1 ) ellipse = NULL; ON_Plane temp; ON_Plane* pPlane = NULL; if( plane ) { temp = FromPlaneStruct(*plane); pPlane = &temp; } rc = pCurve->IsEllipse(pPlane,ellipse,tolerance); if( plane ) CopyToPlaneStruct(*plane, temp); } return rc; }
RH_C_FUNCTION bool ON_Curve_IsArc( const ON_Curve* pCurve, int ignore, ON_PLANE_STRUCT* plane, ON_Arc* arc, double tolerance ) { bool rc = false; if( pCurve ) { // ignore = 0 (none) // ignore = 1 (ignore plane) // ignore = 2 (ignore plane and arc) if( ignore>0 ) plane = NULL; if( ignore>1 ) arc = NULL; ON_Plane temp; ON_Plane* pPlane = NULL; if( plane ) { temp = FromPlaneStruct(*plane); pPlane = &temp; } rc = pCurve->IsArc(pPlane,arc,tolerance)?true:false; if( plane ) CopyToPlaneStruct(*plane, temp); } return rc; }
RH_C_FUNCTION void ON_Annotation2_Plane(ON_Annotation2* ptr, ON_PLANE_STRUCT* plane, bool set) { if( ptr && plane ) { if( set ) ptr->m_plane = FromPlaneStruct(*plane); else CopyToPlaneStruct(*plane, ptr->m_plane); } }
RH_C_FUNCTION bool ON_Intersect_LinePlane(ON_Line* line, const ON_PLANE_STRUCT* plane, double* parameterOnLine) { bool rc = false; if( line && plane ) { ON_Plane temp = FromPlaneStruct(*plane); rc = ::ON_Intersect(*line, temp, parameterOnLine); } return rc; }
RH_C_FUNCTION bool ON_Curve_IsInPlane(const ON_Curve* pCurve, const ON_PLANE_STRUCT* plane, double tolerance) { bool rc = false; if( pCurve && plane ) { ON_Plane temp = FromPlaneStruct(*plane); rc = pCurve->IsInPlane(temp,tolerance)?true:false; } return rc; }
//David: I think the above fails because Ellipse has a Plane whose memory layout is not synonymous with ON_Plane RH_C_FUNCTION int ON_Ellipse_GetNurbForm2( const ON_PLANE_STRUCT* plane, double r0, double r1, ON_NurbsCurve* pNurbsCurve ) { int rc = 0; if( plane && pNurbsCurve ) { ON_Plane temp = FromPlaneStruct(*plane); ON_Ellipse ell(temp, r0, r1); rc = ell.GetNurbForm(*pNurbsCurve); } return rc; }
RH_C_FUNCTION int ON_Intersect_PlaneSphere(const ON_PLANE_STRUCT* plane, ON_Sphere* sphere, ON_CIRCLE_STRUCT* intersectionCircle) { int rc = 0; if( plane && sphere && intersectionCircle ) { sphere->plane.UpdateEquation(); ON_Plane temp = FromPlaneStruct(*plane); ON_Circle circle = FromCircleStruct(*intersectionCircle); #if defined(RHINO_V5SR) || defined(OPENNURBS_BUILD)// fixed in V5 rc = ON_Intersect(temp, *sphere, circle); #else rc = PS_Intersect(temp, *sphere, circle); //Go back to ::ON_Intersect(temp, *sphere, circle); once Grasshopper drops Rhino4 support. #endif CopyToCircleStruct(*intersectionCircle, circle); } return rc; }
RH_C_FUNCTION bool ON_Curve_IsPlanar( const ON_Curve* pCurve, bool ignorePlane, ON_PLANE_STRUCT* plane, double tolerance ) { bool rc = false; if(ignorePlane) plane = NULL; if( pCurve ) { ON_Plane temp; ON_Plane* pPlane = NULL; if( plane ) { temp = FromPlaneStruct(*plane); pPlane = &temp; } rc = pCurve->IsPlanar(pPlane, tolerance)?true:false; if( plane ) CopyToPlaneStruct(*plane, temp); } return rc; }