]> OCCT Git - occt.git/commitdiff
Add API to get vertex by index from sensitive
authorsshutina <svetlana.shutina@opencascade.com>
Wed, 23 Jul 2025 14:14:46 +0000 (15:14 +0100)
committersshutina <svetlana.shutina@opencascade.com>
Thu, 24 Jul 2025 09:12:50 +0000 (10:12 +0100)
src/Select3D/Select3D_SensitivePrimitiveArray.cxx
src/Select3D/Select3D_SensitivePrimitiveArray.hxx

index 8c0d0d3fdcb70f27845aaf3741993c7df4e02dab..3a4956283c55dc6f06834b777b1ddd608d7dd63f 100644 (file)
@@ -395,6 +395,23 @@ bool Select3D_SensitivePrimitiveArray::InitTriangulation (const Handle(Graphic3d
   return true;
 }
 
+// =======================================================================
+// function : GetVertex
+// purpose  :
+// =======================================================================
+std::vector<Graphic3d_Vec3> Select3D_SensitivePrimitiveArray::GetVertex (const Standard_Integer theIndex) const
+{
+  std::vector<Graphic3d_Vec3> aVertices;
+  aVertices.reserve(3);
+  Graphic3d_Vec3i aTriNodes;
+  const Standard_Integer anIndexOffset = theIndex * 3;
+  getTriIndices(myIndices, anIndexOffset, aTriNodes);
+  aVertices.push_back (getPosVec3(aTriNodes[0]));
+  aVertices.push_back (getPosVec3(aTriNodes[1]));
+  aVertices.push_back (getPosVec3(aTriNodes[2]));
+  return aVertices;
+}
+
 // =======================================================================
 // function : InitPoints
 // purpose  :
index 28002d8ecbc98b4a836b2e61c11f2d54c32250f4..2f409c17b413831e4fcbb5785fbb2c06cfea1b7c 100644 (file)
@@ -195,6 +195,9 @@ public:
   //! Return the second node of last topmost detected edge or -1 if undefined (axis picking).
   Standard_Integer LastDetectedEdgeNode2() const { return myDetectedEdgeNode2; }
 
+  //! Return vertex by index.
+  Standard_EXPORT std::vector<Graphic3d_Vec3> GetVertex (const Standard_Integer theIndex) const;
+
   //! Dumps the content of me into the stream
   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;