I'm using OpenCASCADE to read some geometries in IGES and STEP format. I'm using OpenGL to render these geometries but I'm having tough time with the trimming curves of NURBS surfaces. I don't know how to find the orientation of the trimming curves. OpenGL trims off the nurbs surface on the right of trimming curves. Can someone please help me with the evaluation of the orientation of the trimming curves?
The code below shows how I evaluated the trimming curves and how they are ordered.
// *** not sure how to find the orientation of the curves. OpenGL trims off the surface on the right side of trimming curves
// ordering the trimming curves
ShapeAnalysis_WireOrder ordering(false, Precision::Confusion());
ordering.KeepLoopsMode() = true;
for(std::vector<Handle_Geom2d_BSplineCurve>::const_iterator curve_iter = trimming_curves.begin();
curve_iter != trimming_curves.end(); ++curve_iter)
{
gp_Pnt2d first_point, last_point;
first_point = (*curve_iter) -> StartPoint();
last_point = (*curve_iter) -> EndPoint();
ordering.Add(first_point.XY(), last_point.XY());
}
ordering.Perform();
// trimming nurbs surface using the trimming curves
gluBeginTrim(nurbs_obj);
for(unsigned int index = 1; index <= trimming_curves.size(); ++index)
{
int curve_loc = ordering.Ordered(index);
Handle_Geom2d_BSplineCurve edge_curve = trimming_curves[abs(curve_loc)-1];
if(curve_loc < 0)
edge_curve -> Reverse();
}
gluNurbsCurve(nurbs_obj,...,GLU_MAP1_TRIM_3);
gluEndTrim(nurbs_obj);