Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:16

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