Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-04 09:14:23

0001 // Created on: 1993-03-09
0002 // Created by: JCV
0003 // Copyright (c) 1993-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 _Geom_Axis2Placement_HeaderFile
0018 #define _Geom_Axis2Placement_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Geom_AxisPlacement.hxx>
0023 class gp_Ax2;
0024 class gp_Pnt;
0025 class gp_Trsf;
0026 class Geom_Geometry;
0027 
0028 //! Describes a right-handed coordinate system in 3D space.
0029 //! A coordinate system is defined by:
0030 //! - its origin, also termed the "Location point" of the coordinate system,
0031 //! - three orthogonal unit vectors, termed respectively
0032 //! the "X Direction", "Y Direction" and "Direction" (or
0033 //! "main Direction") of the coordinate system.
0034 //! As a Geom_Axis2Placement coordinate system is
0035 //! right-handed, its "Direction" is always equal to the
0036 //! cross product of its "X Direction" and "Y Direction".
0037 //! The "Direction" of a coordinate system is called the
0038 //! "main Direction" because when this unit vector is
0039 //! modified, the "X Direction" and "Y Direction" are
0040 //! recomputed, whereas when the "X Direction" or "Y
0041 //! Direction" is changed, the "main Direction" is
0042 //! retained. The "main Direction" is also the "Z Direction".
0043 //! Note: Geom_Axis2Placement coordinate systems
0044 //! provide the same kind of "geometric" services as
0045 //! gp_Ax2 coordinate systems but have more complex
0046 //! data structures. The geometric objects provided by
0047 //! the Geom package use gp_Ax2 objects to include
0048 //! coordinate systems in their data structures, or to
0049 //! define the geometric transformations, which are applied to them.
0050 //! Geom_Axis2Placement coordinate systems are
0051 //! used in a context where they can be shared by
0052 //! several objects contained inside a common data structure.
0053 class Geom_Axis2Placement : public Geom_AxisPlacement
0054 {
0055 
0056 public:
0057   //! Returns a transient copy of A2.
0058   Standard_EXPORT Geom_Axis2Placement(const gp_Ax2& A2);
0059 
0060   //! P is the origin of the axis placement, N is the main
0061   //! direction of the axis placement and Vx is the "XDirection".
0062   //! If the two directions N and Vx are not orthogonal the
0063   //! "XDirection" is computed as follow :
0064   //! XDirection = N ^ (Vx ^ N).
0065   //! Raised if N and Vx are parallel.
0066   Standard_EXPORT Geom_Axis2Placement(const gp_Pnt& P, const gp_Dir& N, const gp_Dir& Vx);
0067 
0068   //! Assigns the origin and the three unit vectors of A2 to
0069   //! this coordinate system.
0070   Standard_EXPORT void SetAx2(const gp_Ax2& A2);
0071 
0072   //! Changes the main direction of the axis placement.
0073   //! The "Xdirection" is modified :
0074   //! New XDirection = V ^ (Previous_Xdirection ^ V).
0075   //!
0076   //! Raised if V and the previous "XDirection" are parallel
0077   //! because it is impossible to calculate the new "XDirection"
0078   //! and the new "YDirection".
0079   Standard_EXPORT void SetDirection(const gp_Dir& V) override;
0080 
0081   //! Changes the "XDirection" of the axis placement, Vx is the
0082   //! new "XDirection". If Vx is not normal to the main direction
0083   //! then "XDirection" is computed as follow :
0084   //! XDirection = Direction ^ ( Vx ^ Direction).
0085   //! The main direction is not modified.
0086   //! Raised if Vx and "Direction" are parallel.
0087   Standard_EXPORT void SetXDirection(const gp_Dir& Vx);
0088 
0089   //! Changes the "YDirection" of the axis placement, Vy is the
0090   //! new "YDirection". If Vy is not normal to the main direction
0091   //! then "YDirection" is computed as follow :
0092   //! YDirection = Direction ^ ( Vy ^ Direction).
0093   //! The main direction is not modified. The "XDirection" is
0094   //! modified.
0095   //! Raised if Vy and the main direction are parallel.
0096   Standard_EXPORT void SetYDirection(const gp_Dir& Vy);
0097 
0098   //! Returns a non transient copy of <me>.
0099   Standard_EXPORT gp_Ax2 Ax2() const;
0100 
0101   //! Returns the "XDirection". This is a unit vector.
0102   Standard_EXPORT const gp_Dir& XDirection() const;
0103 
0104   //! Returns the "YDirection". This is a unit vector.
0105   Standard_EXPORT const gp_Dir& YDirection() const;
0106 
0107   //! Transforms an axis placement with a Trsf.
0108   //! The "Location" point, the "XDirection" and the
0109   //! "YDirection" are transformed with T. The resulting
0110   //! main "Direction" of <me> is the cross product between
0111   //! the "XDirection" and the "YDirection" after transformation.
0112   Standard_EXPORT void Transform(const gp_Trsf& T) override;
0113 
0114   //! Creates a new object which is a copy of this coordinate system.
0115   Standard_EXPORT occ::handle<Geom_Geometry> Copy() const override;
0116 
0117   DEFINE_STANDARD_RTTIEXT(Geom_Axis2Placement, Geom_AxisPlacement)
0118 
0119 private:
0120   Standard_EXPORT Geom_Axis2Placement(const gp_Pnt& P,
0121                                       const gp_Dir& Vz,
0122                                       const gp_Dir& Vx,
0123                                       const gp_Dir& Vy);
0124 
0125   gp_Dir vxdir;
0126   gp_Dir vydir;
0127 };
0128 
0129 #endif // _Geom_Axis2Placement_HeaderFile