File indexing completed on 2025-01-18 10:04:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef Prs3d_Point_HeaderFile
0015 #define Prs3d_Point_HeaderFile
0016
0017 #include <Graphic3d_ArrayOfPoints.hxx>
0018 #include <Graphic3d_Group.hxx>
0019 #include <Prs3d_Drawer.hxx>
0020 #include <Prs3d_PointAspect.hxx>
0021
0022 template <class AnyPoint, class PointTool>
0023 class Prs3d_Point
0024 {
0025 public:
0026 DEFINE_STANDARD_ALLOC
0027
0028 private:
0029 Standard_EXPORT static void DrawPoint
0030 (const AnyPoint& thePoint,
0031 const Handle(Graphic3d_Group) theGroup)
0032 {
0033 Standard_Real aX,aY,aZ;
0034 PointTool::Coord(thePoint,aX,aY,aZ);
0035 Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
0036 anArrayOfPoints->AddVertex (aX, aY, aZ);
0037 theGroup->AddPrimitiveArray (anArrayOfPoints);
0038 }
0039
0040 public:
0041 Standard_EXPORT static void Add
0042 (const Handle (Prs3d_Presentation)& thePrs,
0043 const AnyPoint& thePoint,
0044 const Handle (Prs3d_Drawer)& theDrawer)
0045 {
0046 Handle(Graphic3d_Group) aGroup = thePrs->CurrentGroup();
0047 aGroup->SetPrimitivesAspect(theDrawer->PointAspect()->Aspect());
0048 DrawPoint(thePoint, aGroup);
0049 }
0050
0051 Standard_EXPORT static Standard_Boolean Match
0052 (const AnyPoint& thePoint,
0053 const Standard_Real theX,
0054 const Standard_Real theY,
0055 const Standard_Real theZ,
0056 const Standard_Real theDistance)
0057 {
0058 Standard_Real aX,aY,aZ;
0059 PointTool::Coord(thePoint, aX, aY, aZ);
0060 return Sqrt((theX - aX)*(theX - aX) + (theY - aY)*(theY - aY)
0061 + (theZ - aZ)*(theZ - aZ)) <= theDistance;
0062 }
0063 };
0064
0065 #endif