1 // Created on: 1996-12-30 2 // Created by: Stagiaire Mary FABIEN 3 // Copyright (c) 1996-1999 Matra Datavision 4 // Copyright (c) 1999-2014 OPEN CASCADE SAS 5 // 6 // This file is part of Open CASCADE Technology software library. 7 // 8 // This library is free software; you can redistribute it and/or modify it under 9 // the terms of the GNU Lesser General Public License version 2.1 as published 10 // by the Free Software Foundation, with special exception defined in the file 11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 12 // distribution for complete text of the license and disclaimer of any warranty. 13 // 14 // Alternatively, this file may be used under the terms of Open CASCADE 15 // commercial license or contractual agreement. 16 17 #ifndef _BRepBuilderAPI_GTransform_HeaderFile 18 #define _BRepBuilderAPI_GTransform_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <gp_GTrsf.hxx> 25 #include <BRepBuilderAPI_Collect.hxx> 26 #include <BRepBuilderAPI_ModifyShape.hxx> 27 #include <Standard_Boolean.hxx> 28 #include <TopTools_ListOfShape.hxx> 29 class Standard_NoSuchObject; 30 class gp_GTrsf; 31 class TopoDS_Shape; 32 33 34 //! Geometric transformation on a shape. 35 //! The transformation to be applied is defined as a gp_GTrsf 36 //! transformation. It may be: 37 //! - a transformation equivalent to a gp_Trsf transformation, the 38 //! most common case: you should , however, use a BRepAPI_Transform 39 //! object to perform this kind of transformation; or 40 //! - an affinity, or 41 //! - more generally, any type of point transformation which may 42 //! be defined by a three row, four column matrix of transformation. 43 //! In the last two cases, the underlying geometry of the 44 //! following shapes may change: 45 //! - a curve which supports an edge of the shape, or 46 //! - a surface which supports a face of the shape; 47 //! For example, a circle may be transformed into an ellipse when 48 //! applying an affinity transformation. 49 //! The transformation is applied to: 50 //! - all the curves which support edges of the shape, and 51 //! - all the surfaces which support faces of the shape. 52 //! A GTransform object provides a framework for: 53 //! - defining the geometric transformation to be applied, 54 //! - implementing the transformation algorithm, and 55 //! - consulting the result. 56 class BRepBuilderAPI_GTransform : public BRepBuilderAPI_ModifyShape 57 { 58 public: 59 60 DEFINE_STANDARD_ALLOC 61 62 63 //! Constructs a framework for applying the geometric 64 //! transformation T to a shape. Use the function 65 //! Perform to define the shape to transform. 66 Standard_EXPORT BRepBuilderAPI_GTransform(const gp_GTrsf& T); 67 68 //! Constructs a framework for applying the geometric 69 //! transformation T to a shape, and applies it to the shape S. 70 //! - If the transformation T is direct and isometric (i.e. if 71 //! the determinant of the vectorial part of T is equal to 72 //! 1.), and if Copy equals false (default value), the 73 //! resulting shape is the same as the original but with 74 //! a new location assigned to it. 75 //! - In all other cases, the transformation is applied to 76 //! a duplicate of S. 77 //! Use the function Shape to access the result. 78 //! Note: the constructed framework can be reused to 79 //! apply the same geometric transformation to other 80 //! shapes: just specify them with the function Perform. 81 Standard_EXPORT BRepBuilderAPI_GTransform(const TopoDS_Shape& S, const gp_GTrsf& T, const Standard_Boolean Copy = Standard_False); 82 83 //! Applies the geometric transformation defined at the 84 //! time of construction of this framework to the shape S. 85 //! - If the transformation T is direct and isometric (i.e. if 86 //! the determinant of the vectorial part of T is equal to 87 //! 1.), and if Copy equals false (default value), the 88 //! resulting shape is the same as the original but with 89 //! a new location assigned to it. 90 //! - In all other cases, the transformation is applied to a duplicate of S. 91 //! Use the function Shape to access the result. 92 //! Note: this framework can be reused to apply the same 93 //! geometric transformation to other shapes: just specify 94 //! them by calling the function Perform again. 95 Standard_EXPORT void Perform (const TopoDS_Shape& S, const Standard_Boolean Copy = Standard_False); 96 97 //! Returns the list of shapes modified from the shape 98 //! <S>. 99 Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& S) Standard_OVERRIDE; 100 101 //! Returns the modified shape corresponding to <S>. 102 Standard_EXPORT virtual TopoDS_Shape ModifiedShape (const TopoDS_Shape& S) const Standard_OVERRIDE; 103 104 105 106 107 protected: 108 109 110 111 112 113 private: 114 115 116 117 gp_GTrsf myGTrsf; 118 BRepBuilderAPI_Collect myHist; 119 120 121 }; 122 123 124 125 126 127 128 129 #endif // _BRepBuilderAPI_GTransform_HeaderFile 130