#include <Geom_Line.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Transformation.hxx>
+#include <Prs3d_Arrow.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_ShadingAspect.hxx>
+#include <Prs3d_ToolDisk.hxx>
+#include <Prs3d_ToolSphere.hxx>
#include <Select3D_SensitiveCircle.hxx>
#include <Select3D_SensitivePoint.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Select3D_SensitiveTriangulation.hxx>
+#include <Select3D_SensitivePrimitiveArray.hxx>
#include <SelectMgr_SequenceOfOwner.hxx>
-#include <StdPrs_ToolDisk.hxx>
-#include <StdPrs_ToolCylinder.hxx>
-#include <StdPrs_ToolSphere.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <V3d_View.hxx>
{
anOwner = new SelectMgr_EntityOwner (this, 5);
}
- Handle(Select3D_SensitiveTriangulation) aTri;
+
if (aMode == AIS_MM_Translation || aMode == AIS_MM_None)
{
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
Handle(Select3D_SensitiveSegment) aLine = new Select3D_SensitiveSegment (anOwner, gp::Origin(), anAxis.TranslatorTipPosition());
aLine->SetSensitivityFactor (15);
theSelection->Add (aLine);
+
// enlarge sensitivity by triangulation
- aTri = new Select3D_SensitiveTriangulation (anOwner, anAxis.TranslatorCylinder().Triangulation(), TopLoc_Location(), Standard_True);
- theSelection->Add (aTri);
- aTri = new Select3D_SensitiveTriangulation (anOwner, anAxis.TranslatorArrow().Triangulation(), TopLoc_Location(), Standard_True);
- theSelection->Add (aTri);
- aTri = new Select3D_SensitiveTriangulation (anOwner, anAxis.TranslatorArrowBottom().Triangulation(), TopLoc_Location(), Standard_True);
+ Handle(Select3D_SensitivePrimitiveArray) aTri = new Select3D_SensitivePrimitiveArray (anOwner);
+ aTri->InitTriangulation (anAxis.TriangleArray()->Attributes(), anAxis.TriangleArray()->Indices(), TopLoc_Location());
theSelection->Add (aTri);
}
}
aCircle->SetSensitivityFactor (15);
theSelection->Add (aCircle);
// enlarge sensitivity by triangulation
- aTri = new Select3D_SensitiveTriangulation (anOwner, myAxes[anIt].RotatorDisk().Triangulation(), TopLoc_Location(), Standard_True);
+ Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation (anOwner, myAxes[anIt].RotatorDisk().Triangulation(), TopLoc_Location(), Standard_True);
theSelection->Add (aTri);
}
}
aPnt->SetSensitivityFactor (15);
theSelection->Add (aPnt);
// enlarge sensitivity by triangulation
- aTri = new Select3D_SensitiveTriangulation (anOwner, myAxes[anIt].ScalerCube().Triangulation(), TopLoc_Location(), Standard_True);
+ Handle(Select3D_SensitiveTriangulation) aTri = new Select3D_SensitiveTriangulation (anOwner, myAxes[anIt].ScalerCube().Triangulation(), TopLoc_Location(), Standard_True);
theSelection->Add (aTri);
}
}
}
-//=======================================================================
-//class : Cylinder
-//function : Init
-//purpose :
-//=======================================================================
-void AIS_Manipulator::Cylinder::Init (const Standard_ShortReal theBotRad, const Standard_ShortReal theTopRad,
- const Standard_ShortReal theHeight,
- const Standard_Integer theSlicesNb, const Standard_Integer theStacksNb,
- const gp_Ax1& thePosition)
-{
- myPosition = thePosition;
- myBottomRad = theBotRad;
- myTopRad = theTopRad;
- myHeight = theHeight;
-
- StdPrs_ToolCylinder aTool (myBottomRad, myTopRad, myHeight, theSlicesNb, theStacksNb);
- gp_Ax3 aSystem (myPosition.Location(), myPosition.Direction());
- gp_Trsf aTrsf;
- aTrsf.SetTransformation (aSystem, gp_Ax3());
-
- aTool.FillArray (myArray, myTriangulation, aTrsf);
-}
-
//=======================================================================
//class : Disk
//function : Init
myInnerRad = theInnerRadius;
myOuterRad = theOuterRadius;
- StdPrs_ToolDisk aTool (theInnerRadius, theOuterRadius, theSlicesNb, theStacksNb);
+ Prs3d_ToolDisk aTool (theInnerRadius, theOuterRadius, theSlicesNb, theStacksNb);
gp_Ax3 aSystem (myPosition.Location(), myPosition.Direction());
gp_Trsf aTrsf;
aTrsf.SetTransformation (aSystem, gp_Ax3());
myPosition = thePosition;
myRadius = theRadius;
- StdPrs_ToolSphere aTool (theRadius, theSlicesNb, theStacksNb);
+ Prs3d_ToolSphere aTool (theRadius, theSlicesNb, theStacksNb);
gp_Trsf aTrsf;
aTrsf.SetTranslation (gp_Vec(gp::Origin(), thePosition));
aTool.FillArray (myArray, myTriangulation, aTrsf);
//=======================================================================
//class : Axis
//function : Compute
-//purpose :
+//purpose :
//=======================================================================
-void AIS_Manipulator::Axis::Compute (const Handle_PrsMgr_PresentationManager3d& thePrsMgr,
+
+void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Handle(Prs3d_ShadingAspect)& theAspect)
{
- Handle(Graphic3d_Group) aGroup;
-
if (myHasTranslation)
{
- const Standard_ShortReal anArrowLength = 0.25f * myLength;
- const Standard_ShortReal aCylinderLength = myLength - anArrowLength;
-
- myCylinder.Init (myAxisRadius, myAxisRadius, aCylinderLength, myFacettesNumber, 2, gp_Ax1 (gp::Origin(), myReferenceAxis.Direction()));
-
- gp_Pnt anArrowBottom (0.0, 0.0, 0.0);
- anArrowBottom.Translate (myReferenceAxis.Direction().XYZ() * aCylinderLength);
-
- myArrow.Init (myAxisRadius * 1.5f, 0.0f, anArrowLength, myFacettesNumber, 2, gp_Ax1 (anArrowBottom, myReferenceAxis.Direction()));
- myArrowBottom.Init (myAxisRadius, myAxisRadius * 1.5f, gp_Ax1 (anArrowBottom, myReferenceAxis.Direction()), myFacettesNumber);
- myArrowTipPos = anArrowBottom;
-
+ const Standard_Real anArrowLength = 0.25 * myLength;
+ const Standard_Real aCylinderLength = myLength - anArrowLength;
+ myArrowTipPos = gp_Pnt (0.0, 0.0, 0.0).Translated (myReferenceAxis.Direction().XYZ() * aCylinderLength);
+
+ myTriangleArray = Prs3d_Arrow::DrawShaded (gp_Ax1(gp::Origin(), myReferenceAxis.Direction()),
+ myAxisRadius,
+ myLength,
+ myAxisRadius * 1.5,
+ anArrowLength,
+ myFacettesNumber);
myTranslatorGroup = Prs3d_Root::NewGroup (thePrs);
myTranslatorGroup->SetGroupPrimitivesAspect (theAspect->Aspect());
- myTranslatorGroup->AddPrimitiveArray (myCylinder.Array());
- myTranslatorGroup->AddPrimitiveArray (myArrow.Array());
- myTranslatorGroup->AddPrimitiveArray (myArrowBottom.Array());
+ myTranslatorGroup->AddPrimitiveArray (myTriangleArray);
if (myHighlightTranslator.IsNull())
{
myHighlightTranslator = new Prs3d_Presentation (thePrsMgr->StructureManager());
}
-
- myHighlightTranslator->Clear();
- aGroup = Prs3d_Root::CurrentGroup (myHighlightTranslator);
- aGroup->AddPrimitiveArray (myCylinder.Array());
- aGroup->AddPrimitiveArray (myArrow.Array());
- aGroup->AddPrimitiveArray (myArrowBottom.Array());
+ else
+ {
+ myHighlightTranslator->Clear();
+ }
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightTranslator);
+ aGroup->AddPrimitiveArray (myTriangleArray);
}
if (myHasScaling)
{
myHighlightScaler = new Prs3d_Presentation (thePrsMgr->StructureManager());
}
-
- myHighlightScaler->Clear();
- aGroup = Prs3d_Root::CurrentGroup (myHighlightScaler);
+ else
+ {
+ myHighlightScaler->Clear();
+ }
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightScaler);
aGroup->AddPrimitiveArray (myCube.Array());
}
{
myHighlightRotator = new Prs3d_Presentation (thePrsMgr->StructureManager());
}
-
- myHighlightRotator->Clear();
- aGroup = Prs3d_Root::CurrentGroup (myHighlightRotator);
+ else
+ {
+ myHighlightRotator->Clear();
+ }
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (myHighlightRotator);
Prs3d_Root::CurrentGroup (myHighlightRotator)->AddPrimitiveArray (myCircle.Array());
}
}
Handle(Graphic3d_ArrayOfTriangles) myArray;
};
- class Cylinder : public Quadric
- {
- public:
-
- Cylinder()
- : Quadric(),
- myBottomRad(1.0f),
- myTopRad(1.0f),
- myHeight(1.0f)
- { }
-
- virtual ~Cylinder() {}
-
- void Init (const Standard_ShortReal theBotRad, const Standard_ShortReal theTopRad,
- const Standard_ShortReal theHeight,
- const Standard_Integer theSlicesNb, const Standard_Integer theStacksNb,
- const gp_Ax1& thePosition);
-
- protected:
-
- gp_Ax1 myPosition;
- Standard_ShortReal myBottomRad;
- Standard_ShortReal myTopRad;
- Standard_ShortReal myHeight;
- };
-
class Disk : public Quadric
{
public:
const Quantity_Color& theColor = Quantity_Color(),
const Standard_ShortReal theLength = 10.0f);
- void Compute (const Handle_PrsMgr_PresentationManager3d& thePrsMgr,
+ void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Handle(Prs3d_ShadingAspect)& theAspect);
const Handle(Graphic3d_Group)& ScalerGroup() const { return myScalerGroup; }
+ const Handle(Graphic3d_ArrayOfTriangles)& TriangleArray() const { return myTriangleArray; }
+
void SetIndent (const Standard_ShortReal theValue) { myIndent = theValue; }
Standard_ShortReal Size() const { return myLength + myBoxSize + myDiskThickness + myIndent * 2.0f; }
public:
- const Cylinder& TranslatorCylinder() const { return myCylinder; }
- const Cylinder& TranslatorArrow() const { return myArrow; }
const gp_Pnt& TranslatorTipPosition() const { return myArrowTipPos; }
- const Disk& TranslatorArrowBottom() const { return myArrowBottom; }
const Disk& RotatorDisk() const { return myCircle; }
float RotatorDiskRadius() const { return myCircleRadius; }
const Cube& ScalerCube() const { return myCube; }
Standard_Integer myFacettesNumber;
- Cylinder myCylinder;
- Cylinder myArrow;
gp_Pnt myArrowTipPos;
- Disk myArrowBottom;
Disk myCircle;
float myCircleRadius;
Cube myCube;
Handle(Prs3d_Presentation) myHighlightTranslator;
Handle(Prs3d_Presentation) myHighlightScaler;
Handle(Prs3d_Presentation) myHighlightRotator;
+
+ Handle(Graphic3d_ArrayOfTriangles) myTriangleArray;
+
};
protected:
Prs3d_Text.hxx
Prs3d_TextAspect.cxx
Prs3d_TextAspect.hxx
+Prs3d_ToolDisk.hxx
+Prs3d_ToolDisk.cxx
+Prs3d_ToolCylinder.hxx
+Prs3d_ToolCylinder.cxx
+Prs3d_ToolQuadric.hxx
+Prs3d_ToolQuadric.cxx
+Prs3d_ToolSphere.hxx
+Prs3d_ToolSphere.cxx
Prs3d_TypeOfHLR.hxx
Prs3d_TypeOfLinePicking.hxx
Prs3d_VertexDrawMode.hxx
#include <Prs3d_Arrow.hxx>
+#include <gp_Ax3.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
+#include <gp_Trsf.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_Presentation.hxx>
+#include <Prs3d_ToolCylinder.hxx>
+#include <Prs3d_ToolDisk.hxx>
+#include <Prs3d_ToolSphere.hxx>
//=======================================================================
//function : Draw
theGroup->AddPrimitiveArray (aPrims1);
theGroup->AddPrimitiveArray (aPrims2);
}
+
+// ============================================================================
+// function : DrawShaded
+// purpose :
+// ============================================================================
+Handle(Graphic3d_ArrayOfTriangles) Prs3d_Arrow::DrawShaded (const gp_Ax1& theAxis,
+ const Standard_Real theTubeRadius,
+ const Standard_Real theAxisLength,
+ const Standard_Real theConeRadius,
+ const Standard_Real theConeLength,
+ const Standard_Integer theNbFacettes)
+{
+ const Standard_Real aTubeLength = Max (0.0, theAxisLength - theConeLength);
+ const Standard_Integer aNbTrisTube = (theTubeRadius > 0.0 && aTubeLength > 0.0)
+ ? Prs3d_ToolCylinder::TrianglesNb (theNbFacettes, 1)
+ : 0;
+ const Standard_Integer aNbTrisCone = (theConeRadius > 0.0 && theConeLength > 0.0)
+ ? (Prs3d_ToolDisk ::TrianglesNb (theNbFacettes, 1)
+ + Prs3d_ToolCylinder::TrianglesNb (theNbFacettes, 1))
+ : 0;
+
+ const Standard_Integer aNbTris = aNbTrisTube + aNbTrisCone;
+ if (aNbTris == 0)
+ {
+ return Handle(Graphic3d_ArrayOfTriangles)();
+ }
+
+ Handle(Graphic3d_ArrayOfTriangles) anArray = new Graphic3d_ArrayOfTriangles (aNbTris * 3, 0, Standard_True);
+ if (aNbTrisTube != 0)
+ {
+ gp_Ax3 aSystem (theAxis.Location(), theAxis.Direction());
+ gp_Trsf aTrsf;
+ aTrsf.SetTransformation (aSystem, gp_Ax3());
+
+ Prs3d_ToolCylinder aTool (theTubeRadius, theTubeRadius, aTubeLength, theNbFacettes, 1);
+ aTool.FillArray (anArray, aTrsf);
+ }
+
+ if (aNbTrisCone != 0)
+ {
+ gp_Pnt aConeOrigin = theAxis.Location().Translated (gp_Vec (theAxis.Direction().X() * aTubeLength,
+ theAxis.Direction().Y() * aTubeLength,
+ theAxis.Direction().Z() * aTubeLength));
+ gp_Ax3 aSystem (aConeOrigin, theAxis.Direction());
+ gp_Trsf aTrsf;
+ aTrsf.SetTransformation (aSystem, gp_Ax3());
+ {
+ Prs3d_ToolDisk aTool (0.0, theConeRadius, theNbFacettes, 1);
+ aTool.FillArray (anArray, aTrsf);
+ }
+ {
+ Prs3d_ToolCylinder aTool (theConeRadius, 0.0, theConeLength, theNbFacettes, 1);
+ aTool.FillArray (anArray, aTrsf);
+ }
+ }
+
+ return anArray;
+}
#define _Prs3d_Arrow_HeaderFile
#include <Prs3d_Root.hxx>
+
+#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Quantity_PlaneAngle.hxx>
#include <Quantity_Length.hxx>
+class gp_Ax1;
class gp_Pnt;
class gp_Dir;
{
public:
- DEFINE_STANDARD_ALLOC
+ //! Defines the representation of the arrow as shaded triangulation.
+ //! @param theAxis axis definition (arrow origin and direction)
+ //! @param theTubeRadius tube (cylinder) radius
+ //! @param theAxisLength overall arrow length (cylinder + cone)
+ //! @param theConeRadius cone radius (arrow tip)
+ //! @param theConeLength cone length (arrow tip)
+ //! @param theNbFacettes tessellation quality for each part
+ Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) DrawShaded (const gp_Ax1& theAxis,
+ const Standard_Real theTubeRadius,
+ const Standard_Real theAxisLength,
+ const Standard_Real theConeRadius,
+ const Standard_Real theConeLength,
+ const Standard_Integer theNbFacettes);
//! Defines the representation of the arrow.
//! Note that this method does NOT assign any presentation aspects to the primitives group!
--- /dev/null
+// Created on: 1995-07-27
+// Created by: Modelistation
+// Copyright (c) 1995-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Prs3d_ToolCylinder.hxx>
+
+#include <Graphic3d_ArrayOfTriangles.hxx>
+#include <Poly_Array1OfTriangle.hxx>
+#include <Prs3d_ToolQuadric.hxx>
+
+//=======================================================================
+//function : Constructor
+//purpose :
+//=======================================================================
+Prs3d_ToolCylinder::Prs3d_ToolCylinder (const Standard_Real theBottomRad,
+ const Standard_Real theTopRad,
+ const Standard_Real theHeight,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks)
+: myBottomRadius (theBottomRad),
+ myTopRadius (theTopRad),
+ myHeight (theHeight)
+{
+ myStacksNb = theNbStacks;
+ mySlicesNb = theNbSlices;
+}
+
+//=======================================================================
+//function : Vertex
+//purpose :
+//=======================================================================
+gp_Pnt Prs3d_ToolCylinder::Vertex (const Standard_Real theU, const Standard_Real theV)
+{
+ const Standard_Real aU = theU * M_PI * 2.0;
+ const Standard_Real aRadius = myBottomRadius + (myTopRadius - myBottomRadius) * theV;
+ return gp_Pnt (Cos (aU) * aRadius,
+ Sin (aU) * aRadius,
+ theV * myHeight);
+}
+
+//=======================================================================
+//function : Add
+//purpose :
+//=======================================================================
+gp_Dir Prs3d_ToolCylinder::Normal (const Standard_Real theU, const Standard_Real /*theV*/)
+{
+ const Standard_Real aU = theU * M_PI * 2.0;
+ return gp_Dir (Cos (aU) * myHeight,
+ Sin (aU) * myHeight,
+ myBottomRadius - myTopRadius);
+}
+
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+Handle(Graphic3d_ArrayOfTriangles) Prs3d_ToolCylinder::Create (const Standard_Real theBottomRad,
+ const Standard_Real theTopRad,
+ const Standard_Real theHeight,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks,
+ const gp_Trsf& theTrsf)
+{
+ Handle(Graphic3d_ArrayOfTriangles) anArray;
+ Prs3d_ToolCylinder aTool (theBottomRad, theTopRad, theHeight, theNbSlices, theNbStacks);
+ aTool.FillArray (anArray, theTrsf);
+ return anArray;
+}
--- /dev/null
+// Created on: 2016-02-04
+// Created by: Anastasia BORISOVA
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Prs3d_ToolCylinder_HeaderFile
+#define _Prs3d_ToolCylinder_HeaderFile
+
+#include <Standard.hxx>
+#include <Prs3d_ToolQuadric.hxx>
+
+//! Standard presentation algorithm that outputs graphical primitives for cylindrical surface.
+class Prs3d_ToolCylinder : public Prs3d_ToolQuadric
+{
+public:
+
+ //! Generate primitives for 3D quadric surface and return a filled array.
+ Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theBottomRad,
+ const Standard_Real theTopRad,
+ const Standard_Real theHeight,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks,
+ const gp_Trsf& theTrsf);
+public:
+
+ //! Initializes the algorithm.
+ Standard_EXPORT Prs3d_ToolCylinder (const Standard_Real theBottomRad,
+ const Standard_Real theTopRad,
+ const Standard_Real theHeight,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks);
+
+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;
+
+ //! 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;
+
+protected:
+
+ Standard_Real myBottomRadius;
+ Standard_Real myTopRadius;
+ Standard_Real myHeight;
+
+};
+
+#endif // _Prs3d_ToolCylinder_HeaderFile
--- /dev/null
+// Created on: 2016-02-04
+// Created by: Anastasia BORISOVA
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Prs3d_ToolDisk.hxx>
+
+#include <Graphic3d_ArrayOfTriangles.hxx>
+#include <Poly_Array1OfTriangle.hxx>
+#include <Prs3d_ToolQuadric.hxx>
+
+//=======================================================================
+//function : Constructor
+//purpose :
+//=======================================================================
+Prs3d_ToolDisk::Prs3d_ToolDisk (const Standard_Real theInnerRadius,
+ const Standard_Real theOuterRadius,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks)
+: myInnerRadius (theInnerRadius),
+ myOuterRadius (theOuterRadius)
+{
+ mySlicesNb = theNbSlices;
+ myStacksNb = theNbStacks;
+}
+
+//=======================================================================
+//function : Vertex
+//purpose :
+//=======================================================================
+gp_Pnt Prs3d_ToolDisk::Vertex (const Standard_Real theU, const Standard_Real theV)
+{
+ const Standard_Real aU = theU * M_PI * 2.0;
+ const Standard_Real aRadius = myInnerRadius + (myOuterRadius - myInnerRadius) * theV;
+ return gp_Pnt (Cos (aU) * aRadius,
+ Sin (aU) * aRadius,
+ 0.0);
+}
+
+//=======================================================================
+//function : Add
+//purpose :
+//=======================================================================
+gp_Dir Prs3d_ToolDisk::Normal (const Standard_Real /*theU*/, const Standard_Real /*theV*/)
+{
+ return gp_Dir (0.0, 0.0, -1.0);
+}
+
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+Handle(Graphic3d_ArrayOfTriangles) Prs3d_ToolDisk::Create (const Standard_Real theInnerRadius,
+ const Standard_Real theOuterRadius,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks,
+ const gp_Trsf& theTrsf)
+{
+ Handle(Graphic3d_ArrayOfTriangles) anArray;
+ Prs3d_ToolDisk aTool (theInnerRadius, theOuterRadius, theNbSlices, theNbStacks);
+ aTool.FillArray (anArray, theTrsf);
+ return anArray;
+}
--- /dev/null
+// Created on: 2016-02-04
+// Created by: Anastasia BORISOVA
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Prs3d_ToolDisk_HeaderFile
+#define _Prs3d_ToolDisk_HeaderFile
+
+#include <Standard.hxx>
+#include <Prs3d_ToolQuadric.hxx>
+
+//! Standard presentation algorithm that outputs graphical primitives for disk surface.
+class Prs3d_ToolDisk : public Prs3d_ToolQuadric
+{
+public:
+
+ //! Generate primitives for 3D quadric surface and return a filled array.
+ Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theInnerRadius,
+ const Standard_Real theOuterRadius,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks,
+ const gp_Trsf& theTrsf);
+public:
+
+ //! Initializes the algorithm.
+ Standard_EXPORT Prs3d_ToolDisk (const Standard_Real theInnerRadius,
+ const Standard_Real theOuterRadius,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks);
+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;
+
+ //! 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;
+
+protected:
+
+ Standard_Real myInnerRadius;
+ Standard_Real myOuterRadius;
+
+};
+
+#endif
--- /dev/null
+// Created on: 2016-02-04
+// Created by: Anastasia BORISOVA
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Prs3d_ToolQuadric.hxx>
+
+#include <gp_Quaternion.hxx>
+#include <Graphic3d_ArrayOfTriangles.hxx>
+#include <Poly_Array1OfTriangle.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+
+//=======================================================================
+//function : fillArrays
+//purpose :
+//=======================================================================
+void Prs3d_ToolQuadric::fillArrays (const gp_Trsf& theTrsf, TColgp_Array1OfPnt& theArray, NCollection_Array1<gp_Dir>& theNormals)
+{
+ Standard_ShortReal aStepU = 1.0f / mySlicesNb;
+ Standard_ShortReal aStepV = 1.0f / myStacksNb;
+
+ for (Standard_Integer aU = 0; aU <= mySlicesNb; aU++)
+ {
+ const Standard_Real aParamU = aU * aStepU;
+ for (Standard_Integer aV = 0; aV <= myStacksNb; aV++)
+ {
+ 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);
+
+ theArray.SetValue (aVertId, aVertex);
+ theNormals.SetValue (aVertId, aNormal);
+ }
+ }
+}
+
+//=======================================================================
+//function : FIllArray
+//purpose :
+//=======================================================================
+void Prs3d_ToolQuadric::FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray, const gp_Trsf& theTrsf)
+{
+ 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));
+ }
+ }
+}
+
+//=======================================================================
+//function : FillTriangulation
+//purpose :
+//=======================================================================
+void Prs3d_ToolQuadric::FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray,
+ Handle(Poly_Triangulation)& theTriangulation,
+ const gp_Trsf& theTrsf)
+{
+ const Standard_Integer aTrianglesNb = TrianglesNb();
+ 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 triangles
+ for (Standard_Integer aU = 0, anIndex = 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));
+
+ 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));
+ }
+ }
+
+ theTriangulation = new Poly_Triangulation (anArray, aPolyTriangles);
+}
--- /dev/null
+// Created on: 2016-02-04
+// Created by: Anastasia BORISOVA
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Prs3d_ToolQuadric_HeaderFile
+#define _Prs3d_ToolQuadric_HeaderFile
+
+#include <gp_Ax1.hxx>
+#include <Graphic3d_ArrayOfPrimitives.hxx>
+#include <Graphic3d_ArrayOfTriangles.hxx>
+#include <Poly_Triangulation.hxx>
+#include <Prs3d_Root.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <SelectMgr_Selection.hxx>
+#include <Standard.hxx>
+
+//! Base class to build 3D surfaces presentation of quadric surfaces.
+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.
+ static Standard_Integer TrianglesNb (const Standard_Integer theSlicesNb,
+ const Standard_Integer theStacksNb)
+ {
+ return theSlicesNb * theStacksNb * 2;
+ }
+
+protected:
+
+ //! 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);
+
+ //! Number of triangles in generated presentation.
+ Standard_Integer TrianglesNb() const
+ {
+ return mySlicesNb * myStacksNb * 2;
+ }
+
+ //! Redefine this method to generate vertex at given parameters.
+ virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) = 0;
+
+ //! Redefine this method to generate normal at given parameters.
+ virtual gp_Dir Normal (const Standard_Real theU, const Standard_Real theV) = 0;
+
+protected:
+
+ Standard_Integer mySlicesNb;
+ Standard_Integer myStacksNb;
+};
+
+#endif // _Prs3d_ToolQuadric_HeaderFile
--- /dev/null
+// Created on: 2016-02-04
+// Created by: Anastasia BORISOVA
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Prs3d_ToolSphere.hxx>
+
+#include <Graphic3d_ArrayOfTriangles.hxx>
+#include <Poly_Array1OfTriangle.hxx>
+#include <Prs3d_ToolQuadric.hxx>
+
+//=======================================================================
+//function : Constructor
+//purpose :
+//=======================================================================
+Prs3d_ToolSphere::Prs3d_ToolSphere (const Standard_Real theRadius,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks)
+: myRadius (theRadius)
+{
+ mySlicesNb = theNbSlices;
+ myStacksNb = theNbStacks;
+}
+
+//=======================================================================
+//function : Vertex
+//purpose :
+//=======================================================================
+gp_Pnt Prs3d_ToolSphere::Vertex (const Standard_Real theU, const Standard_Real theV)
+{
+ const Standard_Real aU = theU * M_PI * 2.0;
+ const Standard_Real aV = theV * M_PI;
+ return gp_Pnt (myRadius * Cos (aU) * Sin (aV),
+ -myRadius * Sin (aU) * Sin (aV),
+ myRadius * Cos (aV));
+}
+
+//=======================================================================
+//function : Add
+//purpose :
+//=======================================================================
+gp_Dir Prs3d_ToolSphere::Normal (const Standard_Real theU, const Standard_Real theV)
+{
+ const Standard_Real aU = theU * M_PI * 2.0;
+ const Standard_Real aV = theV * M_PI;
+ return gp_Dir (Cos (aU) * Sin (aV),
+ -Sin (aU) * Sin (aV),
+ Cos (aV));
+}
+
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+Handle(Graphic3d_ArrayOfTriangles) Prs3d_ToolSphere::Create (const Standard_Real theRadius,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks,
+ const gp_Trsf& theTrsf)
+{
+ Handle(Graphic3d_ArrayOfTriangles) anArray;
+ Prs3d_ToolSphere aTool (theRadius, theNbSlices, theNbStacks);
+ aTool.FillArray (anArray, theTrsf);
+ return anArray;
+}
--- /dev/null
+// Created on: 2016-02-04
+// Created by: Anastasia BORISOVA
+// Copyright (c) 2016 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Prs3d_ToolSphere_HeaderFile
+#define _Prs3d_ToolSphere_HeaderFile
+
+#include <Graphic3d_ArrayOfPrimitives.hxx>
+#include <Graphic3d_ArrayOfTriangles.hxx>
+#include <Poly_Triangulation.hxx>
+#include <Prs3d_Root.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <SelectMgr_Selection.hxx>
+#include <Standard.hxx>
+#include <Standard_Handle.hxx>
+#include <Prs3d_ToolQuadric.hxx>
+
+//! Standard presentation algorithm that outputs graphical primitives for spherical surface.
+class Prs3d_ToolSphere : public Prs3d_ToolQuadric
+{
+public:
+
+ //! Generate primitives for 3D quadric surface and return a filled array.
+ Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theRadius,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks,
+ const gp_Trsf& theTrsf);
+public:
+
+ //! Initializes the algorithm.
+ Standard_EXPORT Prs3d_ToolSphere (const Standard_Real theRadius,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks);
+
+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;
+
+ //! 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;
+
+protected:
+
+ Standard_Real myRadius;
+
+};
+
+#endif
StdPrs_ShadedShape.hxx
StdPrs_ShadedSurface.cxx
StdPrs_ShadedSurface.hxx
-StdPrs_ToolDisk.hxx
-StdPrs_ToolDisk.cxx
-StdPrs_ToolCylinder.hxx
-StdPrs_ToolCylinder.cxx
StdPrs_ToolPoint.cxx
StdPrs_ToolPoint.hxx
-StdPrs_ToolQuadric.hxx
-StdPrs_ToolQuadric.cxx
-StdPrs_ToolSphere.hxx
-StdPrs_ToolSphere.cxx
StdPrs_ToolRFace.cxx
StdPrs_ToolRFace.hxx
StdPrs_ToolTriangulatedShape.cxx
+++ /dev/null
-// Created on: 1995-07-27
-// Created by: Modelistation
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <StdPrs_ToolCylinder.hxx>
-
-#include <Graphic3d_ArrayOfTriangles.hxx>
-#include <Poly_Array1OfTriangle.hxx>
-#include <StdPrs_ToolQuadric.hxx>
-
-//=======================================================================
-//function : Constructor
-//purpose :
-//=======================================================================
-StdPrs_ToolCylinder::StdPrs_ToolCylinder (const Standard_Real theBottomRad,
- const Standard_Real theTopRad,
- const Standard_Real theHeight,
- const Standard_Integer theNbSlices,
- const Standard_Integer theNbStacks)
-: myBottomRadius (theBottomRad),
- myTopRadius (theTopRad),
- myHeight (theHeight)
-{
- myStacksNb = theNbStacks;
- mySlicesNb = theNbSlices;
-}
-
-//=======================================================================
-//function : Vertex
-//purpose :
-//=======================================================================
-gp_Pnt StdPrs_ToolCylinder::Vertex (const Standard_Real theU, const Standard_Real theV)
-{
- const Standard_Real aU = theU * M_PI * 2.0;
- const Standard_Real aRadius = myBottomRadius + (myTopRadius - myBottomRadius) * theV;
- return gp_Pnt (Cos (aU) * aRadius,
- Sin (aU) * aRadius,
- theV * myHeight);
-}
-
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-gp_Dir StdPrs_ToolCylinder::Normal (const Standard_Real theU, const Standard_Real /*theV*/)
-{
- const Standard_Real aU = theU * M_PI * 2.0;
- return gp_Dir (Cos (aU) * myHeight,
- Sin (aU) * myHeight,
- myBottomRadius - myTopRadius);
-}
-
-//=======================================================================
-//function : Perform
-//purpose :
-//=======================================================================
-Handle(Graphic3d_ArrayOfTriangles) StdPrs_ToolCylinder::Create (const Standard_Real theBottomRad,
- const Standard_Real theTopRad,
- const Standard_Real theHeight,
- const Standard_Integer theNbSlices,
- const Standard_Integer theNbStacks,
- const gp_Trsf& theTrsf)
-{
- Handle(Graphic3d_ArrayOfTriangles) anArray;
- StdPrs_ToolCylinder aTool (theBottomRad, theTopRad, theHeight, theNbSlices, theNbStacks);
- aTool.FillArray (anArray, theTrsf);
- return anArray;
-}
+++ /dev/null
-// Created on: 2016-02-04
-// Created by: Anastasia BORISOVA
-// Copyright (c) 2016 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _StdPrs_ToolCylinder_HeaderFile
-#define _StdPrs_ToolCylinder_HeaderFile
-
-#include <Standard.hxx>
-#include <StdPrs_ToolQuadric.hxx>
-
-//! Standard presentation algorithm that outputs graphical primitives for cylindrical surface.
-class StdPrs_ToolCylinder : public StdPrs_ToolQuadric
-{
-public:
-
- //! Generate primitives for 3D quadric surface and return a filled array.
- Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theBottomRad,
- const Standard_Real theTopRad,
- const Standard_Real theHeight,
- const Standard_Integer theNbSlices,
- const Standard_Integer theNbStacks,
- const gp_Trsf& theTrsf);
-public:
-
- DEFINE_STANDARD_ALLOC
-
- //! Initializes the algorithm.
- Standard_EXPORT StdPrs_ToolCylinder (const Standard_Real theBottomRad,
- const Standard_Real theTopRad,
- const Standard_Real theHeight,
- const Standard_Integer theNbSlices,
- const Standard_Integer theNbStacks);
-
-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;
-
- //! 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;
-
-protected:
-
- Standard_Real myBottomRadius;
- Standard_Real myTopRadius;
- Standard_Real myHeight;
-
-};
-
-#endif // _StdPrs_ToolCylinder_HeaderFile
+++ /dev/null
-// Created on: 2016-02-04
-// Created by: Anastasia BORISOVA
-// Copyright (c) 2016 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <StdPrs_ToolDisk.hxx>
-
-#include <Graphic3d_ArrayOfTriangles.hxx>
-#include <Poly_Array1OfTriangle.hxx>
-#include <StdPrs_ToolQuadric.hxx>
-
-//=======================================================================
-//function : Constructor
-//purpose :
-//=======================================================================
-StdPrs_ToolDisk::StdPrs_ToolDisk (const Standard_Real theInnerRadius,
- const Standard_Real theOuterRadius,
- const Standard_Integer theNbSlices,
- const Standard_Integer theNbStacks)
-: myInnerRadius (theInnerRadius),
- myOuterRadius (theOuterRadius)
-{
- mySlicesNb = theNbSlices;
- myStacksNb = theNbStacks;
-}
-
-//=======================================================================
-//function : Vertex
-//purpose :
-//=======================================================================
-gp_Pnt StdPrs_ToolDisk::Vertex (const Standard_Real theU, const Standard_Real theV)
-{
- const Standard_Real aU = theU * M_PI * 2.0;
- const Standard_Real aRadius = myInnerRadius + (myOuterRadius - myInnerRadius) * theV;
- return gp_Pnt (Cos (aU) * aRadius,
- Sin (aU) * aRadius,
- 0.0);
-}
-
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-gp_Dir StdPrs_ToolDisk::Normal (const Standard_Real /*theU*/, const Standard_Real /*theV*/)
-{
- return gp_Dir (0.0, 0.0, -1.0);
-}
-
-//=======================================================================
-//function : Perform
-//purpose :
-//=======================================================================
-Handle(Graphic3d_ArrayOfTriangles) StdPrs_ToolDisk::Create (const Standard_Real theInnerRadius,
- const Standard_Real theOuterRadius,
- const Standard_Integer theNbSlices,
- const Standard_Integer theNbStacks,
- const gp_Trsf& theTrsf)
-{
- Handle(Graphic3d_ArrayOfTriangles) anArray;
- StdPrs_ToolDisk aTool (theInnerRadius, theOuterRadius, theNbSlices, theNbStacks);
- aTool.FillArray (anArray, theTrsf);
- return anArray;
-}
+++ /dev/null
-// Created on: 2016-02-04
-// Created by: Anastasia BORISOVA
-// Copyright (c) 2016 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _StdPrs_ToolDisk_HeaderFile
-#define _StdPrs_ToolDisk_HeaderFile
-
-#include <Standard.hxx>
-#include <StdPrs_ToolQuadric.hxx>
-
-//! Standard presentation algorithm that outputs graphical primitives for disk surface.
-class StdPrs_ToolDisk : public StdPrs_ToolQuadric
-{
-public:
-
- //! Generate primitives for 3D quadric surface and return a filled array.
- Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theInnerRadius,
- const Standard_Real theOuterRadius,
- const Standard_Integer theNbSlices,
- const Standard_Integer theNbStacks,
- const gp_Trsf& theTrsf);
-public:
-
- DEFINE_STANDARD_ALLOC
-
- //! Initializes the algorithm.
- Standard_EXPORT StdPrs_ToolDisk (const Standard_Real theInnerRadius,
- const Standard_Real theOuterRadius,
- const Standard_Integer theNbSlices,
- const Standard_Integer theNbStacks);
-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;
-
- //! 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;
-
-protected:
-
- Standard_Real myInnerRadius;
- Standard_Real myOuterRadius;
-
-};
-
-#endif
+++ /dev/null
-// Created on: 2016-02-04
-// Created by: Anastasia BORISOVA
-// Copyright (c) 2016 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <StdPrs_ToolQuadric.hxx>
-
-#include <gp_Quaternion.hxx>
-#include <Graphic3d_ArrayOfTriangles.hxx>
-#include <Poly_Array1OfTriangle.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-
-//=======================================================================
-//function : fillArrays
-//purpose :
-//=======================================================================
-void StdPrs_ToolQuadric::fillArrays (const gp_Trsf& theTrsf, TColgp_Array1OfPnt& theArray, NCollection_Array1<gp_Dir>& theNormals)
-{
- Standard_ShortReal aStepU = 1.0f / mySlicesNb;
- Standard_ShortReal aStepV = 1.0f / myStacksNb;
-
- for (Standard_Integer aU = 0; aU <= mySlicesNb; aU++)
- {
- const Standard_Real aParamU = aU * aStepU;
- for (Standard_Integer aV = 0; aV <= myStacksNb; aV++)
- {
- 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);
-
- theArray.SetValue (aVertId, aVertex);
- theNormals.SetValue (aVertId, aNormal);
- }
- }
-}
-
-//=======================================================================
-//function : FIllArray
-//purpose :
-//=======================================================================
-void StdPrs_ToolQuadric::FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray, const gp_Trsf& theTrsf)
-{
- const Standard_Integer aTrianglesNb = TrianglesNb();
- 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));
- }
- }
-}
-
-//=======================================================================
-//function : FillTriangulation
-//purpose :
-//=======================================================================
-void StdPrs_ToolQuadric::FillArray (Handle(Graphic3d_ArrayOfTriangles)& theArray,
- Handle(Poly_Triangulation)& theTriangulation,
- const gp_Trsf& theTrsf)
-{
- const Standard_Integer aTrianglesNb = TrianglesNb();
- 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 triangles
- for (Standard_Integer aU = 0, anIndex = 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));
-
- 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));
- }
- }
-
- theTriangulation = new Poly_Triangulation (anArray, aPolyTriangles);
-}
+++ /dev/null
-// Created on: 2016-02-04
-// Created by: Anastasia BORISOVA
-// Copyright (c) 2016 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _StdPrs_ToolQuadric_HeaderFile
-#define _StdPrs_ToolQuadric_HeaderFile
-
-#include <gp_Ax1.hxx>
-#include <Graphic3d_ArrayOfPrimitives.hxx>
-#include <Graphic3d_ArrayOfTriangles.hxx>
-#include <Poly_Triangulation.hxx>
-#include <Prs3d_Root.hxx>
-#include <Prs3d_Drawer.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <Standard.hxx>
-
-//! Base class to build 3D surfaces presentation of quadric surfaces.
-class StdPrs_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);
-
-protected:
-
- //! 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);
-
- //! Number of triangles in generated presentation.
- Standard_Integer TrianglesNb() const
- {
- return mySlicesNb * myStacksNb * 2;
- }
-
- //! Redefine this method to generate vertex at given parameters.
- virtual gp_Pnt Vertex (const Standard_Real theU, const Standard_Real theV) = 0;
-
- //! Redefine this method to generate normal at given parameters.
- virtual gp_Dir Normal (const Standard_Real theU, const Standard_Real theV) = 0;
-
-protected:
-
- Standard_Integer mySlicesNb;
- Standard_Integer myStacksNb;
-};
-
-#endif // _StdPrs_ShadedSurface_HeaderFile
+++ /dev/null
-// Created on: 2016-02-04
-// Created by: Anastasia BORISOVA
-// Copyright (c) 2016 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <StdPrs_ToolSphere.hxx>
-
-#include <Graphic3d_ArrayOfTriangles.hxx>
-#include <Poly_Array1OfTriangle.hxx>
-#include <StdPrs_ToolQuadric.hxx>
-
-//=======================================================================
-//function : Constructor
-//purpose :
-//=======================================================================
-StdPrs_ToolSphere::StdPrs_ToolSphere (const Standard_Real theRadius,
- const Standard_Integer theNbSlices,
- const Standard_Integer theNbStacks)
-: myRadius (theRadius)
-{
- mySlicesNb = theNbSlices;
- myStacksNb = theNbStacks;
-}
-
-//=======================================================================
-//function : Vertex
-//purpose :
-//=======================================================================
-gp_Pnt StdPrs_ToolSphere::Vertex (const Standard_Real theU, const Standard_Real theV)
-{
- const Standard_Real aU = theU * M_PI * 2.0;
- const Standard_Real aV = theV * M_PI;
- return gp_Pnt (myRadius * Cos (aU) * Sin (aV),
- -myRadius * Sin (aU) * Sin (aV),
- myRadius * Cos (aV));
-}
-
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-gp_Dir StdPrs_ToolSphere::Normal (const Standard_Real theU, const Standard_Real theV)
-{
- const Standard_Real aU = theU * M_PI * 2.0;
- const Standard_Real aV = theV * M_PI;
- return gp_Dir (Cos (aU) * Sin (aV),
- -Sin (aU) * Sin (aV),
- Cos (aV));
-}
-
-//=======================================================================
-//function : Perform
-//purpose :
-//=======================================================================
-Handle(Graphic3d_ArrayOfTriangles) StdPrs_ToolSphere::Create (const Standard_Real theRadius,
- const Standard_Integer theNbSlices,
- const Standard_Integer theNbStacks,
- const gp_Trsf& theTrsf)
-{
- Handle(Graphic3d_ArrayOfTriangles) anArray;
- StdPrs_ToolSphere aTool (theRadius, theNbSlices, theNbStacks);
- aTool.FillArray (anArray, theTrsf);
- return anArray;
-}
+++ /dev/null
-// Created on: 2016-02-04
-// Created by: Anastasia BORISOVA
-// Copyright (c) 2016 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _StdPrs_ToolSphere_HeaderFile
-#define _StdPrs_ToolSphere_HeaderFile
-
-#include <Graphic3d_ArrayOfPrimitives.hxx>
-#include <Graphic3d_ArrayOfTriangles.hxx>
-#include <Poly_Triangulation.hxx>
-#include <Prs3d_Root.hxx>
-#include <Prs3d_Drawer.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <Standard.hxx>
-#include <Standard_Handle.hxx>
-#include <StdPrs_ToolQuadric.hxx>
-
-//! Standard presentation algorithm that outputs graphical primitives for spherical surface.
-class StdPrs_ToolSphere : public StdPrs_ToolQuadric
-{
-public:
-
- //! Generate primitives for 3D quadric surface and return a filled array.
- Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theRadius,
- const Standard_Integer theNbSlices,
- const Standard_Integer theNbStacks,
- const gp_Trsf& theTrsf);
-public:
-
- DEFINE_STANDARD_ALLOC
-
- //! Initializes the algorithm.
- Standard_EXPORT StdPrs_ToolSphere (const Standard_Real theRadius,
- const Standard_Integer theNbSlices,
- const Standard_Integer theNbStacks);
-
-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;
-
- //! 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;
-
-protected:
-
- Standard_Real myRadius;
-
-};
-
-#endif
#include <Graphic3d_Camera.hxx>
#include <Graphic3d_TransformPers.hxx>
#include <Prs3d.hxx>
+#include <Prs3d_Arrow.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_Text.hxx>
#include <Prs3d_TextAspect.hxx>
-#include <StdPrs_ToolCylinder.hxx>
-#include <StdPrs_ToolDisk.hxx>
-#include <StdPrs_ToolSphere.hxx>
+#include <Prs3d_ToolSphere.hxx>
#include <V3d_View.hxx>
IMPLEMENT_STANDARD_RTTIEXT (V3d_Trihedron, Standard_Transient)
myStructure->GraphicClear (Standard_False);
// Create trihedron.
- const Standard_Real aScale = myScale * myRatio * THE_INTERNAL_SCALE_FACTOR;
- const Standard_Real aCylinderLength = aScale * THE_CYLINDER_LENGTH;
- const Standard_Real aCylinderDiametr = aScale * myDiameter;
- const Standard_Real aConeDiametr = myIsWireframe ? aCylinderDiametr : (aCylinderDiametr * 2.0);
- const Standard_Real aConeLength = aScale * (1.0 - THE_CYLINDER_LENGTH);
- const Standard_Real aSphereRadius = aCylinderDiametr * 2.0;
- const Standard_Real aRayon = aScale / 30.0;
+ const Standard_Real aScale = myScale * myRatio * THE_INTERNAL_SCALE_FACTOR;
+ const Standard_Real aCylinderLength = aScale * THE_CYLINDER_LENGTH;
+ const Standard_Real aCylinderRadius = aScale * myDiameter;
+ const Standard_Real aConeRadius = myIsWireframe ? aCylinderRadius : (aCylinderRadius * 2.0);
+ const Standard_Real aConeLength = aScale * (1.0 - THE_CYLINDER_LENGTH);
+ const Standard_Real aSphereRadius = aCylinderRadius * 2.0;
+ const Standard_Real aRayon = aScale / 30.0;
{
Handle(Graphic3d_Group) aSphereGroup = myStructure->NewGroup();
{
gp_Trsf aSphereTransform;
aSphereGroup->SetGroupPrimitivesAspect (mySphereShadingAspect->Aspect());
- aSphereGroup->AddPrimitiveArray (StdPrs_ToolSphere::Create (aSphereRadius, myNbFacettes, myNbFacettes, aSphereTransform));
+ aSphereGroup->AddPrimitiveArray (Prs3d_ToolSphere::Create (aSphereRadius, myNbFacettes, myNbFacettes, aSphereTransform));
}
}
for (Standard_Integer anIter = 0; anIter < 3; ++anIter)
{
Handle(Graphic3d_Group) anAxisGroup = myStructure->NewGroup();
- anAxisGroup->SetGroupPrimitivesAspect (myArrowShadingAspects[anIter]->Aspect());
-
- gp_Ax1 aPosition (anAxes[anIter]);
-
- // Create a tube.
if (myIsWireframe)
{
+ // create a tube
Handle(Graphic3d_ArrayOfPrimitives) anArray = new Graphic3d_ArrayOfSegments (2);
anArray->AddVertex (0.0f, 0.0f, 0.0f);
anArray->AddVertex (anAxes[anIter].Direction().XYZ() * aCylinderLength);
anAxisGroup->SetGroupPrimitivesAspect (myArrowLineAspects[anIter]->Aspect());
anAxisGroup->AddPrimitiveArray (anArray);
}
- else
- {
- gp_Ax3 aSystem (aPosition.Location(), aPosition.Direction());
- gp_Trsf aTrsf;
- aTrsf.SetTransformation (aSystem, gp_Ax3());
-
- anAxisGroup->AddPrimitiveArray (StdPrs_ToolCylinder::Create (aCylinderDiametr, aCylinderDiametr, aCylinderLength, myNbFacettes, 1, aTrsf));
- }
-
- aPosition.Translate (gp_Vec (aPosition.Direction().X() * aCylinderLength,
- aPosition.Direction().Y() * aCylinderLength,
- aPosition.Direction().Z() * aCylinderLength));
- // Create a disk.
- {
- gp_Ax3 aSystem (aPosition.Location(), aPosition.Direction());
- gp_Trsf aTrsf;
- aTrsf.SetTransformation (aSystem, gp_Ax3());
-
- anAxisGroup->AddPrimitiveArray (StdPrs_ToolDisk::Create (0.0, aConeDiametr, myNbFacettes, 1, aTrsf));
- }
- // Create a cone.
- {
- gp_Ax3 aSystem (aPosition.Location(), aPosition.Direction());
- gp_Trsf aTrsf;
- aTrsf.SetTransformation (aSystem, gp_Ax3());
-
- anAxisGroup->AddPrimitiveArray (StdPrs_ToolCylinder::Create (aConeDiametr, 0.0, aConeLength, myNbFacettes, 1, aTrsf));
- }
+ Handle(Graphic3d_ArrayOfTriangles) aTriangles = Prs3d_Arrow::DrawShaded (anAxes[anIter],
+ myIsWireframe ? 0.0 : aCylinderRadius,
+ aCylinderLength + aConeLength,
+ aConeRadius,
+ aConeLength,
+ myNbFacettes);
+ anAxisGroup->SetGroupPrimitivesAspect (myArrowShadingAspects[anIter]->Aspect());
+ anAxisGroup->AddPrimitiveArray (aTriangles);
}
}