1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
|
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _BRepAlgoAPI_Section_HeaderFile
#define _BRepAlgoAPI_Section_HeaderFile
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _BRepAlgoAPI_BooleanOperation_HeaderFile
#include <BRepAlgoAPI_BooleanOperation.hxx>
#endif
#ifndef _Handle_Geom_Surface_HeaderFile
#include <Handle_Geom_Surface.hxx>
#endif
#ifndef _Handle_Geom2d_Curve_HeaderFile
#include <Handle_Geom2d_Curve.hxx>
#endif
class TopoDS_Shape;
class BOPTools_DSFiller;
class gp_Pln;
class Geom_Surface;
class Geom2d_Curve;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
//! Computes the intersection of two shapes or geometries. <br>
//! Geometries can be surfaces of planes. <br>
//! Geometries are converted to faces <br>
//! When a geometry has been converted to <br>
//! topology the created shape can be found using <br>
//! the methods Shape1 and Shape2 inherited from the class BooleanOperation. <br>
//! The result (Shape() method) is a compound containing <br>
//! edges built on intersection curves. <br>
//! By default, the section is performed immediatly in <br>
//! class constructors, with default values : <br>
//! - geometries built are NOT approximated. <br>
//! - PCurves are NOT computed on both parts. <br>
//! Example : giving two shapes S1,S2 accessing faces, <br>
//! let compute the section edges R on S1,S2, <br>
//! performing approximation on new curves, <br>
//! performing PCurve on part 1 but not on part 2 : <br>
//! Standard_Boolean PerformNow = Standard_False; <br>
//! BRepBoolAPI_Section S(S1,S2,PerformNow); <br>
//! S.ComputePCurveOn1(Standard_True); <br>
//! S.Approximation(Standard_True); <br>
//! S.Build(); <br>
//! TopoDS_Shape R = S.Shape(); <br>
//! On Null Shapes of geometries, NotDone() is called. <br>
class BRepAlgoAPI_Section : public BRepAlgoAPI_BooleanOperation {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& S1,const TopoDS_Shape& S2,const BOPTools_DSFiller& aDSF,const Standard_Boolean PerformNow = Standard_True);
//! see upper <br>
Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& Sh1,const TopoDS_Shape& Sh2,const Standard_Boolean PerformNow = Standard_True);
//! see upper <br>
Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& Sh,const gp_Pln& Pl,const Standard_Boolean PerformNow = Standard_True);
//! see upper <br>
Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& Sh,const Handle(Geom_Surface)& Sf,const Standard_Boolean PerformNow = Standard_True);
//! see upper <br>
Standard_EXPORT BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf,const TopoDS_Shape& Sh,const Standard_Boolean PerformNow = Standard_True);
//! This and the above classes construct a framework for <br>
//! computing the section lines of: <br>
//! - two shapes Sh1 and Sh2, or <br>
//! - shape Sh and plane Pl, or <br>
//! - shape Sh and surface Sf, or <br>
//! - surface Sf and shape Sh, or <br>
//! - two surfaces Sf1 and Sf2, <br>
//! and builds a result if PerformNow equals true, its <br>
//! default value. If PerformNow equals false, the intersection <br>
//! will be computed later by the function Build. <br>
//! The constructed shape will be returned by the function Shape. <br>
//! This is a compound object composed of edges. These <br>
//! intersection edges may be built: <br>
//! - on new intersection lines, or <br>
//! - on coincident portions of edges in the two intersected shapes. <br>
//! These intersection edges are independent: they are not <br>
//! chained or grouped in wires. If no intersection edge exists, the <br>
//! result is an empty compound object. <br>
//! Note that other objects than TopoDS_Shape shapes involved in <br>
//! these syntaxes are converted into faces or shells before <br>
//! performing the computation of the intersection. A shape <br>
//! resulting from this conversion can be retrieved with the <br>
//! function Shape1 or Shape2. <br>
//! Parametric 2D curves on intersection edges <br>
//! No parametric 2D curve (pcurve) is defined for each elementary <br>
//! edge of the result. To attach such parametric curves to the <br>
//! constructed edges you may use a constructor with the PerformNow <br>
//! flag equal to false; then you use: <br>
//! - the function ComputePCurveOn1 to ask for <br>
//! the additional computation of a pcurve in the parametric <br>
//! space of the first shape, <br>
//! - the function ComputePCurveOn2 to ask for <br>
//! the additional computation of a pcurve in the parametric <br>
//! space of the second shape, in the end, <br>
//! - the function Build to construct the result. <br>
//! Approximation of intersection edges <br>
//! The underlying 3D geometry attached to each elementary edge <br>
//! of the result is: <br>
//! - analytic where possible, provided the corresponding <br>
//! geometry corresponds to a type of analytic curve <br>
//! defined in the Geom package; for example, the intersection <br>
//! of a cylindrical shape with a plane gives an ellipse or a circle; <br>
//! - or elsewhere, given as a succession of points grouped <br>
//! together in a BSpline curve of degree 1. <br>
//! If you prefer to have an attached 3D geometry which is a <br>
//! BSpline approximation of the computed set of points on <br>
//! computed elementary intersection edges whose underlying geometry <br>
//! is not analytic, you may use a constructor with the PerformNow <br>
//! flag equal to false. Then you use: <br>
//! - the function Approximation to ask for this <br>
//! computation option, and <br>
//! - the function Build to construct the result. <br>
//! - Note that as a result, approximations will only be <br>
//! computed on edges built on new intersection lines. <br>
//! - Example <br>
//! You may also combine these computation options. In the following example: <br>
//! - each elementary edge of the computed intersection, <br>
//! built on a new intersection line, which does not <br>
//! correspond to an analytic Geom curve, will be approximated by <br>
//! a BSpline curve whose degree is not greater than 8. <br>
//! - each elementary edge built on a new intersection line, will have: <br>
//! - a pcurve in the parametric space of the intersected face of shape S1, <br>
//! - no pcurve in the parametric space of the intersected face of shape S2. <br>
//! // TopoDS_Shape S1 = ... , S2 = ... ; <br>
//! Standard_Boolean PerformNow = Standard_False; <br>
//! BRepAlgoAPI_Section S ( S1, S2, PerformNow ); <br>
//! S.ComputePCurveOn1 (Standard_True); <br>
//! S.Approximation (Standard_True); <br>
//! S.Build(); <br>
//! TopoDS_Shape R = S.Shape(); <br>
Standard_EXPORT BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf1,const Handle(Geom_Surface)& Sf2,const Standard_Boolean PerformNow = Standard_True);
//! initialize first part <br>
Standard_EXPORT void Init1(const TopoDS_Shape& S1) ;
//! initialize first part <br>
Standard_EXPORT void Init1(const gp_Pln& Pl) ;
//! initialize first part <br>
Standard_EXPORT void Init1(const Handle(Geom_Surface)& Sf) ;
//! initialize second part <br>
Standard_EXPORT void Init2(const TopoDS_Shape& S2) ;
//! initialize second part <br>
Standard_EXPORT void Init2(const gp_Pln& Pl) ;
//! Reinitializes the first and the <br>
//! second parts on which this algorithm is going to perform <br>
//! the intersection computation. This is done with either: the <br>
//! surface Sf, the plane Pl or the shape Sh. <br>
//! You use the function Build to construct the result. <br>
Standard_EXPORT void Init2(const Handle(Geom_Surface)& Sf) ;
//! Defines an option for computation <br>
//! of further intersections. This computation will be performed by <br>
//! the function Build in this framework. <br>
//! By default, the underlying 3D geometry attached to each <br>
//! elementary edge of the result of a computed intersection is: <br>
//! - analytic where possible, provided the corresponding <br>
//! geometry corresponds to a type of analytic curve defined in <br>
//! the Geom package; for example the intersection of a <br>
//! cylindrical shape with a plane gives an ellipse or a circle; <br>
//! - or elsewhere, given as a succession of points grouped <br>
//! together in a BSpline curve of degree 1. If Approx equals <br>
//! true, when further computations are performed in this framework <br>
//! with the function Build, these edges will have an attached 3D <br>
//! geometry which is a BSpline approximation of the computed <br>
//! set of points. <br>
//! Note that as a result, approximations will be computed <br>
//! on edges built only on new intersection lines. <br>
Standard_EXPORT void Approximation(const Standard_Boolean B) ;
//! Indicates if the Pcurve must be (or not) performed on first part. <br>
Standard_EXPORT void ComputePCurveOn1(const Standard_Boolean B) ;
//! Define options for the computation of further <br>
//! intersections, which will be performed by the function Build <br>
//! in this framework. <br>
//! By default, no parametric 2D curve (pcurve) is defined for the <br>
//! elementary edges of the result. If ComputePCurve1 equals true, <br>
//! further computations performed in this framework with the function <br>
//! Build will attach an additional pcurve in the parametric space of <br>
//! the first shape to the constructed edges. <br>
//! If ComputePCurve2 equals true, the additional pcurve will be <br>
//! attached to the constructed edges in the parametric space of the <br>
//! second shape. <br>
//! These two functions may be used together. <br>
Standard_EXPORT void ComputePCurveOn2(const Standard_Boolean B) ;
//! Performs the computation of <br>
//! section lines between two parts defined at the time of <br>
//! construction of this framework or reinitialized with the Init1 and <br>
//! Init2 functions. <br>
//! The constructed shape will be returned by the function Shape. <br>
//! This is a compound object composed of edges. These <br>
//! intersection edges may be built: <br>
//! - on new intersection lines, or <br>
//! - on coincident portions of edges in the two intersected shapes. <br>
//! These intersection edges are independent: they are not chained <br>
//! or grouped into wires. <br>
//! If no intersection edge exists, the result is an empty compound object. <br>
//! The shapes involved in the construction of section lines can <br>
//! be retrieved with the function Shape1 or Shape2. Note that other <br>
//! objects than TopoDS_Shape shapes given as arguments at the <br>
//! construction time of this framework, or to the Init1 or <br>
//! Init2 function, are converted into faces or shells before <br>
//! performing the computation of the intersection. <br>
//! Parametric 2D curves on intersection edges <br>
//! No parametric 2D curve (pcurve) is defined for the elementary <br>
//! edges of the result. To attach parametric curves like this to <br>
//! the constructed edges you have to use: <br>
//! - the function <br>
//! ComputePCurveOn1 to ask for the additional computation of a <br>
//! pcurve in the parametric space of the first shape, <br>
//! - the function <br>
//! ComputePCurveOn2 to ask for the additional computation of a <br>
//! pcurve in the parametric space of the second shape. <br>
//! This must be done before calling this function. <br>
//! Approximation of intersection edges <br>
//! The underlying 3D geometry attached to each elementary edge of the result is: <br>
//! - analytic (where possible) provided the corresponding <br>
//! geometry corresponds to a type of analytic curve defined in <br>
//! the Geom package; for example, the intersection of a <br>
//! cylindrical shape with a plane gives an ellipse or a circle; or <br>
//! - elsewhere, given as a succession of points grouped <br>
//! together in a BSpline curve of degree 1. <br>
//! If, on computed elementary intersection edges whose <br>
//! underlying geometry is not analytic, you prefer to have an <br>
//! attached 3D geometry which is a Bspline approximation of the <br>
//! computed set of points, you have to use the function Approximation <br>
//! to ask for this computation option before calling this function. <br>
//! You may also have combined these computation options: look at the <br>
//! example given above to illustrate the use of the constructors. <br>
Standard_EXPORT void Build() ;
//! get the face of the first part giving section edge <E>. <br>
//! Returns True on the 3 following conditions : <br>
//! 1/ <E> is an edge returned by the Shape() method. <br>
//! 2/ First part of section performed is a shape. <br>
//! 3/ <E> is built on a intersection curve (i.e <E> <br>
//! is not the result of common edges) <br>
//! When False, F remains untouched. <br>
Standard_EXPORT Standard_Boolean HasAncestorFaceOn1(const TopoDS_Shape& E,TopoDS_Shape& F) const;
//! Identifies the ancestor faces of <br>
//! the intersection edge E resulting from the last <br>
//! computation performed in this framework, that is, the faces of <br>
//! the two original shapes on which the edge E lies: <br>
//! - HasAncestorFaceOn1 gives the ancestor face in the first shape, and <br>
//! - HasAncestorFaceOn2 gives the ancestor face in the second shape. <br>
//! These functions return true if an ancestor face F is found, or false if not. <br>
//! An ancestor face is identifiable for the edge E if the following <br>
//! conditions are satisfied: <br>
//! - the first part on which this algorithm performed its <br>
//! last computation is a shape, that is, it was not given as <br>
//! a surface or a plane at the time of construction of this <br>
//! algorithm or at a later time by the Init1 function, <br>
//! - E is one of the elementary edges built by the <br>
//! last computation of this section algorithm. <br>
//! To use these functions properly, you have to test the returned <br>
//! Boolean value before using the ancestor face: F is significant <br>
//! only if the returned Boolean value equals true. <br>
Standard_EXPORT Standard_Boolean HasAncestorFaceOn2(const TopoDS_Shape& E,TopoDS_Shape& F) const;
//! returns the PCurve connected to section edge <E> <br>
//! and lying on first part of Section. <br>
//! N.B : PCurve on first part is computed only if Section is performed <br>
//! after setting ComputePCurveOn1(Standard_True). <br>
Standard_EXPORT Handle_Geom2d_Curve PCurveOn1(const TopoDS_Shape& E) const;
//! returns the PCurve connected to section edge <E> <br>
//! and lying on second part of Section. <br>
//! N.B : PCurve on second part is computed only if Section is performed <br>
//! after setting ComputePCurveOn2(Standard_True). <br>
//! Warning No pcurve is attached to an elementary edge of the <br>
//! resulting section, and the function returns a null <br>
//! handle, unless the function ComputePCurveOn1 or <br>
//! ComputePCurveOn2 was previously used to define <br>
//! this sort of option of computation. <br>
//! - A null handle is also returned if the edge E does <br>
//! not belong to the last computed intersection, that <br>
//! is, if it is not one of the elementary edges of the <br>
//! compound object returned by the function Shape. <br>
Standard_EXPORT Handle_Geom2d_Curve PCurveOn2(const TopoDS_Shape& E) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
Standard_EXPORT void InitParameters() ;
// Fields PRIVATE
//
Standard_Boolean myshapeisnull;
Standard_Boolean myparameterschanged;
Standard_Boolean myApprox;
Standard_Boolean myComputePCurve1;
Standard_Boolean myComputePCurve2;
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif
|