Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-14 08:28:39

0001 // Created on: 1991-07-23
0002 // Created by: Christophe MARION
0003 // Copyright (c) 1991-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BRepPrim_OneAxis_HeaderFile
0018 #define _BRepPrim_OneAxis_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <BRepPrim_Builder.hxx>
0024 #include <gp_Ax2.hxx>
0025 #include <TopoDS_Shell.hxx>
0026 #include <TopoDS_Vertex.hxx>
0027 #include <TopoDS_Edge.hxx>
0028 #include <TopoDS_Wire.hxx>
0029 #include <TopoDS_Face.hxx>
0030 class gp_Pnt2d;
0031 
0032 //! Algorithm to  build  primitives with  one  axis of
0033 //! revolution.
0034 //!
0035 //! The revolution  body is described by :
0036 //!
0037 //! A coordinate  system (Ax2 from  gp). The Z axis is
0038 //! the rotational axis.
0039 //!
0040 //! An Angle around the Axis, When  the Angle  is 2*PI
0041 //! the primitive is not limited  by planar faces. The
0042 //! U parameter range from 0 to Angle.
0043 //!
0044 //! A parameter range VMin, VMax on the meridian.
0045 //!
0046 //! A meridian : The  meridian is a curve described by
0047 //! a set of deferred methods.
0048 //!
0049 //! The  topology consists of  A shell,  Faces,  Wires,
0050 //! Edges and Vertices.  Methods  are provided to build
0051 //! all the elements.  Building an element  implies the
0052 //! automatic building  of  all its  sub-elements.
0053 //!
0054 //! So building the shell builds everything.
0055 //!
0056 //! There are at most 5 faces :
0057 //!
0058 //! - The LateralFace.
0059 //!
0060 //! - The TopFace and the BottomFace.
0061 //!
0062 //! - The StartFace and the EndFace.
0063 class BRepPrim_OneAxis
0064 {
0065 public:
0066   DEFINE_STANDARD_ALLOC
0067 
0068   //! The MeridianOffset is added  to the  parameters on
0069   //! the meridian curve and  to  the  V values  of  the
0070   //! pcurves. This is  used for the sphere for example,
0071   //! to give a range on the meridian  edge which is not
0072   //! VMin, VMax.
0073   Standard_EXPORT void SetMeridianOffset(const Standard_Real MeridianOffset = 0);
0074 
0075   //! Returns the Ax2 from <me>.
0076   Standard_EXPORT const gp_Ax2& Axes() const;
0077 
0078   Standard_EXPORT void Axes(const gp_Ax2& A);
0079 
0080   Standard_EXPORT Standard_Real Angle() const;
0081 
0082   Standard_EXPORT void Angle(const Standard_Real A);
0083 
0084   Standard_EXPORT Standard_Real VMin() const;
0085 
0086   Standard_EXPORT void VMin(const Standard_Real V);
0087 
0088   Standard_EXPORT Standard_Real VMax() const;
0089 
0090   Standard_EXPORT void VMax(const Standard_Real V);
0091 
0092   //! Returns a face with  no edges.  The surface is the
0093   //! lateral surface with normals pointing outward. The
0094   //! U parameter is the angle with the  origin on the X
0095   //! axis. The  V parameter is   the  parameter of  the
0096   //! meridian.
0097   Standard_EXPORT virtual TopoDS_Face MakeEmptyLateralFace() const = 0;
0098 
0099   //! Returns  an  edge with  a 3D curve   made from the
0100   //! meridian  in the XZ  plane rotated by <Ang> around
0101   //! the Z-axis. Ang may be 0 or myAngle.
0102   Standard_EXPORT virtual TopoDS_Edge MakeEmptyMeridianEdge(const Standard_Real Ang) const = 0;
0103 
0104   //! Sets the  parametric curve of the  edge <E> in the
0105   //! face  <F> to be  the   2d representation  of   the
0106   //! meridian.
0107   Standard_EXPORT virtual void SetMeridianPCurve(TopoDS_Edge& E, const TopoDS_Face& F) const = 0;
0108 
0109   //! Returns the meridian point at parameter <V> in the
0110   //! plane XZ.
0111   Standard_EXPORT virtual gp_Pnt2d MeridianValue(const Standard_Real V) const = 0;
0112 
0113   //! Returns True if the point of  parameter <V> on the
0114   //! meridian is on the Axis. Default implementation is
0115   //! Abs(MeridianValue(V).X()) < Precision::Confusion()
0116   Standard_EXPORT virtual Standard_Boolean MeridianOnAxis(const Standard_Real V) const;
0117 
0118   //! Returns True  if the  meridian is  closed. Default
0119   //! implementation                                  is
0120   //! MeridianValue(VMin).IsEqual(MeridianValue(VMax),
0121   //! Precision::Confusion())
0122   Standard_EXPORT virtual Standard_Boolean MeridianClosed() const;
0123 
0124   //! Returns  True   if  VMax    is  infinite.  Default
0125   //! Precision::IsPositiveInfinite(VMax);
0126   Standard_EXPORT virtual Standard_Boolean VMaxInfinite() const;
0127 
0128   //! Returns  True   if  VMin    is  infinite.  Default
0129   //! Precision::IsNegativeInfinite(VMax);
0130   Standard_EXPORT virtual Standard_Boolean VMinInfinite() const;
0131 
0132   //! Returns True if  there is  a top  face.
0133   //!
0134   //! That is neither : VMaxInfinite()
0135   //! MeridianClosed()
0136   //! MeridianOnAxis(VMax)
0137   Standard_EXPORT virtual Standard_Boolean HasTop() const;
0138 
0139   //! Returns   True if there is   a bottom  face.
0140   //!
0141   //! That is neither : VMinInfinite()
0142   //! MeridianClosed()
0143   //! MeridianOnAxis(VMin)
0144   Standard_EXPORT virtual Standard_Boolean HasBottom() const;
0145 
0146   //! Returns True if  there are Start   and  End faces.
0147   //!
0148   //! That is : 2*PI  - Angle > Precision::Angular()
0149   Standard_EXPORT virtual Standard_Boolean HasSides() const;
0150 
0151   //! Returns the Shell containing all the  Faces of the
0152   //! primitive.
0153   Standard_EXPORT const TopoDS_Shell& Shell();
0154 
0155   //! Returns  the lateral Face.   It is oriented toward
0156   //! the outside of the primitive.
0157   Standard_EXPORT const TopoDS_Face& LateralFace();
0158 
0159   //! Returns the   top planar  Face.    It  is Oriented
0160   //! toward the +Z axis (outside).
0161   Standard_EXPORT const TopoDS_Face& TopFace();
0162 
0163   //! Returns  the Bottom planar Face.   It is  Oriented
0164   //! toward the -Z axis (outside).
0165   Standard_EXPORT const TopoDS_Face& BottomFace();
0166 
0167   //! Returns  the  Face   starting   the slice, it   is
0168   //! oriented toward the exterior of the primitive.
0169   Standard_EXPORT const TopoDS_Face& StartFace();
0170 
0171   //! Returns the Face ending the slice, it  is oriented
0172   //! toward the exterior of the primitive.
0173   Standard_EXPORT const TopoDS_Face& EndFace();
0174 
0175   //! Returns  the wire in the lateral face.
0176   Standard_EXPORT const TopoDS_Wire& LateralWire();
0177 
0178   //! Returns the   wire in the   lateral  face with the
0179   //! start edge.
0180   Standard_EXPORT const TopoDS_Wire& LateralStartWire();
0181 
0182   //! Returns the wire with in lateral face with the end
0183   //! edge.
0184   Standard_EXPORT const TopoDS_Wire& LateralEndWire();
0185 
0186   //! Returns the wire in the top face.
0187   Standard_EXPORT const TopoDS_Wire& TopWire();
0188 
0189   //! Returns the wire in the bottom face.
0190   Standard_EXPORT const TopoDS_Wire& BottomWire();
0191 
0192   //! Returns the wire  in the  start face.
0193   Standard_EXPORT const TopoDS_Wire& StartWire();
0194 
0195   //! Returns  the wire   in the  start   face  with the
0196   //! AxisEdge.
0197   Standard_EXPORT const TopoDS_Wire& AxisStartWire();
0198 
0199   //! Returns the Wire in   the end face.
0200   Standard_EXPORT const TopoDS_Wire& EndWire();
0201 
0202   //! Returns  the Wire  in  the   end   face  with  the
0203   //! AxisEdge.
0204   Standard_EXPORT const TopoDS_Wire& AxisEndWire();
0205 
0206   //! Returns the Edge built along the Axis and oriented
0207   //! on +Z of the Axis.
0208   Standard_EXPORT const TopoDS_Edge& AxisEdge();
0209 
0210   //! Returns the   Edge at angle 0.
0211   Standard_EXPORT const TopoDS_Edge& StartEdge();
0212 
0213   //! Returns the  Edge at  angle Angle.  If !HasSides()
0214   //! the StartEdge and the EndEdge are the same edge.
0215   Standard_EXPORT const TopoDS_Edge& EndEdge();
0216 
0217   //! Returns the linear Edge between start Face and top
0218   //! Face.
0219   Standard_EXPORT const TopoDS_Edge& StartTopEdge();
0220 
0221   //! Returns the linear  Edge between  start  Face  and
0222   //! bottom Face.
0223   Standard_EXPORT const TopoDS_Edge& StartBottomEdge();
0224 
0225   //! Returns the linear Edge  between end Face and  top
0226   //! Face.
0227   Standard_EXPORT const TopoDS_Edge& EndTopEdge();
0228 
0229   //! Returns  the  linear  Edge  between end  Face  and
0230   //! bottom Face.
0231   Standard_EXPORT const TopoDS_Edge& EndBottomEdge();
0232 
0233   //! Returns the edge at VMax. If  MeridianClosed() the
0234   //! TopEdge and the BottomEdge are the same edge.
0235   Standard_EXPORT const TopoDS_Edge& TopEdge();
0236 
0237   //! Returns the edge  at VMin. If MeridianClosed() the
0238   //! TopEdge and the BottomEdge are the same edge.
0239   Standard_EXPORT const TopoDS_Edge& BottomEdge();
0240 
0241   //! Returns the Vertex at the Top altitude on the axis.
0242   Standard_EXPORT const TopoDS_Vertex& AxisTopVertex();
0243 
0244   //! Returns the Vertex  at the Bottom  altitude on the
0245   //! axis.
0246   Standard_EXPORT const TopoDS_Vertex& AxisBottomVertex();
0247 
0248   //! Returns the vertex (0,VMax)
0249   Standard_EXPORT const TopoDS_Vertex& TopStartVertex();
0250 
0251   //! Returns the vertex (angle,VMax)
0252   Standard_EXPORT const TopoDS_Vertex& TopEndVertex();
0253 
0254   //! Returns the vertex (0,VMin)
0255   Standard_EXPORT const TopoDS_Vertex& BottomStartVertex();
0256 
0257   //! Returns the vertex (angle,VMax)
0258   Standard_EXPORT const TopoDS_Vertex& BottomEndVertex();
0259   Standard_EXPORT virtual ~BRepPrim_OneAxis();
0260 
0261 protected:
0262   //! Creates a OneAxis algorithm.  <B> is used to build
0263   //! the Topology. The angle defaults to 2*PI.
0264   Standard_EXPORT BRepPrim_OneAxis(const BRepPrim_Builder& B,
0265                                    const gp_Ax2&           A,
0266                                    const Standard_Real     VMin,
0267                                    const Standard_Real     VMax);
0268 
0269   BRepPrim_Builder myBuilder;
0270 
0271 private:
0272   gp_Ax2           myAxes;
0273   Standard_Real    myAngle;
0274   Standard_Real    myVMin;
0275   Standard_Real    myVMax;
0276   Standard_Real    myMeridianOffset;
0277   TopoDS_Shell     myShell;
0278   Standard_Boolean ShellBuilt;
0279   TopoDS_Vertex    myVertices[6];
0280   Standard_Boolean VerticesBuilt[6];
0281   TopoDS_Edge      myEdges[9];
0282   Standard_Boolean EdgesBuilt[9];
0283   TopoDS_Wire      myWires[9];
0284   Standard_Boolean WiresBuilt[9];
0285   TopoDS_Face      myFaces[5];
0286   Standard_Boolean FacesBuilt[5];
0287 };
0288 
0289 #endif // _BRepPrim_OneAxis_HeaderFile