|
|
|||
File indexing completed on 2026-09-12 09:16:51
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 //! - The TopFace and the BottomFace. 0060 //! - The StartFace and the EndFace. 0061 class BRepPrim_OneAxis 0062 { 0063 public: 0064 DEFINE_STANDARD_ALLOC 0065 0066 //! The MeridianOffset is added to the parameters on 0067 //! the meridian curve and to the V values of the 0068 //! pcurves. This is used for the sphere for example, 0069 //! to give a range on the meridian edge which is not 0070 //! VMin, VMax. 0071 Standard_EXPORT void SetMeridianOffset(const double MeridianOffset = 0); 0072 0073 //! Returns the Ax2 from <me>. 0074 Standard_EXPORT const gp_Ax2& Axes() const; 0075 0076 Standard_EXPORT void Axes(const gp_Ax2& A); 0077 0078 Standard_EXPORT double Angle() const; 0079 0080 Standard_EXPORT void Angle(const double A); 0081 0082 Standard_EXPORT double VMin() const; 0083 0084 Standard_EXPORT void VMin(const double V); 0085 0086 Standard_EXPORT double VMax() const; 0087 0088 Standard_EXPORT void VMax(const double V); 0089 0090 //! Returns a face with no edges. The surface is the 0091 //! lateral surface with normals pointing outward. The 0092 //! U parameter is the angle with the origin on the X 0093 //! axis. The V parameter is the parameter of the 0094 //! meridian. 0095 Standard_EXPORT virtual TopoDS_Face MakeEmptyLateralFace() const = 0; 0096 0097 //! Returns an edge with a 3D curve made from the 0098 //! meridian in the XZ plane rotated by <Ang> around 0099 //! the Z-axis. Ang may be 0 or myAngle. 0100 Standard_EXPORT virtual TopoDS_Edge MakeEmptyMeridianEdge(const double Ang) const = 0; 0101 0102 //! Sets the parametric curve of the edge <E> in the 0103 //! face <F> to be the 2d representation of the 0104 //! meridian. 0105 Standard_EXPORT virtual void SetMeridianPCurve(TopoDS_Edge& E, const TopoDS_Face& F) const = 0; 0106 0107 //! Returns the meridian point at parameter <V> in the 0108 //! plane XZ. 0109 Standard_EXPORT virtual gp_Pnt2d MeridianValue(const double V) const = 0; 0110 0111 //! Returns True if the point of parameter <V> on the 0112 //! meridian is on the Axis. Default implementation is 0113 //! std::abs(MeridianValue(V).X()) < Precision::Confusion() 0114 Standard_EXPORT virtual bool MeridianOnAxis(const double V) const; 0115 0116 //! Returns True if the meridian is closed. 0117 //! Default implementation is: 0118 //! MeridianValue(VMin).IsEqual(MeridianValue(VMax), 0119 //! Precision::Confusion()) 0120 Standard_EXPORT virtual bool MeridianClosed() const; 0121 0122 //! Returns True if VMax is infinite. 0123 //! Default Precision::IsPositiveInfinite(VMax); 0124 Standard_EXPORT virtual bool VMaxInfinite() const; 0125 0126 //! Returns True if VMin is infinite. 0127 //! Default Precision::IsNegativeInfinite(VMax); 0128 Standard_EXPORT virtual bool VMinInfinite() const; 0129 0130 //! Returns True if there is a top face. 0131 //! 0132 //! That is neither: VMaxInfinite() 0133 //! MeridianClosed() 0134 //! MeridianOnAxis(VMax) 0135 Standard_EXPORT virtual bool HasTop() const; 0136 0137 //! Returns True if there is a bottom face. 0138 //! 0139 //! That is neither: VMinInfinite() 0140 //! MeridianClosed() 0141 //! MeridianOnAxis(VMin) 0142 Standard_EXPORT virtual bool HasBottom() const; 0143 0144 //! Returns True if there are Start and End faces. 0145 //! 0146 //! That is: 2*PI - Angle > Precision::Angular() 0147 Standard_EXPORT virtual bool HasSides() const; 0148 0149 //! Returns the Shell containing all the Faces of the 0150 //! primitive. 0151 Standard_EXPORT const TopoDS_Shell& Shell(); 0152 0153 //! Returns the lateral Face. It is oriented toward 0154 //! the outside of the primitive. 0155 Standard_EXPORT const TopoDS_Face& LateralFace(); 0156 0157 //! Returns the top planar Face. It is Oriented 0158 //! toward the +Z axis (outside). 0159 Standard_EXPORT const TopoDS_Face& TopFace(); 0160 0161 //! Returns the Bottom planar Face. It is Oriented 0162 //! toward the -Z axis (outside). 0163 Standard_EXPORT const TopoDS_Face& BottomFace(); 0164 0165 //! Returns the Face starting the slice, it is 0166 //! oriented toward the exterior of the primitive. 0167 Standard_EXPORT const TopoDS_Face& StartFace(); 0168 0169 //! Returns the Face ending the slice, it is oriented 0170 //! toward the exterior of the primitive. 0171 Standard_EXPORT const TopoDS_Face& EndFace(); 0172 0173 //! Returns the wire in the lateral face. 0174 Standard_EXPORT const TopoDS_Wire& LateralWire(); 0175 0176 //! Returns the wire in the lateral face with the 0177 //! start edge. 0178 Standard_EXPORT const TopoDS_Wire& LateralStartWire(); 0179 0180 //! Returns the wire with in lateral face with the end 0181 //! edge. 0182 Standard_EXPORT const TopoDS_Wire& LateralEndWire(); 0183 0184 //! Returns the wire in the top face. 0185 Standard_EXPORT const TopoDS_Wire& TopWire(); 0186 0187 //! Returns the wire in the bottom face. 0188 Standard_EXPORT const TopoDS_Wire& BottomWire(); 0189 0190 //! Returns the wire in the start face. 0191 Standard_EXPORT const TopoDS_Wire& StartWire(); 0192 0193 //! Returns the wire in the start face with the 0194 //! AxisEdge. 0195 Standard_EXPORT const TopoDS_Wire& AxisStartWire(); 0196 0197 //! Returns the Wire in the end face. 0198 Standard_EXPORT const TopoDS_Wire& EndWire(); 0199 0200 //! Returns the Wire in the end face with the 0201 //! AxisEdge. 0202 Standard_EXPORT const TopoDS_Wire& AxisEndWire(); 0203 0204 //! Returns the Edge built along the Axis and oriented 0205 //! on +Z of the Axis. 0206 Standard_EXPORT const TopoDS_Edge& AxisEdge(); 0207 0208 //! Returns the Edge at angle 0. 0209 Standard_EXPORT const TopoDS_Edge& StartEdge(); 0210 0211 //! Returns the Edge at angle Angle. If !HasSides() 0212 //! the StartEdge and the EndEdge are the same edge. 0213 Standard_EXPORT const TopoDS_Edge& EndEdge(); 0214 0215 //! Returns the linear Edge between start Face and top 0216 //! Face. 0217 Standard_EXPORT const TopoDS_Edge& StartTopEdge(); 0218 0219 //! Returns the linear Edge between start Face and 0220 //! bottom Face. 0221 Standard_EXPORT const TopoDS_Edge& StartBottomEdge(); 0222 0223 //! Returns the linear Edge between end Face and top 0224 //! Face. 0225 Standard_EXPORT const TopoDS_Edge& EndTopEdge(); 0226 0227 //! Returns the linear Edge between end Face and 0228 //! bottom Face. 0229 Standard_EXPORT const TopoDS_Edge& EndBottomEdge(); 0230 0231 //! Returns the edge at VMax. If MeridianClosed() the 0232 //! TopEdge and the BottomEdge are the same edge. 0233 Standard_EXPORT const TopoDS_Edge& TopEdge(); 0234 0235 //! Returns the edge at VMin. If MeridianClosed() the 0236 //! TopEdge and the BottomEdge are the same edge. 0237 Standard_EXPORT const TopoDS_Edge& BottomEdge(); 0238 0239 //! Returns the Vertex at the Top altitude on the axis. 0240 Standard_EXPORT const TopoDS_Vertex& AxisTopVertex(); 0241 0242 //! Returns the Vertex at the Bottom altitude on the 0243 //! axis. 0244 Standard_EXPORT const TopoDS_Vertex& AxisBottomVertex(); 0245 0246 //! Returns the vertex (0,VMax) 0247 Standard_EXPORT const TopoDS_Vertex& TopStartVertex(); 0248 0249 //! Returns the vertex (angle,VMax) 0250 Standard_EXPORT const TopoDS_Vertex& TopEndVertex(); 0251 0252 //! Returns the vertex (0,VMin) 0253 Standard_EXPORT const TopoDS_Vertex& BottomStartVertex(); 0254 0255 //! Returns the vertex (angle,VMax) 0256 Standard_EXPORT const TopoDS_Vertex& BottomEndVertex(); 0257 Standard_EXPORT virtual ~BRepPrim_OneAxis(); 0258 0259 protected: 0260 //! Creates a OneAxis algorithm. <B> is used to build 0261 //! the Topology. The angle defaults to 2*PI. 0262 Standard_EXPORT BRepPrim_OneAxis(const BRepPrim_Builder& B, 0263 const gp_Ax2& A, 0264 const double VMin, 0265 const double VMax); 0266 0267 BRepPrim_Builder myBuilder; 0268 0269 private: 0270 //! Returns true if the geometric height ordering is inverted, 0271 //! i.e., MeridianValue(VMax).Y() < MeridianValue(VMin).Y(). 0272 //! When true, VMin corresponds to geometric top and VMax to geometric bottom. 0273 //! This can occur with torus when V range like (90deg, 270deg) is used. 0274 bool isHeightInverted() const; 0275 0276 //! Returns true if the heights at VMin and VMax are equal (within tolerance). 0277 //! This indicates the AxisEdge would be degenerate (zero length). 0278 bool areHeightsEqual() const; 0279 0280 gp_Ax2 myAxes; 0281 double myAngle; 0282 double myVMin; 0283 double myVMax; 0284 double myMeridianOffset; 0285 TopoDS_Shell myShell; 0286 bool ShellBuilt; 0287 TopoDS_Vertex myVertices[6]; 0288 bool VerticesBuilt[6]; 0289 TopoDS_Edge myEdges[9]; 0290 bool EdgesBuilt[9]; 0291 TopoDS_Wire myWires[9]; 0292 bool WiresBuilt[9]; 0293 TopoDS_Face myFaces[5]; 0294 bool FacesBuilt[5]; 0295 }; 0296 0297 #endif // _BRepPrim_OneAxis_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|