Standard_EXPORT void SetMeridian();
- Standard_Real myRadius;
+ Standard_Real myRadius; //!< cylinder radius
};
Standard_EXPORT void SetMeridian();
- Standard_Real myMajor;
- Standard_Real myMinor;
+ Standard_Real myMajor; //!< distance from the center of the pipe to the center of the torus
+ Standard_Real myMinor; //!< radius of the pipe
};
DEFINE_STANDARD_ALLOC
-
- //! Make a cone of height H radius R1 in the plane z =
- //! 0, R2 in the plane Z = H. R1 and R2 may be null.
+
+ //! Make a cone.
+ //! @param R1 [in] cone bottom radius, may be null (z = 0)
+ //! @param R2 [in] cone top radius, may be null (z = H)
+ //! @param H [in] cone height
Standard_EXPORT BRepPrimAPI_MakeCone(const Standard_Real R1, const Standard_Real R2, const Standard_Real H);
-
- //! Make a cone of height H radius R1 in the plane z =
- //! 0, R2 in the plane Z = H. R1 and R2 may be null.
- //! Take a section of <angle>
+
+ //! Make a cone.
+ //! @param R1 [in] cone bottom radius, may be null (z = 0)
+ //! @param R2 [in] cone top radius, may be null (z = H)
+ //! @param H [in] cone height
+ //! @param angle [in] angle to create a part cone
Standard_EXPORT BRepPrimAPI_MakeCone(const Standard_Real R1, const Standard_Real R2, const Standard_Real H, const Standard_Real angle);
-
- //! Make a cone of height H radius R1 in the plane z =
- //! 0, R2 in the plane Z = H. R1 and R2 may be null.
+
+ //! Make a cone.
+ //! @param axes [in] coordinate system for the construction of the cone
+ //! @param R1 [in] cone bottom radius, may be null (z = 0)
+ //! @param R2 [in] cone top radius, may be null (z = H)
+ //! @param H [in] cone height
Standard_EXPORT BRepPrimAPI_MakeCone(const gp_Ax2& Axes, const Standard_Real R1, const Standard_Real R2, const Standard_Real H);
//! Make a cone of height H radius R1 in the plane z =
DEFINE_STANDARD_ALLOC
-
- //! Make a cylinder of radius R and length H.
+ //! Make a cylinder.
+ //! @param R [in] cylinder radius
+ //! @param H [in] cylinder height
Standard_EXPORT BRepPrimAPI_MakeCylinder(const Standard_Real R, const Standard_Real H);
-
- //! Make a cylinder of radius R and length H with
- //! angle H.
+
+ //! Make a cylinder (part cylinder).
+ //! @param R [in] cylinder radius
+ //! @param H [in] cylinder height
+ //! @param Angle [in] defines the missing portion of the cylinder
Standard_EXPORT BRepPrimAPI_MakeCylinder(const Standard_Real R, const Standard_Real H, const Standard_Real Angle);
-
+
//! Make a cylinder of radius R and length H.
+ //! @param Axes [in] coordinate system for the construction of the cylinder
+ //! @param R [in] cylinder radius
+ //! @param H [in] cylinder height
Standard_EXPORT BRepPrimAPI_MakeCylinder(const gp_Ax2& Axes, const Standard_Real R, const Standard_Real H);
-
+
//! Make a cylinder of radius R and length H with
//! angle H.
//! Constructs
DEFINE_STANDARD_ALLOC
- //! Make a sphere of radius R.
+ //! Make a sphere.
+ //! @param R [in] sphere radius
Standard_EXPORT BRepPrimAPI_MakeSphere(const Standard_Real R);
-
- //! Make a sphere of radius R.
+
+ //! Make a sphere (spherical wedge).
+ //! @param R [in] sphere radius
+ //! @param angle [in] angle between the radii lying within the bounding semidisks
Standard_EXPORT BRepPrimAPI_MakeSphere(const Standard_Real R, const Standard_Real angle);
-
- //! Make a sphere of radius R.
+
+ //! Make a sphere (spherical segment).
+ //! @param R [in] sphere radius
+ //! @param angle1 [in] first angle defining a spherical segment
+ //! @param angle2 [in] second angle defining a spherical segment
Standard_EXPORT BRepPrimAPI_MakeSphere(const Standard_Real R, const Standard_Real angle1, const Standard_Real angle2);
-
- //! Make a sphere of radius R.
+
+ //! Make a sphere (spherical segment).
+ //! @param R [in] sphere radius
+ //! @param angle1 [in] first angle defining a spherical segment
+ //! @param angle2 [in] second angle defining a spherical segment
+ //! @param angle3 [in] angle between the radii lying within the bounding semidisks
Standard_EXPORT BRepPrimAPI_MakeSphere(const Standard_Real R, const Standard_Real angle1, const Standard_Real angle2, const Standard_Real angle3);
-
- //! Make a sphere of radius R.
+
+ //! Make a sphere.
+ //! @param Center [in] sphere center coordinates
+ //! @param R [in] sphere radius
Standard_EXPORT BRepPrimAPI_MakeSphere(const gp_Pnt& Center, const Standard_Real R);
- //! Make a sphere of radius R.
+ //! Make a sphere (spherical wedge).
+ //! @param Center [in] sphere center coordinates
+ //! @param R [in] sphere radius
+ //! @param angle [in] angle between the radii lying within the bounding semidisks
Standard_EXPORT BRepPrimAPI_MakeSphere(const gp_Pnt& Center, const Standard_Real R, const Standard_Real angle);
-
- //! Make a sphere of radius R.
+
+ //! Make a sphere (spherical segment).
+ //! @param Center [in] sphere center coordinates
+ //! @param R [in] sphere radius
+ //! @param angle1 [in] first angle defining a spherical segment
+ //! @param angle2 [in] second angle defining a spherical segment
Standard_EXPORT BRepPrimAPI_MakeSphere(const gp_Pnt& Center, const Standard_Real R, const Standard_Real angle1, const Standard_Real angle2);
-
- //! Make a sphere of radius R.
+
+ //! Make a sphere (spherical segment).
+ //! @param Center [in] sphere center coordinates
+ //! @param R [in] sphere radius
+ //! @param angle1 [in] first angle defining a spherical segment
+ //! @param angle2 [in] second angle defining a spherical segment
+ //! @param angle3 [in] angle between the radii lying within the bounding semidisks
Standard_EXPORT BRepPrimAPI_MakeSphere(const gp_Pnt& Center, const Standard_Real R, const Standard_Real angle1, const Standard_Real angle2, const Standard_Real angle3);
-
- //! Make a sphere of radius R.
+
+ //! Make a sphere.
+ //! @param Axis [in] coordinate system for the construction of the sphere
+ //! @param R [in] sphere radius
Standard_EXPORT BRepPrimAPI_MakeSphere(const gp_Ax2& Axis, const Standard_Real R);
-
- //! Make a sphere of radius R.
+
+ //! Make a sphere (spherical wedge).
+ //! @param Axis [in] coordinate system for the construction of the sphere
+ //! @param R [in] sphere radius
+ //! @param angle [in] angle between the radii lying within the bounding semidisks
Standard_EXPORT BRepPrimAPI_MakeSphere(const gp_Ax2& Axis, const Standard_Real R, const Standard_Real angle);
-
- //! Make a sphere of radius R.
+
+ //! Make a sphere (spherical segment).
+ //! @param Axis [in] coordinate system for the construction of the sphere
+ //! @param R [in] sphere radius
+ //! @param angle1 [in] first angle defining a spherical segment
+ //! @param angle2 [in] second angle defining a spherical segment
Standard_EXPORT BRepPrimAPI_MakeSphere(const gp_Ax2& Axis, const Standard_Real R, const Standard_Real angle1, const Standard_Real angle2);
-
+
//! Make a sphere of radius R.
//! For all algorithms The resulting shape is composed of
//! - a lateral spherical face,
DEFINE_STANDARD_ALLOC
-
- //! Make a torus of radii R1 R2.
+
+ //! Make a torus.
+ //! @param R1 [in] distance from the center of the pipe to the center of the torus
+ //! @param R2 [in] radius of the pipe
Standard_EXPORT BRepPrimAPI_MakeTorus(const Standard_Real R1, const Standard_Real R2);
-
- //! Make a section of a torus of radii R1 R2.
+
+ //! Make a section of a torus.
+ //! @param R1 [in] distance from the center of the pipe to the center of the torus
+ //! @param R2 [in] radius of the pipe
+ //! @param angle [in] angle to create a torus pipe segment
Standard_EXPORT BRepPrimAPI_MakeTorus(const Standard_Real R1, const Standard_Real R2, const Standard_Real angle);
- //! Make a torus of radii R2, R2 with angles on the
- //! small circle.
+ //! Make a torus with angles on the small circle.
+ //! @param R1 [in] distance from the center of the pipe to the center of the torus
+ //! @param R2 [in] radius of the pipe
+ //! @param angle1 [in] first angle to create a torus ring segment
+ //! @param angle2 [in] second angle to create a torus ring segment
Standard_EXPORT BRepPrimAPI_MakeTorus(const Standard_Real R1, const Standard_Real R2, const Standard_Real angle1, const Standard_Real angle2);
- //! Make a torus of radii R2, R2 with angles on the
- //! small circle.
+ //! Make a torus with angles on the small circle.
+ //! @param R1 [in] distance from the center of the pipe to the center of the torus
+ //! @param R2 [in] radius of the pipe
+ //! @param angle1 [in] first angle to create a torus ring segment
+ //! @param angle2 [in] second angle to create a torus ring segment
+ //! @param angle [in] angle to create a torus pipe segment
Standard_EXPORT BRepPrimAPI_MakeTorus(const Standard_Real R1, const Standard_Real R2, const Standard_Real angle1, const Standard_Real angle2, const Standard_Real angle);
- //! Make a torus of radii R1 R2.
+ //! Make a torus.
+ //! @param Axes [in] coordinate system for the construction of the sphere
+ //! @param R1 [in] distance from the center of the pipe to the center of the torus
+ //! @param R2 [in] radius of the pipe
Standard_EXPORT BRepPrimAPI_MakeTorus(const gp_Ax2& Axes, const Standard_Real R1, const Standard_Real R2);
- //! Make a section of a torus of radii R1 R2.
+ //! Make a section of a torus.
+ //! @param Axes [in] coordinate system for the construction of the sphere
+ //! @param R1 [in] distance from the center of the pipe to the center of the torus
+ //! @param R2 [in] radius of the pipe
+ //! @param angle [in] angle to create a torus pipe segment
Standard_EXPORT BRepPrimAPI_MakeTorus(const gp_Ax2& Axes, const Standard_Real R1, const Standard_Real R2, const Standard_Real angle);
- //! Make a torus of radii R1 R2.
+ //! Make a torus.
+ //! @param Axes [in] coordinate system for the construction of the sphere
+ //! @param R1 [in] distance from the center of the pipe to the center of the torus
+ //! @param R2 [in] radius of the pipe
+ //! @param angle1 [in] first angle to create a torus ring segment
+ //! @param angle2 [in] second angle to create a torus ring segment
Standard_EXPORT BRepPrimAPI_MakeTorus(const gp_Ax2& Axes, const Standard_Real R1, const Standard_Real R2, const Standard_Real angle1, const Standard_Real angle2);
//! Make a section of a torus of radii R1 R2.
theCommands.Add("wedge","wedge name [Ox Oy Oz Zx Zy Zz Xx Xy Xz] dx dy dz ltx / xmin zmin xmax zmax",__FILE__,wedge,g);
- theCommands.Add("pcylinder","pcylinder name [plane(ax2)] R H [angle]",__FILE__,cylinder,g);
- theCommands.Add("pcone", "pcone name [plane(ax2)] R1 R2 H [angle]",__FILE__,cone,g);
- theCommands.Add("psphere", "psphere name [plane(ax2)] R [angle1 angle2] [angle]",__FILE__,sphere,g);
- theCommands.Add("ptorus", "ptorus name [plane(ax2)] R1 R2 [angle1 angle2] [angle]",__FILE__,torus,g);
+ theCommands.Add("pcylinder",
+ "pcylinder name [plane(ax2)] R H [angle]"
+ "\n\t\t: Construct a cylinder and put result into 'name' variable."
+ "\n\t\t: Parameters of the cylinder :"
+ "\n\t\t: - plane coordinate system for the construction of the cylinder"
+ "\n\t\t: - R cylinder radius"
+ "\n\t\t: - H cylinder height"
+ "\n\t\t: - angle cylinder top radius",
+ __FILE__, cylinder, g);
+
+ theCommands.Add("pcone",
+ "pcone name [plane(ax2)] R1 R2 H [angle]"
+ "\n\t\t: Construct a cone, part cone or conical frustum and put result into 'name' variable."
+ "\n\t\t: Parameters of the cone :"
+ "\n\t\t: - plane coordinate system for the construction of the cone"
+ "\n\t\t: - R1 cone bottom radius"
+ "\n\t\t: - R2 cone top radius"
+ "\n\t\t: - H cone height"
+ "\n\t\t: - angle angle to create a part cone",
+ __FILE__, cone, g);
+
+ theCommands.Add("psphere",
+ "psphere name [plane(ax2)] R [angle1 angle2] [angle]"
+ "\n\t\t: Construct a sphere, spherical segment or spherical wedge and put result into 'name' variable."
+ "\n\t\t: Parameters of the sphere :"
+ "\n\t\t: - plane coordinate system for the construction of the sphere"
+ "\n\t\t: - R sphere radius"
+ "\n\t\t: - angle1 first angle to create a spherical segment [-90; 90]"
+ "\n\t\t: - angle2 second angle to create a spherical segment [-90; 90]"
+ "\n\t\t: - angle angle to create a spherical wedge",
+ __FILE__, sphere, g);
+
+ theCommands.Add("ptorus",
+ "ptorus name [plane(ax2)] R1 R2 [angle1 angle2] [angle]"
+ "\n\t\t: Construct a torus or torus segment and put result into 'name' variable."
+ "\n\t\t: Parameters of the torus :"
+ "\n\t\t: - plane coordinate system for the construction of the torus"
+ "\n\t\t: - R1 distance from the center of the pipe to the center of the torus"
+ "\n\t\t: - R2 radius of the pipe"
+ "\n\t\t: - angle1 first angle to create a torus ring segment"
+ "\n\t\t: - angle2 second angle to create a torus ring segment"
+ "\n\t\t: - angle angle to create a torus pipe segment",
+ __FILE__, torus, g);
}
Prs3d_ToolSector.cxx
Prs3d_ToolSphere.hxx
Prs3d_ToolSphere.cxx
+Prs3d_ToolTorus.hxx
+Prs3d_ToolTorus.cxx
Prs3d_TypeOfHighlight.hxx
Prs3d_TypeOfHLR.hxx
Prs3d_TypeOfLinePicking.hxx
public:
//! Generate primitives for 3D quadric surface and return a filled array.
+ //! @param theBottomRad [in] cylinder bottom radius
+ //! @param theTopRad [in] cylinder top radius
+ //! @param theHeight [in] cylinder height
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ //! @param theTrsf [in] optional transformation to apply
+ //! @return generated triangulation
Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theBottomRad,
const Standard_Real theTopRad,
const Standard_Real theHeight,
const gp_Trsf& theTrsf);
public:
- //! Initializes the algorithm.
+ //! Initializes the algorithm creating a cylinder.
+ //! @param theBottomRad [in] cylinder bottom radius
+ //! @param theTopRad [in] cylinder top radius
+ //! @param theHeight [in] cylinder height
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
Standard_EXPORT Prs3d_ToolCylinder (const Standard_Real theBottomRad,
const Standard_Real theTopRad,
const Standard_Real theHeight,
protected:
- Standard_Real myBottomRadius;
- Standard_Real myTopRadius;
- Standard_Real myHeight;
+ Standard_Real myBottomRadius; //!< cylinder bottom radius
+ Standard_Real myTopRadius; //!< cylinder top radius
+ Standard_Real myHeight; //!< cylinder height
};
{
public:
- //! Generate primitives for 3D quadric surface and return a filled array.
+ //! Generate primitives for 3D quadric surface.
+ //! @param theInnerRadius [in] inner disc radius
+ //! @param theOuterRadius [in] outer disc radius
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ //! @param theTrsf [in] optional transformation to apply
+ //! @return generated triangulation
Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theInnerRadius,
const Standard_Real theOuterRadius,
const Standard_Integer theNbSlices,
const gp_Trsf& theTrsf);
public:
- //! Initializes the algorithm.
+ //! Initializes the algorithm creating a disk.
+ //! @param theInnerRadius [in] inner disk radius
+ //! @param theOuterRadius [in] outer disk radius
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
Standard_EXPORT Prs3d_ToolDisk (const Standard_Real theInnerRadius,
const Standard_Real theOuterRadius,
const Standard_Integer theNbSlices,
protected:
- Standard_Real myInnerRadius;
- Standard_Real myOuterRadius;
+ Standard_Real myInnerRadius; //!< Inner disk radius
+ Standard_Real myOuterRadius; //!< Outer disk radius
Standard_Real myStartAngle; //!< Start angle in counter clockwise order
Standard_Real myEndAngle; //!< End angle in counter clockwise order
protected:
- Standard_Integer mySlicesNb;
- Standard_Integer myStacksNb;
+ Standard_Integer mySlicesNb; //!< number of slices within U parameter
+ Standard_Integer myStacksNb; //!< number of stacks within V parameter
};
#endif // _Prs3d_ToolQuadric_HeaderFile
{
public:
- //! Generate primitives for 3D quadric surface and return a filled array.
+ //! Generate primitives for 3D quadric surface.
+ //! @param theRadius [in] sector radius
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ //! @param theTrsf [in] optional transformation to apply
+ //! @return generated triangulation
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.
+ //! Initializes the algorithm creating a sector (quadrant).
+ //! @param theRadius [in] sector radius
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
Standard_EXPORT Prs3d_ToolSector (const Standard_Real theRadius,
const Standard_Integer theNbSlices,
const Standard_Integer theNbStacks);
protected:
- Standard_Real myRadius;
+ Standard_Real myRadius; //!< sector radius
};
{
public:
- //! Generate primitives for 3D quadric surface and return a filled array.
+ //! Generate primitives for 3D quadric surface.
+ //! @param theRadius [in] sphere radius
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ //! @param theTrsf [in] optional transformation to apply
+ //! @return generated triangulation
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.
+ //! Initializes the algorithm creating a sphere.
+ //! @param theRadius [in] sphere radius
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
Standard_EXPORT Prs3d_ToolSphere (const Standard_Real theRadius,
const Standard_Integer theNbSlices,
const Standard_Integer theNbStacks);
protected:
- Standard_Real myRadius;
+ Standard_Real myRadius; //!< sphere radius
};
--- /dev/null
+// Created on: 2020-09-17
+// Created by: Marina ZERNOVA
+// Copyright (c) 2020 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_ToolTorus.hxx>
+
+//=======================================================================
+//function : init
+//purpose :
+//=======================================================================
+void Prs3d_ToolTorus::init (const Standard_Real theMajorRad,
+ const Standard_Real theMinorRad,
+ const Standard_Real theAngle1,
+ const Standard_Real theAngle2,
+ const Standard_Real theAngle,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks)
+{
+ myMajorRadius = theMajorRad;
+ myMinorRadius = theMinorRad;
+ myVMin = theAngle1;
+ myVMax = theAngle2;
+ myAngle = theAngle;
+ mySlicesNb = theNbSlices;
+ myStacksNb = theNbStacks;
+}
+
+//=======================================================================
+//function : Vertex
+//purpose :
+//=======================================================================
+gp_Pnt Prs3d_ToolTorus::Vertex (const Standard_Real theU, const Standard_Real theV) const
+{
+ const Standard_Real aU = theU * myAngle;
+ const Standard_Real aV = myVMin + theV * (myVMax - myVMin);
+ return gp_Pnt ((myMajorRadius + myMinorRadius * Cos (aV)) * Cos (aU),
+ (myMajorRadius + myMinorRadius * Cos (aV)) * Sin (aU),
+ myMinorRadius * Sin (aV));
+}
+
+//=======================================================================
+//function : Normal
+//purpose :
+//=======================================================================
+gp_Dir Prs3d_ToolTorus::Normal (const Standard_Real theU, const Standard_Real theV) const
+{
+ const Standard_Real aU = theU * myAngle;
+ const Standard_Real aV = myVMin + theV * (myVMax - myVMin);
+ return gp_Dir (Cos (aU) * Cos (aV),
+ Sin (aU) * Cos (aV),
+ Sin (aV));
+}
+
+//=======================================================================
+//function : Create
+//purpose :
+//=======================================================================
+Handle(Graphic3d_ArrayOfTriangles) Prs3d_ToolTorus::Create (const Standard_Real theMajorRad,
+ const Standard_Real theMinorRad,
+ const Standard_Real theAngle1,
+ const Standard_Real theAngle2,
+ const Standard_Real theAngle,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks,
+ const gp_Trsf& theTrsf)
+{
+ Handle(Graphic3d_ArrayOfTriangles) anArray;
+ Prs3d_ToolTorus aTool (theMajorRad, theMinorRad, theAngle1, theAngle2, theAngle, theNbSlices, theNbStacks);
+ aTool.FillArray (anArray, theTrsf);
+ return anArray;
+}
--- /dev/null
+// Created on: 2020-09-17
+// Created by: Marina ZERNOVA
+// Copyright (c) 2020 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_ToolTorus_HeaderFile
+#define _Prs3d_ToolTorus_HeaderFile
+
+#include <Prs3d_ToolQuadric.hxx>
+
+//! Standard presentation algorithm that outputs graphical primitives for torus surface.
+class Prs3d_ToolTorus : public Prs3d_ToolQuadric
+{
+public:
+
+ //! Generate primitives for 3D quadric surface (complete torus).
+ //! @param theMajorRad [in] distance from the center of the pipe to the center of the torus
+ //! @param theMinorRad [in] radius of the pipe
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ //! @param theTrsf [in] optional transformation to apply
+ //! @return generated triangulation
+ static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theMajorRad,
+ const Standard_Real theMinorRad,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks,
+ const gp_Trsf& theTrsf)
+ {
+ return Create (theMajorRad, theMinorRad, 0.0, M_PI * 2.0, M_PI * 2.0, theNbSlices, theNbStacks, theTrsf);
+ }
+
+ //! Generate primitives for 3D quadric surface (torus segment).
+ //! @param theMajorRad [in] distance from the center of the pipe to the center of the torus
+ //! @param theMinorRad [in] radius of the pipe
+ //! @param theAngle [in] angle to create a torus pipe segment
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ //! @param theTrsf [in] optional transformation to apply
+ //! @return generated triangulation
+ static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theMajorRad,
+ const Standard_Real theMinorRad,
+ const Standard_Real theAngle,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks,
+ const gp_Trsf& theTrsf)
+ {
+ return Create (theMajorRad, theMinorRad, 0.0, M_PI * 2.0, theAngle, theNbSlices, theNbStacks, theTrsf);
+ }
+
+ //! Generate primitives for 3D quadric surface (torus ring segment).
+ //! @param theMajorRad [in] distance from the center of the pipe to the center of the torus
+ //! @param theMinorRad [in] radius of the pipe
+ //! @param theAngle1 [in] first angle to create a torus ring segment
+ //! @param theAngle2 [in] second angle to create a torus ring segment
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ //! @param theTrsf [in] optional transformation to apply
+ //! @return generated triangulation
+ static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theMajorRad,
+ const Standard_Real theMinorRad,
+ const Standard_Real theAngle1,
+ const Standard_Real theAngle2,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks,
+ const gp_Trsf& theTrsf)
+ {
+ return Create (theMajorRad, theMinorRad, theAngle1, theAngle2, M_PI * 2.0, theNbSlices, theNbStacks, theTrsf);
+ }
+
+ //! Generate primitives for 3D quadric surface (segment of the torus ring segment).
+ //! @param theMajorRad [in] distance from the center of the pipe to the center of the torus
+ //! @param theMinorRad [in] radius of the pipe
+ //! @param theAngle1 [in] first angle to create a torus ring segment
+ //! @param theAngle2 [in] second angle to create a torus ring segment
+ //! @param theAngle [in] angle to create a torus pipe segment
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ //! @param theTrsf [in] optional transformation to apply
+ //! @return generated triangulation
+ Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) Create (const Standard_Real theMajorRad,
+ const Standard_Real theMinorRad,
+ const Standard_Real theAngle1,
+ const Standard_Real theAngle2,
+ const Standard_Real theAngle,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks,
+ const gp_Trsf& theTrsf);
+
+public:
+
+ //! Initializes the algorithm creating a complete torus.
+ //! @param theMajorRad [in] distance from the center of the pipe to the center of the torus
+ //! @param theMinorRad [in] radius of the pipe
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ Prs3d_ToolTorus (const Standard_Real theMajorRad,
+ const Standard_Real theMinorRad,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks)
+ {
+ init (theMajorRad, theMinorRad, 0.0, M_PI * 2.0, M_PI * 2.0, theNbSlices, theNbStacks);
+ }
+
+ //! Initializes the algorithm creating a torus pipe segment.
+ //! @param theMajorRad [in] distance from the center of the pipe to the center of the torus
+ //! @param theMinorRad [in] radius of the pipe
+ //! @param theAngle [in] angle to create a torus pipe segment
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ Prs3d_ToolTorus (const Standard_Real theMajorRad,
+ const Standard_Real theMinorRad,
+ const Standard_Real theAngle,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks)
+ {
+ init (theMajorRad, theMinorRad, 0.0, M_PI * 2.0, theAngle, theNbSlices, theNbStacks);
+ }
+
+ //! Initializes the algorithm creating a torus ring segment.
+ //! @param theMajorRad [in] distance from the center of the pipe to the center of the torus
+ //! @param theMinorRad [in] radius of the pipe
+ //! @param theAngle1 [in] first angle to create a torus ring segment
+ //! @param theAngle2 [in] second angle to create a torus ring segment
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ Prs3d_ToolTorus (const Standard_Real theMajorRad,
+ const Standard_Real theMinorRad,
+ const Standard_Real theAngle1,
+ const Standard_Real theAngle2,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks)
+ {
+ init (theMajorRad, theMinorRad, theAngle1, theAngle2, M_PI * 2.0, theNbSlices, theNbStacks);
+ }
+
+ //! Initializes the algorithm creating a torus ring segment.
+ //! @param theMajorRad [in] distance from the center of the pipe to the center of the torus
+ //! @param theMinorRad [in] radius of the pipe
+ //! @param theAngle1 [in] first angle to create a torus ring segment
+ //! @param theAngle2 [in] second angle to create a torus ring segment
+ //! @param theAngle [in] angle to create a torus pipe segment
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ Prs3d_ToolTorus (const Standard_Real theMajorRad,
+ const Standard_Real theMinorRad,
+ const Standard_Real theAngle1,
+ const Standard_Real theAngle2,
+ const Standard_Real theAngle,
+ const Standard_Integer theNbSlices,
+ const Standard_Integer theNbStacks)
+ {
+ init (theMajorRad, theMinorRad, theAngle1, theAngle2, theAngle, theNbSlices, theNbStacks);
+ }
+
+private:
+
+ //! Initialisation
+ //! @param theMajorRad [in] distance from the center of the pipe to the center of the torus
+ //! @param theMinorRad [in] radius of the pipe
+ //! @param theAngle1 [in] first angle to create a torus ring segment
+ //! @param theAngle2 [in] second angle to create a torus ring segment
+ //! @param theAngle [in] angle to create a torus pipe segment
+ //! @param theNbSlices [in] number of slices within U parameter
+ //! @param theNbStacks [in] number of stacks within V parameter
+ Standard_EXPORT void init (const Standard_Real theMajorRad,
+ const Standard_Real theMinorRad,
+ const Standard_Real theAngle1,
+ const Standard_Real theAngle2,
+ const Standard_Real theAngle,
+ 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) 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) const Standard_OVERRIDE;
+
+protected:
+
+ Standard_Real myMajorRadius; //!< distance from the center of the pipe to the center of the torus
+ Standard_Real myMinorRadius; //!< radius of the pipe
+ Standard_Real myAngle; //!< angle to create a torus pipe segment
+ Standard_Real myVMin; //!< first angle to create a torus ring segment
+ Standard_Real myVMax; //!< second angle to create a torus ring segment
+
+};
+
+#endif // _Prs3d_ToolTorus_HeaderFile
#include <Prs3d_PointAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_TextAspect.hxx>
+#include <Prs3d_ToolCylinder.hxx>
+#include <Prs3d_ToolSphere.hxx>
+#include <Prs3d_ToolTorus.hxx>
#include <Image_AlienPixMap.hxx>
#include <TColStd_HArray1OfAsciiString.hxx>
return 0;
}
+//===========================================================================
+//function : VTorus
+//purpose : creates and displays a torus or torus segment
+//===========================================================================
+static Standard_Integer VTorus (Draw_Interpretor& /*di*/,
+ Standard_Integer argc,
+ const char ** argv)
+{
+ if (argc < 4 || argc > 7)
+ {
+ Message::SendFail ("Syntax error: wrong number of arguments");
+ return 1;
+ }
+
+ Standard_Real aMajorRad = Draw::Atof (argv[2]);
+ Standard_Real aMinorRad = Draw::Atof (argv[3]);
+ if (aMajorRad <= 0 || aMajorRad <= 0)
+ {
+ Message::SendFail ("Syntax error: wrong radius value");
+ return 1;
+ }
+
+ Standard_Integer aNbSlices = 100;
+ Standard_Integer aNbStacks = 100;
+ const Standard_Integer aTrianglesNb = Prs3d_ToolTorus::TrianglesNb (aNbSlices, aNbStacks);
+ const Standard_Integer aVerticesNb = Prs3d_ToolTorus::VerticesNb (aNbSlices, aNbStacks);
+ Handle(Graphic3d_ArrayOfTriangles) aTriangles
+ = new Graphic3d_ArrayOfTriangles (aVerticesNb, aTrianglesNb * 3, Graphic3d_ArrayFlags_VertexNormal);
+
+
+ if (argc == 4)
+ {
+ Prs3d_ToolTorus aTool (aMajorRad, aMinorRad, aNbSlices, aNbStacks);
+ aTool.FillArray (aTriangles, gp_Trsf());
+ }
+ else if (argc == 5)
+ {
+ Prs3d_ToolTorus aTool (aMajorRad, aMinorRad,
+ Draw::Atof (argv[4]) * (M_PI / 180.0),
+ aNbSlices, aNbStacks);
+ aTool.FillArray (aTriangles, gp_Trsf());
+ }
+ else if (argc == 6)
+ {
+ Prs3d_ToolTorus aTool (aMajorRad, aMinorRad,
+ Draw::Atof (argv[4]) * (M_PI / 180.0), Draw::Atof (argv[5]) * (M_PI / 180.0),
+ aNbSlices, aNbStacks);
+ aTool.FillArray (aTriangles, gp_Trsf());
+ }
+ else if (argc == 7)
+ {
+ Prs3d_ToolTorus aTool (aMajorRad, aMinorRad,
+ Draw::Atof (argv[4]) * (M_PI / 180.0), Draw::Atof (argv[5]) * (M_PI / 180.0),
+ Draw::Atof (argv[6]) * (M_PI / 180.0),
+ aNbSlices, aNbStacks);
+ aTool.FillArray (aTriangles, gp_Trsf());
+ }
+
+ Handle(AIS_InteractiveObject) anIO = new MyPArrayObject (aTriangles);
+
+ ViewerTest::Display (argv[1], anIO);
+ return 0;
+}
+
+//===========================================================================
+//function : VCylinder
+//purpose : creates and displays a cylinder
+//===========================================================================
+static Standard_Integer VCylinder (Draw_Interpretor& /*di*/,
+ Standard_Integer argc,
+ const char ** argv)
+{
+ if (argc != 5 )
+ {
+ Message::SendFail ("Syntax error: wrong number of arguments");
+ return 1;
+ }
+
+ Standard_Real aBotRad = Draw::Atof (argv[2]);
+ Standard_Real aTopRad = Draw::Atof (argv[3]);
+ Standard_Real aHeight = Draw::Atof (argv[4]);
+ if (aBotRad < 0 || aTopRad < 0 || aHeight < 0)
+ {
+ Message::SendFail ("Syntax error: wrong parameter values");
+ return 1;
+ }
+
+ Standard_Integer aNbSlices = 100;
+ Standard_Integer aNbStacks = 1;
+ const Standard_Integer aTrianglesNb = Prs3d_ToolCylinder::TrianglesNb (aNbSlices, aNbStacks);
+ const Standard_Integer aVerticesNb = Prs3d_ToolCylinder::VerticesNb (aNbSlices, aNbStacks);
+ Handle(Graphic3d_ArrayOfTriangles) aTriangles
+ = new Graphic3d_ArrayOfTriangles (aVerticesNb, aTrianglesNb * 3, Graphic3d_ArrayFlags_VertexNormal);
+
+ Prs3d_ToolCylinder aTool (aBotRad, aTopRad, aHeight, aNbSlices, aNbStacks);
+ aTool.FillArray (aTriangles, gp_Trsf());
+
+ Handle(AIS_InteractiveObject) anIO = new MyPArrayObject (aTriangles);
+
+ ViewerTest::Display (argv[1], anIO);
+ return 0;
+}
+
+//===========================================================================
+//function : VSphere
+//purpose : creates and displays a sphere
+//===========================================================================
+static Standard_Integer VSphere (Draw_Interpretor& /*di*/,
+ Standard_Integer argc,
+ const char ** argv)
+{
+ if (argc != 3)
+ {
+ Message::SendFail ("Syntax error: wrong number of arguments");
+ return 1;
+ }
+
+ Standard_Real aRad = Draw::Atof (argv[2]);
+ if (aRad <= 0)
+ {
+ Message::SendFail ("Syntax error: wrong radius value");
+ return 1;
+ }
+
+ Standard_Integer aNbSlices = 100;
+ Standard_Integer aNbStacks = 100;
+ const Standard_Integer aTrianglesNb = Prs3d_ToolSphere::TrianglesNb (aNbSlices, aNbStacks);
+ const Standard_Integer aVerticesNb = Prs3d_ToolSphere::VerticesNb (aNbSlices, aNbStacks);
+ Handle(Graphic3d_ArrayOfTriangles) aTriangles
+ = new Graphic3d_ArrayOfTriangles (aVerticesNb, aTrianglesNb * 3, Graphic3d_ArrayFlags_VertexNormal);
+
+ Prs3d_ToolSphere aTool (aRad, aNbSlices, aNbStacks);
+ aTool.FillArray (aTriangles, gp_Trsf());
+
+ Handle(AIS_InteractiveObject) anIO = new MyPArrayObject (aTriangles);
+
+ ViewerTest::Display (argv[1], anIO);
+ return 0;
+}
+
//=======================================================================
//function : VObjZLayer
//purpose : Set or get z layer id for presentable object
"\n\t\t: Creates and displays a segment from named points.",
__FILE__, VTriangle,group);
+ theCommands.Add ("vtorus",
+ "vtorus name R1 R2 [angle1 angle2] [angle]"
+ "\n\t\t: Creates and displays a torus or torus segment."
+ "\n\t\t: Parameters of the torus :"
+ "\n\t\t: - R1 distance from the center of the pipe to the center of the torus"
+ "\n\t\t: - R2 radius of the pipe"
+ "\n\t\t: - angle1 first angle to create a torus ring segment"
+ "\n\t\t: - angle2 second angle to create a torus ring segment"
+ "\n\t\t: - angle angle to create a torus pipe segment",
+ __FILE__, VTorus, group);
+
+ theCommands.Add ("vcylinder",
+ "vcylinder name R1 R2 height"
+ "\n\t\t: Creates and displays a cylinder."
+ "\n\t\t: Parameters of the cylinder :"
+ "\n\t\t: - R1 cylinder bottom radius"
+ "\n\t\t: - R2 cylinder top radius"
+ "\n\t\t: - height cylinder height",
+ __FILE__, VCylinder, group);
+
+ theCommands.Add ("vsphere",
+ "vsphere name radius"
+ "\n\t\t: Creates and displays a sphere.",
+ __FILE__, VSphere, group);
+
theCommands.Add("vobjzlayer",
"vobjzlayer : set/get object [layerid] - set or get z layer id for the interactive object",
__FILE__, VObjZLayer, group);
022 transparency
023 viewcube
024 colors
+025 quadric
--- /dev/null
+vinit View1
+set subgroup "quadric"
--- /dev/null
+puts "===================================="
+puts "Prs3d_ToolCylinder - create cylinder"
+puts "===================================="
+
+# cylinder
+vcylinder c1 8 8 20
+vlocation c1 -translate 0 0 20
+
+# cone
+vcylinder c2 8 0 20
+vlocation c2 -translate -20 -20 -20
+
+# frustum of a cone
+vcylinder c3 8 4 10
+vlocation c3 -translate 20 20 -20
+
+vfit
+
+vdump $imagedir/${casename}.png
--- /dev/null
+puts "================================"
+puts "Prs3d_ToolSphere - create sphere"
+puts "================================"
+
+# complete sphere
+vsphere s 10
+
+vfit
+
+vdump $imagedir/${casename}.png
--- /dev/null
+puts "=============================="
+puts "Prs3d_ToolTorus - create torus"
+puts "=============================="
+
+# complete torus
+vtorus t1 10 5
+vlocation t1 -translate 0 0 20
+
+# torus segment
+vtorus t2 10 5 270
+vlocation t2 -translate -20 -20 -20
+
+# torus ring segment
+vtorus t3 10 5 180 360
+vlocation t3 -translate 20 20 -20
+
+vfit
+
+vdump $imagedir/${casename}.png