1 // TopLProps_Presentation.cpp: implementation of the TopLProps_Presentation class.
2 // Determine the local properties of shapes.
3 ////////////////////////////////////////////////////////////////////////////
6 #include "TopLProps_Presentation.h"
8 #include <Precision.hxx>
9 #include <GeomAPI_PointsToBSpline.hxx>
10 #include <GeomAPI_PointsToBSplineSurface.hxx>
11 #include <Geom_BSplineCurve.hxx>
12 #include <Geom_BSplineSurface.hxx>
13 #include <Geom_SurfaceOfRevolution.hxx>
14 #include <Geom_Circle.hxx>
15 #include <GC_MakeSegment.hxx>
17 #include <TColgp_Array1OfPnt.hxx>
18 #include <TColStd_Array2OfReal.hxx>
21 #include <TopoDS_Shape.hxx>
22 #include <TopoDS_Compound.hxx>
23 #include <TopoDS_Face.hxx>
24 #include <TopoDS_Edge.hxx>
25 #include <TopExp_Explorer.hxx>
27 #include <BRep_Builder.hxx>
28 #include <BRepBuilderAPI_MakeFace.hxx>
29 #include <BRepTools.hxx>
30 #include <BRep_Tool.hxx>
31 #include <BRepAdaptor_Curve.hxx>
32 #include <BRepAdaptor_Surface.hxx>
33 #include <BRepLProp_CLProps.hxx>
34 #include <BRepLProp_SLProps.hxx>
44 #define ASTR(_val) TCollection_AsciiString(_val)
45 #define PRINT_COORDS(_p) ASTR((_p).X()) + " " + ASTR((_p).Y()) + " " + ASTR((_p).Z())
47 #define D1Color Quantity_Color(Quantity_NOC_DARKOLIVEGREEN4)
48 #define D2Color Quantity_Color(Quantity_NOC_DARKOLIVEGREEN)
49 #define D3Color Quantity_Color(Quantity_NOC_DARKGREEN)
50 #define TanColor Quantity_Color(Quantity_NOC_GREEN)
51 #define NormColor Quantity_Color(Quantity_NOC_CYAN4)
52 #define CrvtColor Quantity_Color(Quantity_NOC_BLUE1)
55 // Initialization of global variable with an instance of this class
56 OCCDemo_Presentation* OCCDemo_Presentation::Current = new TopLProps_Presentation;
58 // Initialization of array of samples
59 const TopLProps_Presentation::PSampleFuncType TopLProps_Presentation::SampleFuncs[] =
61 &TopLProps_Presentation::sample1,
62 &TopLProps_Presentation::sample2,
63 &TopLProps_Presentation::sample3,
64 &TopLProps_Presentation::sample4
67 //////////////////////////////////////////////////////////////////////
68 // Construction/Destruction
69 //////////////////////////////////////////////////////////////////////
71 TopLProps_Presentation::TopLProps_Presentation()
74 myNbSamples = sizeof(SampleFuncs)/sizeof(PSampleFuncType);
75 setName ("Local Properties of Shapes");
78 //////////////////////////////////////////////////////////////////////
80 //////////////////////////////////////////////////////////////////////
82 void TopLProps_Presentation::DoSample()
84 getAISContext()->EraseAll();
85 if (myIndex >=0 && myIndex < myNbSamples)
86 (this->*SampleFuncs[myIndex])();
89 //////////////////////////////////////////////////////////////////////
91 //////////////////////////////////////////////////////////////////////
92 //================================================================
94 //================================================================
95 // Function : CreateRevolShape
97 //================================================================
99 static TopoDS_Shape CreateRevolShape()
101 Standard_Real aCoords1[][3] =
103 {0,-8,2},{0,-7.5,1},{0,-7,0.5},{0,-6.5,1.5},{0,-6,2},{0,-5,2.5},{0,-4,2.8},
104 {0,-3,2.6},{0,-2,2.4},{0,-1,2},{0,-0.5,1.5},{0,0,1.2}
106 Standard_Real aCoords2[][3] =
108 {0,0,1.2},{0,0.5,1},{0,1,0.8},{0,2,1.2},{0,3,1.5},{0,4,2},{0,4.5,2.7},{0,5,3}
111 Standard_Integer nPoles1 = sizeof(aCoords1)/(sizeof(Standard_Real)*3);
112 Standard_Integer nPoles2 = sizeof(aCoords2)/(sizeof(Standard_Real)*3);
114 TColgp_Array1OfPnt aCurvePoint1 (1, nPoles1);
115 TColgp_Array1OfPnt aCurvePoint2 (1, nPoles2);
117 for (Standard_Integer i=0; i < nPoles1; i++)
118 aCurvePoint1(i+1) = gp_Pnt (aCoords1[i][0]*SCALE, aCoords1[i][1]*SCALE, aCoords1[i][2]*SCALE);
119 for ( i=0; i < nPoles2; i++)
120 aCurvePoint2(i+1) = gp_Pnt (aCoords2[i][0]*SCALE, aCoords2[i][1]*SCALE, aCoords2[i][2]*SCALE);
122 GeomAPI_PointsToBSpline aPTB1 (aCurvePoint1,3,10,GeomAbs_C3,0.3*SCALE);
123 Handle (Geom_BSplineCurve) aCurve1 = aPTB1.Curve();
124 GeomAPI_PointsToBSpline aPTB2 (aCurvePoint2,3,10,GeomAbs_C3,0.3*SCALE);
125 Handle (Geom_BSplineCurve) aCurve2 = aPTB2.Curve();
127 gp_Ax1 anAxis = gp_Ax1(gp_Pnt(0,0,0),gp::DY());
128 GC_MakeSegment aSegment(gp_Pnt(0,-8*SCALE,0),gp_Pnt(0,-8*SCALE,2*SCALE));
129 Handle_Geom_TrimmedCurve aLine = aSegment.Value();
130 Handle_Geom_SurfaceOfRevolution aSurface1 = new Geom_SurfaceOfRevolution(aLine, anAxis);
131 Handle_Geom_SurfaceOfRevolution aSurface2 = new Geom_SurfaceOfRevolution(aCurve1, anAxis);
132 Handle_Geom_SurfaceOfRevolution aSurface3 = new Geom_SurfaceOfRevolution(aCurve2, anAxis);
134 BRep_Builder aBuilder;
135 TopoDS_Compound aShape;
136 aBuilder.MakeCompound(aShape);
137 TopoDS_Face aFace1,aFace2,aFace3;
138 aFace1 = BRepBuilderAPI_MakeFace(aSurface1);
139 aFace2 = BRepBuilderAPI_MakeFace(aSurface2);
140 aFace3 = BRepBuilderAPI_MakeFace(aSurface3);
142 aBuilder.Add(aShape,aFace1);
143 aBuilder.Add(aShape,aFace2);
144 aBuilder.Add(aShape,aFace3);
149 //================================================================
150 // Function : CreateBSplShape
152 //================================================================
154 static TopoDS_Shape CreateBSplnShape()
156 Standard_Real aZCoords1 [] =
163 Standard_Real aZCoords2 [] =
170 TColStd_Array2OfReal aZPoints1(1,4,1,4);
171 TColStd_Array2OfReal aZPoints2(1,4,1,4);
173 Standard_Integer aColLength1 = aZPoints1.ColLength();
174 Standard_Integer aRowLength1 = aZPoints1.RowLength();
175 Standard_Integer aColLength2 = aZPoints2.ColLength();
176 Standard_Integer aRowLength2 = aZPoints2.RowLength();
177 Standard_Integer aIndex = -1;
179 for(Standard_Integer i = 0 ; i < aRowLength1 ; i++)
181 for(Standard_Integer j = 0; j < aColLength1 ; j++)
184 aZPoints1(i+1,j+1) = aZCoords1[aIndex];
189 for( i = 0 ; i < aRowLength2 ; i++)
191 for(Standard_Integer j = 0; j < aColLength2 ; j++)
194 aZPoints2(i+1,j+1) = aZCoords2[aIndex];
198 Standard_Real aXStep = 170, aYStep = 170;
199 Standard_Real aX0 = -350, aY0 = -250;
200 Standard_Real auxY0,auxX0 = aX0 - aXStep;
202 for( i = 0 ; i < aColLength1 ; i++)
205 auxY0 = aY0 - aYStep;
207 for(Standard_Integer j = 0 ; j < aRowLength1 ; j++)
209 aZPoints1(i+1,j+1) *=2*SCALE;
210 aZPoints2(i+1,j+1) *=2*SCALE;
215 GeomAPI_PointsToBSplineSurface aPTBS;
216 aPTBS.Init(aZPoints1,aX0,aXStep,aY0,aYStep,3,10,GeomAbs_C3,0.3*SCALE);
217 Handle_Geom_BSplineSurface aSurface1 = aPTBS.Surface();
219 aPTBS.Init(aZPoints2,aX0,aXStep,aY0,aYStep,3,10,GeomAbs_C3,0.3*SCALE);
220 Handle_Geom_BSplineSurface aSurface2 = aPTBS.Surface();
222 TopoDS_Face aFace1,aFace2;
223 aFace1 = BRepBuilderAPI_MakeFace (aSurface1);
224 aFace2 = BRepBuilderAPI_MakeFace (aSurface2);
226 BRep_Builder aBuilder;
227 TopoDS_Compound aShape;
228 aBuilder.MakeCompound(aShape);
229 aBuilder.Add(aShape,aFace1);
230 aBuilder.Add(aShape,aFace2);
236 //================================================================
237 // Function : TopLProps_Presentation::sample1
239 //================================================================
241 void TopLProps_Presentation::sample1()
243 TopoDS_Shape aShape = CreateRevolShape();
245 // get aNumEdge-th edge
247 TopExp_Explorer anExp(aShape, TopAbs_EDGE);
249 for (int i=1; anExp.More() && i <= aNumEdge; anExp.Next(), i++)
250 aEdge = TopoDS::Edge(anExp.Current());
251 if (aEdge.IsNull()) return;
254 Handle_AIS_InteractiveObject aShowShape = drawShape(aShape);
255 if(WAIT_A_SECOND) return;
256 drawShape(aEdge,Quantity_NOC_RED);
257 if(WAIT_A_SECOND) return;
258 getAISContext()->Erase(aShowShape);
259 if(WAIT_A_LITTLE) return;
261 Standard_Real aPoints [] = { 0.1,0.5,0.7};
262 Standard_Integer aNbPoints = sizeof(aPoints)/sizeof(Standard_Real);
263 showEdgeLProps(aEdge,aNbPoints,aPoints);
266 //================================================================
267 // Function : TopLProps_Presentation::sample2
269 //================================================================
271 void TopLProps_Presentation::sample2()
273 TopoDS_Shape aShape = CreateRevolShape();
275 // get aNumFace-th face
277 TopExp_Explorer anExp(aShape, TopAbs_FACE);
279 for (int i=1; anExp.More() && i <= aNumFace; anExp.Next(), i++)
280 aFace = TopoDS::Face(anExp.Current());
281 if (aFace.IsNull()) return;
284 Handle_AIS_InteractiveObject aShowShape = drawShape(aShape);
285 if(WAIT_A_SECOND) return;
286 Handle_AIS_InteractiveObject aShowFace = drawShape(aFace,Graphic3d_NOM_BRASS,Standard_False);
287 getAISContext()->SetDisplayMode(aShowFace,AIS_WireFrame);
288 getAISContext()->Display(aShowFace);
289 if(WAIT_A_SECOND) return;
290 getAISContext()->UnsetDisplayMode(aShowFace);
291 getAISContext()->Erase(aShowShape);
292 if(WAIT_A_LITTLE) return;
294 Standard_Real aPoints [][2] = { {0.1,0.1},{0.7,0.3},{0.5,0.6} };
295 Standard_Integer aNbPoints = sizeof(aPoints)/(sizeof(Standard_Real)*2);
296 showFaceLProps(aFace,aNbPoints,aPoints);
299 //================================================================
300 // Function : TopLProps_Presentation::sample3
302 //================================================================
304 void TopLProps_Presentation::sample3()
306 TopoDS_Shape aShape = CreateBSplnShape();
308 // get aNumEdge-th edge
310 TopExp_Explorer anExp(aShape, TopAbs_EDGE);
312 for (int i=1; anExp.More() && i <= aNumEdge; anExp.Next(), i++)
313 aEdge = TopoDS::Edge(anExp.Current());
314 if (aEdge.IsNull()) return;
316 Standard_Real aFirst,aLast;
317 BRep_Tool::Range(aEdge,aFirst,aLast) ;
319 Standard_Real P1,P2,P3;
320 P1 = aFirst + (aLast-aFirst)*0.25;
321 P2 = aFirst + (aLast-aFirst)*0.5;
322 P3 = aFirst + (aLast-aFirst)*0.833;
323 Standard_Real aPoints [] = {P1,P2,P3 };
324 Standard_Integer aNbPoints = sizeof(aPoints)/sizeof(Standard_Real);
327 Handle_AIS_InteractiveObject aShowShape = drawShape(aShape);
328 if(WAIT_A_SECOND) return;
330 drawShape(aEdge,Quantity_NOC_RED);
331 if(WAIT_A_SECOND) return;
332 getAISContext()->Erase(aShowShape);
333 if(WAIT_A_LITTLE) return;
335 showEdgeLProps(aEdge,aNbPoints,aPoints);
338 //================================================================
339 // Function : TopLProps_Presentation::sample4
341 //================================================================
343 void TopLProps_Presentation::sample4()
345 TopoDS_Shape aShape = CreateBSplnShape();
347 // get aNumFace-th face
349 TopExp_Explorer anExp(aShape, TopAbs_FACE);
351 for (int i=1; anExp.More() && i <= aNumFace; anExp.Next(), i++)
352 aFace = TopoDS::Face(anExp.Current());
353 if (aFace.IsNull()) return;
355 Standard_Real UMin,UMax,VMin,VMax;
356 BRepTools::UVBounds(aFace,UMin,UMax,VMin,VMax);
357 Standard_Real U1 = UMin + (UMax-UMin)*0.769,
358 U2 = UMin + (UMax-UMin)*0.833,
359 U3 = UMin + (UMax-UMin)*0.333,
360 V1 = VMin + (VMax-VMin)*0.333,
361 V2 = VMin + (VMax-VMin)*0.5,
362 V3 = VMin + (VMax-VMin)*0.667;
363 Standard_Real aPoints [][2] =
365 {U1,V1},{U2,V2},{U3,V3}
367 Standard_Integer aNbPoints = sizeof(aPoints)/(sizeof(Standard_Real)*2);
370 Handle_AIS_InteractiveObject aShowShape = drawShape(aShape);
371 if(WAIT_A_SECOND) return;
372 Handle_AIS_InteractiveObject aShowFace = drawShape(aFace,Graphic3d_NOM_BRASS,Standard_False);
373 getAISContext()->SetDisplayMode(aShowFace,AIS_WireFrame);
374 getAISContext()->Display(aShowFace);
375 if(WAIT_A_SECOND) return;
376 getAISContext()->UnsetDisplayMode(aShowFace);
377 getAISContext()->Erase(aShowShape);
378 if(WAIT_A_LITTLE) return;
380 showFaceLProps(aFace,aNbPoints,aPoints);
383 //================================================================
384 // Function : TopLProps_Presentation::showEdgeLProps
386 //================================================================
388 void TopLProps_Presentation::showEdgeLProps(TopoDS_Edge& theEdge,
389 const Standard_Integer theNbPoints,
390 const Standard_Real thePoints[])
392 TCollection_AsciiString aTitle ("Local properties on edge");
393 TCollection_AsciiString aText =
394 " // Create an Edge" EOL
395 " TopoDS_Edge theEdge;" EOL
396 " // initialize theEdge" EOL
397 " // theEdge = ... ;" EOL EOL
399 " // define parameter at which properties should be computed" EOL
400 " Standard_Real aParam;" EOL
401 " // aParam = ..." EOL EOL
403 " // create an algorithm for computing the local properties" EOL
404 " // at a point on an edge" EOL
405 " BRepAdaptor_Curve anAdapCurve (theEdge) ;" EOL
406 " Standard_Integer maxOrder = 3;" EOL
407 " Standard_Real aResol = gp::Resolution();" EOL
408 " BRepLProp_CLProps aLProps (anAdapCurve,maxOrder,aResol);" EOL EOL
410 " // compute local properties" EOL
411 " aLProps.SetParameter (aParam);" EOL
412 " gp_Pnt aPnt = aLProps.Value();" EOL
413 " gp_Vec aVecD1 = aLProps.D1();" EOL
414 " gp_Vec aVecD2 = aLProps.D2();" EOL
415 " gp_Vec aVecD3 = aLProps.D3();" EOL
416 " gp_Dir aTangent, aNormal;" EOL
417 " Standard_Real aCurvature;" EOL
418 " gp_Pnt aCentreOfCurvature;" EOL
419 " Standard_Boolean isCurvatureValid = Standard_False;" EOL
420 " Standard_Boolean isTan = aLProps.IsTangentDefined();" EOL EOL
422 " // the tangent must be defined" EOL
423 " // to compute the curvature and the normal" EOL
426 " aLProps.Tangent (aTangent);" EOL
427 " aCurvature = aLProps.Curvature();" EOL
428 " // the curvature must be non-null and finite" EOL
429 " // to compute the centre of curvature and the normal" EOL
430 " if (aCurvature > aResol && !Precision::IsInfinite(aCurvature))" EOL
432 " isCurvatureValid = Standard_True;" EOL
433 " aLProps.CentreOfCurvature (aCentreOfCurvature);" EOL
434 " aLProps.Normal (aNormal);" EOL
437 "//======================================" EOL;
438 setResultTitle (aTitle.ToCString());
439 setResultText (aText.ToCString());
441 BRepAdaptor_Curve anAdapCurve (theEdge) ;
442 Handle_AIS_InteractiveObject aObjs[7];
443 Standard_Integer maxOrder = 3;
444 Standard_Real aResol = gp::Resolution();
445 BRepLProp_CLProps aLProps (anAdapCurve,maxOrder,aResol);
446 for(Standard_Integer i = 0; i < theNbPoints ; i++)
448 if (WAIT_A_LITTLE) return;
450 for (int j=0; j < sizeof(aObjs)/sizeof(Handle(AIS_InteractiveObject)); j++)
451 if (!aObjs[j].IsNull())
452 getAISContext()->Erase(aObjs[j]);
454 // compute local properties
455 aLProps.SetParameter (thePoints[i]);
456 gp_Pnt aPnt = aLProps.Value();
457 gp_Vec aVecD1 = aLProps.D1();
458 gp_Vec aVecD2 = aLProps.D2();
459 gp_Vec aVecD3 = aLProps.D3();
460 gp_Dir aTangent, aNormal;
461 Standard_Real aCurvature;
462 gp_Pnt aCentreOfCurvature;
463 Standard_Boolean isCurvatureValid = Standard_False;
464 Standard_Boolean isTan = aLProps.IsTangentDefined();
466 // the tangent must be defined
467 // to compute the curvature and the normal
470 aLProps.Tangent (aTangent);
471 aCurvature = aLProps.Curvature();
472 // the curvature must be non-null and finite
473 // to compute the centre of curvature and the normal
474 if (aCurvature > aResol && !Precision::IsInfinite(aCurvature))
476 isCurvatureValid = Standard_True;
477 aLProps.CentreOfCurvature (aCentreOfCurvature);
478 aLProps.Normal (aNormal);
482 aText += EOL " Results with parameter ";
483 aText += ASTR(thePoints[i]) + " :" EOL
484 "aPnt = (" + PRINT_COORDS(aPnt) + ")" EOL
485 "aVecD1 = (" + PRINT_COORDS(aVecD1) + ")" EOL
486 "aVecD2 = (" + PRINT_COORDS(aVecD2) + ")" EOL
487 "aVecD3 = (" + PRINT_COORDS(aVecD3) + ")" EOL;
491 "aTangent = (" + PRINT_COORDS(aTangent) + ")" EOL
492 "aCurvature = " + ASTR(aCurvature) + EOL;
493 if (isCurvatureValid)
496 "aCentreOfCurvature = (" + PRINT_COORDS(aCentreOfCurvature) + ")" EOL
497 "aNormal = (" + PRINT_COORDS(aNormal) + ")" EOL;
501 aText += "Tangent is not defined" EOL;
502 setResultText (aText.ToCString());
505 aObjs[0] = drawPoint (aPnt);
506 aObjs[3] = drawVector (aPnt, aVecD3, D3Color);
507 aObjs[2] = drawVector (aPnt, aVecD2, D2Color);
508 aObjs[1] = drawVector (aPnt, aVecD1, D1Color);
510 aObjs[4] = drawVector (aPnt, gp_Vec(aTangent)*50, TanColor);
511 if (isCurvatureValid)
513 aObjs[5] = drawVector (aPnt, gp_Vec(aNormal)*50, NormColor);
514 Handle(Geom_Circle) aCircle =
515 new Geom_Circle (gp_Ax2 (aCentreOfCurvature, aNormal^aTangent),
516 aCentreOfCurvature.Distance(aPnt));
517 aObjs[6] = drawCurve (aCircle, CrvtColor);
522 //================================================================
523 // Function : TopLProps_Presentation::showFaceLProps
525 //================================================================
527 void TopLProps_Presentation::showFaceLProps(TopoDS_Face& theFace,
528 const Standard_Integer theNbPoints,
529 const Standard_Real thePoints[][2])
531 TCollection_AsciiString aTitle ("Local properties on face");
532 TCollection_AsciiString aText;
534 " // Create a Face" EOL
535 " TopoDS_Face theFace;" EOL
536 " // initialize aFace" EOL
537 " // aFace = ..." EOL EOL
539 " // define U and V parameters at which properties should be computed" EOL
540 " Standard_Real aUParam, aVParam;" EOL
541 " // aUParam = ..." EOL
542 " // aVParam = ..." EOL EOL
544 " // compute local properties" EOL
545 " Standard_Integer maxOrder = 2;" EOL
546 " Standard_Real aResol = gp::Resolution();" EOL
547 " GeomLProp_SLProps aLProps (theSurface, maxOrder, aResol);" EOL
548 " aLProps.SetParameters (aUParam, aVParam);" EOL
549 " gp_Pnt aPnt = aLProps.Value();" EOL
550 " gp_Vec aVecD1U = aLProps.D1U();" EOL
551 " gp_Vec aVecD1V = aLProps.D1V();" EOL
552 " gp_Vec aVecD2U = aLProps.D2U();" EOL
553 " gp_Vec aVecD2V = aLProps.D2V();" EOL
554 " gp_Vec aVecDUV = aLProps.DUV();" EOL
555 " gp_Dir aTangentU, aTangentV, aNormal, aMaxCurvD, aMinCurvD;" EOL
556 " Standard_Real aMaxCurvature, aMinCurvature, aMeanCurvature, aGausCurvature;" EOL
557 " // determine availability of properties" EOL
558 " Standard_Boolean isTanU = aLProps.IsTangentUDefined();" EOL
559 " Standard_Boolean isTanV = aLProps.IsTangentVDefined();" EOL
560 " Standard_Boolean isNormal = aLProps.IsNormalDefined();" EOL
561 " Standard_Boolean isCurvature = aLProps.IsCurvatureDefined();" EOL
563 " aLProps.TangentU (aTangentU);" EOL
565 " aLProps.TangentV (aTangentV);" EOL
567 " aNormal = aLProps.Normal();" EOL
568 " if (isCurvature)" EOL
570 " aMaxCurvature = aLProps.MaxCurvature();" EOL
571 " aMinCurvature = aLProps.MinCurvature();" EOL
572 " aGausCurvature = aLProps.GaussianCurvature();" EOL
573 " aMeanCurvature = aLProps.MeanCurvature();" EOL
574 " aLProps.CurvatureDirections (aMaxCurvD, aMinCurvD);" EOL
576 "//======================================" EOL EOL;
577 setResultTitle (aTitle.ToCString());
578 setResultText (aText.ToCString());
580 BRepAdaptor_Surface anAdapSurface (theFace);
582 Standard_Integer maxOrder = 2;
583 Standard_Real aResol = gp::Resolution();
584 BRepLProp_SLProps aLProps ( anAdapSurface, maxOrder , aResol);
585 Handle(AIS_InteractiveObject) aObjs[11];
586 for (int i=0; i < theNbPoints; i++)
590 for (int j=0; j < sizeof(aObjs)/sizeof(Handle(AIS_InteractiveObject)); j++)
591 if (!aObjs[j].IsNull())
592 getAISContext()->Erase(aObjs[j]);
594 // compute local properties
595 aLProps.SetParameters (thePoints[i][0], thePoints[i][1]);
596 gp_Pnt aPnt = aLProps.Value();
597 gp_Vec aVecD1U = aLProps.D1U();
598 gp_Vec aVecD1V = aLProps.D1V();
599 gp_Vec aVecD2U = aLProps.D2U();
600 gp_Vec aVecD2V = aLProps.D2V();
601 gp_Vec aVecDUV = aLProps.DUV();
602 gp_Dir aTangentU, aTangentV, aNormal, aMaxCurvD, aMinCurvD;
603 Standard_Real aMaxCurvature, aMinCurvature, aMeanCurvature, aGausCurvature;
604 // determine availability of properties
605 Standard_Boolean isTanU = aLProps.IsTangentUDefined();
606 Standard_Boolean isTanV = aLProps.IsTangentVDefined();
607 Standard_Boolean isNormal = aLProps.IsNormalDefined();
608 Standard_Boolean isCurvature = aLProps.IsCurvatureDefined();
610 aLProps.TangentU (aTangentU);
612 aLProps.TangentV (aTangentV);
614 aNormal = aLProps.Normal();
617 aMaxCurvature = aLProps.MaxCurvature();
618 aMinCurvature = aLProps.MinCurvature();
619 aGausCurvature = aLProps.GaussianCurvature();
620 aMeanCurvature = aLProps.MeanCurvature();
621 aLProps.CurvatureDirections (aMaxCurvD, aMinCurvD);
624 aText = aText + EOL " Results with parameters "
625 "U=" + ASTR(thePoints[i][0]) + " V=" + ASTR(thePoints[i][1]) + " :" EOL
626 "aPnt = (" + PRINT_COORDS(aPnt) + ")" EOL
627 "aVecD1U = (" + PRINT_COORDS(aVecD1U) + ")" EOL
628 "aVecD1V = (" + PRINT_COORDS(aVecD1V) + ")" EOL
629 "aVecD2U = (" + PRINT_COORDS(aVecD2U) + ")" EOL
630 "aVecD2V = (" + PRINT_COORDS(aVecD2V) + ")" EOL
631 "aVecDUV = (" + PRINT_COORDS(aVecDUV) + ")" EOL;
634 "aTangentU = (" + PRINT_COORDS(aTangentU) + ")" EOL;
637 "aTangentV = (" + PRINT_COORDS(aTangentV) + ")" EOL;
640 "aNormal = (" + PRINT_COORDS(aNormal) + ")" EOL;
643 "aMaxCurvature = " + ASTR(aMaxCurvature) + EOL
644 "aMinCurvature = " + ASTR(aMinCurvature) + EOL
645 "aMeanCurvature = " + ASTR(aMeanCurvature) + EOL
646 "aGausCurvature = " + ASTR(aGausCurvature) + EOL
647 "aMaxCurvD = (" + PRINT_COORDS(aMaxCurvD) + ")" EOL
648 "aMinCurvD = (" + PRINT_COORDS(aMinCurvD) + ")" EOL;
649 setResultText (aText.ToCString());
652 aObjs[0] = drawPoint (aPnt);
653 aObjs[3] = drawVector (aPnt, aVecD2U, D2Color);
654 aObjs[4] = drawVector (aPnt, aVecD2V, D2Color);
655 aObjs[1] = drawVector (aPnt, aVecD1U, D1Color);
656 aObjs[2] = drawVector (aPnt, aVecD1V, D1Color);
657 aObjs[5] = drawVector (aPnt, aVecDUV, D3Color);
659 aObjs[6] = drawVector (aPnt, gp_Vec(aTangentU)*50, TanColor);
661 aObjs[7] = drawVector (aPnt, gp_Vec(aTangentV)*50, TanColor);
663 aObjs[8] = drawVector (aPnt, gp_Vec(aNormal)*50, NormColor);
666 aObjs[9] = drawVector (aPnt, gp_Vec(aMaxCurvD)*50, CrvtColor);
667 aObjs[10] = drawVector (aPnt, gp_Vec(aMinCurvD)*50, CrvtColor);