Prs3d_ToolQuadric has been modified to return an indexed triangulation.
Added methods Prs3d_ToolQuadric::CreateTriangulation() and Prs3d_ToolQuadric::CreateTriangulation()
as more straightforward API returning generated triangulation.
Added missing const to constant methods.
Confusing method Prs3d_ToolQuadric::FillArray() filling both
Graphic3d_ArrayOfTriangles and Poly_Triangulation at once has been marked deprecated.
V3d_Trihedron, AIS_ViewCube and AIS_Manipulator
now set Closed flag to groups with shaded sphere and arrows.
gp_Ax3 aSystem (myPosition.Location(), myPosition.Direction());
gp_Trsf aTrsf;
aTrsf.SetTransformation (aSystem, gp_Ax3());
- aTool.FillArray (myArray, myTriangulation, aTrsf);
+ myArray = aTool.CreateTriangulation (aTrsf);
+ myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
}
//=======================================================================
Prs3d_ToolSphere aTool (theRadius, theSlicesNb, theStacksNb);
gp_Trsf aTrsf;
aTrsf.SetTranslation (gp_Vec(gp::Origin(), thePosition));
- aTool.FillArray (myArray, myTriangulation, aTrsf);
+ myArray = aTool.CreateTriangulation (aTrsf);
+ myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
}
//=======================================================================
addTriangle (1, aBottomLeft, aV3, aV4, -thePosition.Direction());
// Front
- addTriangle (2, aV3, aV4, aV5, aFront);
- addTriangle (3, aV3, aV5, aTopRight, aFront);
+ addTriangle (2, aV3, aV5, aV4, -aFront);
+ addTriangle (3, aV3, aTopRight, aV5, -aFront);
// Back
- addTriangle (4, aBottomLeft, aV2, aV7, -aFront);
- addTriangle (5, aBottomLeft, aV7, aV6, -aFront);
+ addTriangle (4, aBottomLeft, aV7, aV2, aFront);
+ addTriangle (5, aBottomLeft, aV6, aV7, aFront);
// aTop
addTriangle (6, aV7, aV6, aV5, thePosition.Direction());
addTriangle (7, aTopRight, aV7, aV5, thePosition.Direction());
- //Left
- addTriangle (8, aV6, aV5, aV4, -aRight);
- addTriangle (9, aBottomLeft, aV6, aV4, -aRight);
+ // Left
+ addTriangle (8, aV6, aV4, aV5, aRight);
+ addTriangle (9, aBottomLeft, aV4, aV6, aRight);
// Right
- addTriangle (10, aV3, aTopRight, aV7, aRight);
- addTriangle (11, aV3, aV7, aV2, aRight);
+ addTriangle (10, aV3, aV7, aTopRight, -aRight);
+ addTriangle (11, aV3, aV2, aV7, -aRight);
}
//=======================================================================
gp_Ax3 aSystem(thePosition.Location(), thePosition.Direction(), theXDirection);
gp_Trsf aTrsf;
aTrsf.SetTransformation(aSystem, gp_Ax3());
- aTool.FillArray(myArray, myTriangulation, aTrsf);
+ myArray = aTool.CreateTriangulation (aTrsf);
+ myTriangulation = aTool.CreatePolyTriangulation (aTrsf);
}
//=======================================================================
myAxisRadius * 1.5,
anArrowLength,
myFacettesNumber);
- myTranslatorGroup = thePrs->NewGroup ();
+ myTranslatorGroup = thePrs->NewGroup();
+ myTranslatorGroup->SetClosed (true);
myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
myCubePos = myReferenceAxis.Direction().XYZ() * (myLength + myIndent);
myCube.Init (gp_Ax1 (myCubePos, myReferenceAxis.Direction()), myBoxSize);
- myScalerGroup = thePrs->NewGroup ();
+ myScalerGroup = thePrs->NewGroup();
+ myScalerGroup->SetClosed (true);
myScalerGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
myScalerGroup->AddPrimitiveArray (myCube.Array());
}
Handle(Graphic3d_Group) anAxisGroup = thePrs->NewGroup();
+ anAxisGroup->SetClosed (true);
anAxisGroup->SetGroupPrimitivesAspect (aDatumAspect->ShadingAspect (aPart)->Aspect());
const Standard_Real anArrowLength = 0.2 * anAxisSize;
// Display center
{
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
+ aGroup->SetClosed (true);
Handle(Prs3d_ShadingAspect) anAspectCen = new Prs3d_ShadingAspect();
anAspectCen->SetColor (Quantity_NOC_WHITE);
aGroup->SetGroupPrimitivesAspect (anAspectCen->Aspect());
return Handle(Graphic3d_ArrayOfTriangles)();
}
- Handle(Graphic3d_ArrayOfTriangles) anArray = new Graphic3d_ArrayOfTriangles (aNbTris * 3, 0, Standard_True);
+ Standard_Integer aMaxVertexs = (aNbTrisTube > 0 ? Prs3d_ToolCylinder::VerticesNb (theNbFacettes, 1) : 0)
+ + (aNbTrisCone > 0 ? Prs3d_ToolDisk ::VerticesNb (theNbFacettes, 1)
+ + Prs3d_ToolCylinder::VerticesNb (theNbFacettes, 1) : 0);
+ Handle(Graphic3d_ArrayOfTriangles) anArray = new Graphic3d_ArrayOfTriangles (aMaxVertexs, aNbTris * 3, Graphic3d_ArrayFlags_VertexNormal);
if (aNbTrisTube != 0)
{
gp_Ax3 aSystem (theAxis.Location(), theAxis.Direction());
//function : Vertex
//purpose :
//=======================================================================
-gp_Pnt Prs3d_ToolCylinder::Vertex (const Standard_Real theU, const Standard_Real theV)
+gp_Pnt Prs3d_ToolCylinder::Vertex (const Standard_Real theU, const Standard_Real theV) const
{
const Standard_Real aU = theU * M_PI * 2.0;
const Standard_Real aRadius = myBottomRadius + (myTopRadius - myBottomRadius) * theV;
}
//=======================================================================
-//function : Add
+//function : Normal
//purpose :
//=======================================================================
-gp_Dir Prs3d_ToolCylinder::Normal (const Standard_Real theU, const Standard_Real /*theV*/)
+gp_Dir Prs3d_ToolCylinder::Normal (const Standard_Real theU, const Standard_Real ) const
{
const Standard_Real aU = theU * M_PI * 2.0;
return gp_Dir (Cos (aU) * myHeight,
}
//=======================================================================
-//function : Perform
+//function : Create
//purpose :
//=======================================================================
Handle(Graphic3d_ArrayOfTriangles) Prs3d_ToolCylinder::Create (const Standard_Real theBottomRad,
protected:
//! Computes vertex at given parameter location of the surface.
- Standard_EXPORT virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) Standard_OVERRIDE;
+ Standard_EXPORT virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) const Standard_OVERRIDE;
//! Computes normal at given parameter location of the surface.
- Standard_EXPORT virtual gp_Dir Normal (const Standard_Real theU, const Standard_Real theV) Standard_OVERRIDE;
+ Standard_EXPORT virtual gp_Dir Normal (const Standard_Real theU, const Standard_Real theV) const Standard_OVERRIDE;
protected:
//function : Vertex
//purpose :
//=======================================================================
-gp_Pnt Prs3d_ToolDisk::Vertex (const Standard_Real theU, const Standard_Real theV)
+gp_Pnt Prs3d_ToolDisk::Vertex (const Standard_Real theU, const Standard_Real theV) const
{
const Standard_Real aU = myStartAngle + theU * (myEndAngle - myStartAngle);
const Standard_Real aRadius = myInnerRadius + (myOuterRadius - myInnerRadius) * theV;
}
//=======================================================================
-//function : Perform
+//function : Create
//purpose :
//=======================================================================
Handle(Graphic3d_ArrayOfTriangles) Prs3d_ToolDisk::Create (const Standard_Real theInnerRadius,
protected:
//! Computes vertex at given parameter location of the surface.
- Standard_EXPORT virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) Standard_OVERRIDE;
+ Standard_EXPORT virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) const Standard_OVERRIDE;
//! Computes normal at given parameter location of the surface.
- virtual gp_Dir Normal (const Standard_Real , const Standard_Real ) Standard_OVERRIDE { return gp_Dir (0.0, 0.0, -1.0); }
+ virtual gp_Dir Normal (const Standard_Real , const Standard_Real ) const Standard_OVERRIDE
+ {
+ return gp_Dir (0.0, 0.0, -1.0);
+ }
protected:
#include <TColgp_Array1OfPnt.hxx>
//=======================================================================
-//function : fillArrays
+//function : FIllArray
//purpose :
//=======================================================================
-void Prs3d_ToolQuadric::fillArrays (const gp_Trsf& theTrsf, TColgp_Array1OfPnt& theArray, NCollection_Array1<gp_Dir>& theNormals)
+void Prs3d_ToolQuadric::FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray,
+ const gp_Trsf& theTrsf) const
{
- Standard_ShortReal aStepU = 1.0f / mySlicesNb;
- Standard_ShortReal aStepV = 1.0f / myStacksNb;
+ if (theArray.IsNull())
+ {
+ theArray = new Graphic3d_ArrayOfTriangles (VerticesNb(), TrianglesNb() * 3, Graphic3d_ArrayFlags_VertexNormal);
+ }
- for (Standard_Integer aU = 0; aU <= mySlicesNb; aU++)
+ const Standard_Real aStepU = 1.0f / mySlicesNb;
+ const Standard_Real aStepV = 1.0f / myStacksNb;
+ if (theArray->EdgeNumberAllocated() > 0)
{
- const Standard_Real aParamU = aU * aStepU;
- for (Standard_Integer aV = 0; aV <= myStacksNb; aV++)
+ // indexed array
+ for (Standard_Integer aU = 0; aU <= mySlicesNb; ++aU)
{
- const Standard_ShortReal aParamV = aV * aStepV;
- const Standard_Integer aVertId = aU * (myStacksNb + 1) + aV + 1;
- gp_Pnt aVertex = Vertex(aParamU, aParamV);
- gp_Dir aNormal = Normal(aParamU, aParamV);
-
- aVertex.Transform (theTrsf);
- aNormal.Transform (theTrsf);
+ const Standard_Real aParamU = aU * aStepU;
+ for (Standard_Integer aV = 0; aV <= myStacksNb; ++aV)
+ {
+ const Standard_Real aParamV = aV * aStepV;
+ const gp_Pnt aVertex = Vertex (aParamU, aParamV).Transformed (theTrsf);
+ const gp_Dir aNormal = Normal (aParamU, aParamV).Transformed (theTrsf);
+ theArray->AddVertex (aVertex, aNormal);
- theArray.SetValue (aVertId, aVertex);
- theNormals.SetValue (aVertId, aNormal);
+ if (aU != 0 && aV != 0)
+ {
+ const int aVertId = theArray->VertexNumber();
+ theArray->AddTriangleEdges (aVertId, aVertId - myStacksNb - 2, aVertId - 1);
+ theArray->AddTriangleEdges (aVertId - myStacksNb - 2, aVertId, aVertId - myStacksNb - 1);
+ }
+ }
+ }
+ }
+ else
+ {
+ // non-indexed array
+ for (Standard_Integer aU = 0; aU < mySlicesNb; ++aU)
+ {
+ const Standard_Real aParamU = aU * aStepU;
+ for (Standard_Integer aV = 0; aV < myStacksNb; ++aV)
+ {
+ const Standard_Real aParamV = aV * aStepV;
+ theArray->AddVertex (Vertex (aParamU, aParamV).Transformed (theTrsf),
+ Normal (aParamU, aParamV).Transformed (theTrsf));
+ theArray->AddVertex (Vertex (aParamU + aStepU, aParamV).Transformed (theTrsf),
+ Normal (aParamU + aStepU, aParamV).Transformed (theTrsf));
+ theArray->AddVertex (Vertex (aParamU + aStepU, aParamV + aStepV).Transformed (theTrsf),
+ Normal (aParamU + aStepU, aParamV + aStepV).Transformed (theTrsf));
+ theArray->AddVertex (Vertex (aParamU + aStepU, aParamV + aStepV).Transformed (theTrsf),
+ Normal (aParamU + aStepU, aParamV + aStepV).Transformed (theTrsf));
+ theArray->AddVertex (Vertex (aParamU, aParamV + aStepV).Transformed (theTrsf),
+ Normal (aParamU, aParamV + aStepV).Transformed (theTrsf));
+ theArray->AddVertex (Vertex (aParamU, aParamV).Transformed (theTrsf),
+ Normal (aParamU, aParamV).Transformed (theTrsf));
+ }
}
}
}
//=======================================================================
-//function : FIllArray
+//function : CreateTriangulation
//purpose :
//=======================================================================
-void Prs3d_ToolQuadric::FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray, const gp_Trsf& theTrsf)
+Handle(Graphic3d_ArrayOfTriangles) Prs3d_ToolQuadric::CreateTriangulation (const gp_Trsf& theTrsf) const
{
- const Standard_Integer aTrianglesNb = TrianglesNb();
- if (theArray.IsNull())
- {
- theArray = new Graphic3d_ArrayOfTriangles (aTrianglesNb * 3, 0, Standard_True);
- }
-
- Poly_Array1OfTriangle aPolyTriangles (1, aTrianglesNb);
- TColgp_Array1OfPnt anArray (1, aTrianglesNb * 3);
- NCollection_Array1<gp_Dir> aNormals (1, aTrianglesNb * 3);
- fillArrays (theTrsf, anArray, aNormals);
-
- // Fill primitives
- for (Standard_Integer aU = 0; aU < mySlicesNb; ++aU)
- {
- for (Standard_Integer aV = 1; aV <= myStacksNb; ++aV)
- {
- theArray->AddVertex (anArray.Value (aU * (myStacksNb + 1) + aV), aNormals.Value (aU * (myStacksNb + 1) + aV));
- theArray->AddVertex (anArray.Value ((aU + 1) * (myStacksNb + 1) + aV), aNormals.Value ((aU + 1) * (myStacksNb + 1) + aV));
- theArray->AddVertex (anArray.Value ((aU + 1) * (myStacksNb + 1) + (aV + 1)), aNormals.Value ((aU + 1) * (myStacksNb + 1) + (aV + 1)));
- theArray->AddVertex (anArray.Value ((aU + 1) * (myStacksNb + 1) + (aV + 1)), aNormals.Value ((aU + 1) * (myStacksNb + 1) + (aV + 1)));
- theArray->AddVertex (anArray.Value (aU * (myStacksNb + 1) + (aV + 1)), aNormals.Value (aU * (myStacksNb + 1) + (aV + 1)));
- theArray->AddVertex (anArray.Value (aU * (myStacksNb + 1) + aV), aNormals.Value (aU * (myStacksNb + 1) + aV));
- }
- }
+ Handle(Graphic3d_ArrayOfTriangles) aTriangulation;
+ FillArray (aTriangulation, theTrsf);
+ return aTriangulation;
}
//=======================================================================
-//function : FillTriangulation
+//function : CreatePolyTriangulation
//purpose :
//=======================================================================
-void Prs3d_ToolQuadric::FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray,
- Handle(Poly_Triangulation)& theTriangulation,
- const gp_Trsf& theTrsf)
+Handle(Poly_Triangulation) Prs3d_ToolQuadric::CreatePolyTriangulation (const gp_Trsf& theTrsf) const
{
- const Standard_Integer aTrianglesNb = TrianglesNb();
- theArray = new Graphic3d_ArrayOfTriangles(aTrianglesNb * 3, 0, Standard_True);
+ Handle(Poly_Triangulation) aTriangulation = new Poly_Triangulation (VerticesNb(), TrianglesNb(), Standard_False);
+ TColgp_Array1OfPnt& aNodes = aTriangulation->ChangeNodes();
+ Poly_Array1OfTriangle& aTriangles = aTriangulation->ChangeTriangles();
- Poly_Array1OfTriangle aPolyTriangles(1, aTrianglesNb);
- TColgp_Array1OfPnt anArray(1, aTrianglesNb * 3);
- NCollection_Array1<gp_Dir> aNormals(1, aTrianglesNb * 3);
- fillArrays(theTrsf, anArray, aNormals);
+ Standard_ShortReal aStepU = 1.0f / mySlicesNb;
+ Standard_ShortReal aStepV = 1.0f / myStacksNb;
// Fill triangles
- for (Standard_Integer aU = 0, anIndex = 0; aU < mySlicesNb; ++aU)
+ for (Standard_Integer aU = 0, anIndex = 0; aU <= mySlicesNb; ++aU)
{
- for (Standard_Integer aV = 1; aV <= myStacksNb; ++aV)
+ const Standard_Real aParamU = aU * aStepU;
+ for (Standard_Integer aV = 0; aV <= myStacksNb; ++aV)
{
- theArray->AddVertex(anArray.Value(aU * (myStacksNb + 1) + aV), aNormals.Value(aU * (myStacksNb + 1) + aV));
- theArray->AddVertex(anArray.Value((aU + 1) * (myStacksNb + 1) + aV), aNormals.Value((aU + 1) * (myStacksNb + 1) + aV));
- theArray->AddVertex(anArray.Value((aU + 1) * (myStacksNb + 1) + (aV + 1)), aNormals.Value((aU + 1) * (myStacksNb + 1) + (aV + 1)));
- theArray->AddVertex(anArray.Value((aU + 1) * (myStacksNb + 1) + (aV + 1)), aNormals.Value((aU + 1) * (myStacksNb + 1) + (aV + 1)));
- theArray->AddVertex(anArray.Value(aU * (myStacksNb + 1) + (aV + 1)), aNormals.Value(aU * (myStacksNb + 1) + (aV + 1)));
- theArray->AddVertex(anArray.Value(aU * (myStacksNb + 1) + aV), aNormals.Value(aU * (myStacksNb + 1) + aV));
+ const Standard_ShortReal aParamV = aV * aStepV;
+ const Standard_Integer aVertId = aU * (myStacksNb + 1) + (aV + 1);
+ gp_Pnt aVertex = Vertex (aParamU, aParamV).Transformed (theTrsf);
- aPolyTriangles.SetValue (++anIndex, Poly_Triangle(aU * (myStacksNb + 1) + aV,
- (aU + 1) * (myStacksNb + 1) + aV,
- (aU + 1) * (myStacksNb + 1) + (aV + 1)));
- aPolyTriangles.SetValue (++anIndex, Poly_Triangle((aU + 1) * (myStacksNb + 1) + (aV + 1),
- aU * (myStacksNb + 1) + (aV + 1),
- aU * (myStacksNb + 1) + aV));
+ aNodes.SetValue (aVertId, aVertex);
+ if (aU != 0 && aV != 0)
+ {
+ aTriangles.SetValue (++anIndex, Poly_Triangle (aVertId, aVertId - myStacksNb - 2, aVertId - 1));
+ aTriangles.SetValue (++anIndex, Poly_Triangle (aVertId - myStacksNb - 2, aVertId, aVertId - myStacksNb - 1));
+ }
}
}
+ return aTriangulation;
+}
- theTriangulation = new Poly_Triangulation (anArray, aPolyTriangles);
+//=======================================================================
+//function : FillArray
+//purpose :
+//=======================================================================
+void Prs3d_ToolQuadric::FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray,
+ Handle(Poly_Triangulation)& theTriangulation,
+ const gp_Trsf& theTrsf) const
+{
+ theArray = CreateTriangulation (theTrsf);
+ theTriangulation = CreatePolyTriangulation (theTrsf);
}
class Prs3d_ToolQuadric
{
public:
-
DEFINE_STANDARD_ALLOC
- //! Generate primitives for 3D quadric surface and fill the given array. Optional transformation is applied.
- Standard_EXPORT void FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray, const gp_Trsf& theTrsf);
-
- //! Generate primitives for 3D quadric surface presentation and fill the given array and poly triangulation structure. Optional transformation is applied.
- Standard_EXPORT void FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray, Handle(Poly_Triangulation)& theTriangulation, const gp_Trsf& theTrsf);
-
- //! Number of triangles for presentation with the given params.
+ //! Return number of triangles for presentation with the given params.
static Standard_Integer TrianglesNb (const Standard_Integer theSlicesNb,
const Standard_Integer theStacksNb)
{
return theSlicesNb * theStacksNb * 2;
}
-protected:
+ //! Return number of vertices for presentation with the given params.
+ static Standard_Integer VerticesNb (const Standard_Integer theSlicesNb,
+ const Standard_Integer theStacksNb,
+ const Standard_Boolean theIsIndexed = Standard_True)
+ {
+ return theIsIndexed
+ ? (theSlicesNb + 1) * (theStacksNb + 1)
+ : TrianglesNb (theSlicesNb, theStacksNb) * 3;
+ }
+
+public:
+
+ //! Generate primitives for 3D quadric surface presentation.
+ //! @param theTrsf [in] optional transformation to apply
+ //! @return generated triangulation
+ Standard_EXPORT Handle(Graphic3d_ArrayOfTriangles) CreateTriangulation (const gp_Trsf& theTrsf) const;
- //! Method implements an algorithm to generate arrays of vertices and normals for 3D surface.
- Standard_EXPORT void fillArrays (const gp_Trsf& theTrsf, TColgp_Array1OfPnt& theArray, NCollection_Array1<gp_Dir>& theNormals);
+ //! Generate primitives for 3D quadric surface presentation.
+ //! @param theTrsf [in] optional transformation to apply
+ //! @return generated triangulation
+ Standard_EXPORT Handle(Poly_Triangulation) CreatePolyTriangulation (const gp_Trsf& theTrsf) const;
- //! Number of triangles in generated presentation.
+ //! Generate primitives for 3D quadric surface and fill the given array.
+ //! @param theArray [in][out] the array of vertices;
+ //! when NULL, function will create an indexed array;
+ //! when not NULL, triangles will be appended to the end of array
+ //! (will raise an exception if reserved array size is not large enough)
+ //! @param theTrsf [in] optional transformation to apply
+ Standard_EXPORT void FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray,
+ const gp_Trsf& theTrsf) const;
+
+public:
+
+ //! Generate primitives for 3D quadric surface presentation.
+ //! @param theArray [out] generated array of triangles
+ //! @param theTriangulation [out] generated triangulation
+ //! @param theTrsf [in] optional transformation to apply
+ Standard_DEPRECATED("Deprecated method, CreateTriangulation() and CreatePolyTriangulation() should be used instead")
+ Standard_EXPORT void FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray,
+ Handle(Poly_Triangulation)& theTriangulation,
+ const gp_Trsf& theTrsf) const;
+
+protected:
+
+ //! Return number of triangles in generated presentation.
Standard_Integer TrianglesNb() const
{
return mySlicesNb * myStacksNb * 2;
}
+ //! Return number of vertices in generated presentation.
+ Standard_Integer VerticesNb (const Standard_Boolean theIsIndexed = Standard_True) const
+ {
+ return theIsIndexed
+ ? (mySlicesNb + 1) * (myStacksNb + 1)
+ : TrianglesNb() * 3;
+ }
+
//! Redefine this method to generate vertex at given parameters.
- virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) = 0;
+ virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) const = 0;
//! Redefine this method to generate normal at given parameters.
- virtual gp_Dir Normal (const Standard_Real theU, const Standard_Real theV) = 0;
+ virtual gp_Dir Normal (const Standard_Real theU, const Standard_Real theV) const = 0;
protected:
//function : Vertex
//purpose :
//=======================================================================
-gp_Pnt Prs3d_ToolSector::Vertex (const Standard_Real theU, const Standard_Real theV)
+gp_Pnt Prs3d_ToolSector::Vertex (const Standard_Real theU, const Standard_Real theV) const
{
const Standard_Real aU = theU * M_PI / 2.0;
const Standard_Real aRadius = myRadius * theV;
}
//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-gp_Dir Prs3d_ToolSector::Normal (const Standard_Real /*theU*/, const Standard_Real /*theV*/)
-{
- return gp_Dir (0.0, 0.0, -1.0);
-}
-
-//=======================================================================
-//function : Perform
+//function : Create
//purpose :
//=======================================================================
Handle(Graphic3d_ArrayOfTriangles) Prs3d_ToolSector::Create (const Standard_Real theRadius,
protected:
//! Computes vertex at given parameter location of the surface.
- Standard_EXPORT virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) Standard_OVERRIDE;
+ Standard_EXPORT virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) const Standard_OVERRIDE;
//! Computes normal at given parameter location of the surface.
- Standard_EXPORT virtual gp_Dir Normal (const Standard_Real theU, const Standard_Real theV) Standard_OVERRIDE;
+ virtual gp_Dir Normal (const Standard_Real , const Standard_Real ) const Standard_OVERRIDE
+ {
+ return gp_Dir (0.0, 0.0, -1.0);
+ }
protected:
//function : Vertex
//purpose :
//=======================================================================
-gp_Pnt Prs3d_ToolSphere::Vertex (const Standard_Real theU, const Standard_Real theV)
+gp_Pnt Prs3d_ToolSphere::Vertex (const Standard_Real theU, const Standard_Real theV) const
{
const Standard_Real aU = theU * M_PI * 2.0;
const Standard_Real aV = theV * M_PI;
}
//=======================================================================
-//function : Add
+//function : Normal
//purpose :
//=======================================================================
-gp_Dir Prs3d_ToolSphere::Normal (const Standard_Real theU, const Standard_Real theV)
+gp_Dir Prs3d_ToolSphere::Normal (const Standard_Real theU, const Standard_Real theV) const
{
const Standard_Real aU = theU * M_PI * 2.0;
const Standard_Real aV = theV * M_PI;
}
//=======================================================================
-//function : Perform
+//function : Create
//purpose :
//=======================================================================
Handle(Graphic3d_ArrayOfTriangles) Prs3d_ToolSphere::Create (const Standard_Real theRadius,
protected:
//! Computes vertex at given parameter location of the surface.
- Standard_EXPORT virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) Standard_OVERRIDE;
+ Standard_EXPORT virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) const Standard_OVERRIDE;
//! Computes normal at given parameter location of the surface.
- Standard_EXPORT virtual gp_Dir Normal (const Standard_Real theU, const Standard_Real theV) Standard_OVERRIDE;
+ Standard_EXPORT virtual gp_Dir Normal (const Standard_Real theU, const Standard_Real theV) const Standard_OVERRIDE;
protected:
Standard_Integer aGroupIter = myStructure->Groups().Lower();
{
Handle(Graphic3d_Group) aSphereGroup = addGroup (myStructure, aGroupIter);
+ aSphereGroup->SetClosed (!myIsWireframe);
// Display origin.
if (myIsWireframe)
for (Standard_Integer anIter = 0; anIter < 3; ++anIter)
{
Handle(Graphic3d_Group) anAxisGroup = addGroup (myStructure, aGroupIter);
+ anAxisGroup->SetClosed (!myIsWireframe);
if (myIsWireframe)
{
// create a tube