1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

0024002: Overall code and build procedure refactoring -- automatic

Automatic upgrade of OCCT code by command "occt_upgrade . -nocdl":
- WOK-generated header files from inc and sources from drv are moved to src
- CDL files removed
- All packages are converted to nocdlpack
This commit is contained in:
abv
2015-07-12 07:42:38 +03:00
parent 543a996496
commit 42cf5bc1ca
15354 changed files with 623957 additions and 509844 deletions

View File

@@ -1,2 +1,113 @@
gp.cxx
gp.hxx
gp.lxx
gp_Ax1.cxx
gp_Ax1.hxx
gp_Ax1.lxx
gp_Ax2.cxx
gp_Ax2.hxx
gp_Ax2.lxx
gp_Ax2d.cxx
gp_Ax2d.hxx
gp_Ax2d.lxx
gp_Ax3.cxx
gp_Ax3.hxx
gp_Ax3.lxx
gp_Ax22d.cxx
gp_Ax22d.hxx
gp_Ax22d.lxx
gp_Circ.cxx
gp_Circ.hxx
gp_Circ.lxx
gp_Circ2d.cxx
gp_Circ2d.hxx
gp_Circ2d.lxx
gp_Cone.cxx
gp_Cone.hxx
gp_Cone.lxx
gp_Cylinder.cxx
gp_Cylinder.hxx
gp_Cylinder.lxx
gp_Dir.cxx
gp_Dir.hxx
gp_Dir.lxx
gp_Dir2d.cxx
gp_Dir2d.hxx
gp_Dir2d.lxx
gp_Elips.cxx
gp_Elips.hxx
gp_Elips.lxx
gp_Elips2d.cxx
gp_Elips2d.hxx
gp_Elips2d.lxx
gp_EulerSequence.hxx
gp_GTrsf.cxx
gp_GTrsf.hxx
gp_GTrsf.lxx
gp_GTrsf2d.cxx
gp_GTrsf2d.hxx
gp_GTrsf2d.lxx
gp_Hypr.cxx
gp_Hypr.hxx
gp_Hypr.lxx
gp_Hypr2d.cxx
gp_Hypr2d.hxx
gp_Hypr2d.lxx
gp_Lin.cxx
gp_Lin.hxx
gp_Lin.lxx
gp_Lin2d.cxx
gp_Lin2d.hxx
gp_Lin2d.lxx
gp_Mat.cxx
gp_Mat.hxx
gp_Mat.lxx
gp_Mat2d.cxx
gp_Mat2d.hxx
gp_Mat2d.lxx
gp_Parab.cxx
gp_Parab.hxx
gp_Parab.lxx
gp_Parab2d.cxx
gp_Parab2d.hxx
gp_Parab2d.lxx
gp_Pln.cxx
gp_Pln.hxx
gp_Pln.lxx
gp_Pnt.cxx
gp_Pnt.hxx
gp_Pnt.lxx
gp_Pnt2d.cxx
gp_Pnt2d.hxx
gp_Pnt2d.lxx
gp_Quaternion.cxx
gp_Quaternion.hxx
gp_Quaternion.lxx
gp_QuaternionNLerp.hxx
gp_QuaternionSLerp.hxx
gp_Sphere.cxx
gp_Sphere.hxx
gp_Sphere.lxx
gp_Torus.cxx
gp_Torus.hxx
gp_Torus.lxx
gp_Trsf.cxx
gp_Trsf.hxx
gp_Trsf.lxx
gp_Trsf2d.cxx
gp_Trsf2d.hxx
gp_Trsf2d.lxx
gp_TrsfForm.hxx
gp_Vec.cxx
gp_Vec.hxx
gp_Vec.lxx
gp_Vec2d.cxx
gp_Vec2d.hxx
gp_Vec2d.lxx
gp_VectorWithNullMagnitude.hxx
gp_XY.cxx
gp_XY.hxx
gp_XY.lxx
gp_XYZ.cxx
gp_XYZ.hxx
gp_XYZ.lxx

View File

@@ -1,270 +0,0 @@
-- Created on: 1993-04-13
-- Created by: JCV
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
package gp
--- Purpose :
-- The geometric processor package, called gp, provides an
-- implementation of entities used :
-- . for algebraic calculation such as "XYZ" coordinates, "Mat"
-- matrix
-- . for basis analytic geometry such as Transformations, point,
-- vector, line, plane, axis placement, conics, and elementary
-- surfaces.
-- These entities are defined in 2d and 3d space.
-- All the classes of this package are non-persistent.
uses Standard, TColStd
is
exception VectorWithNullMagnitude inherits DomainError;
enumeration TrsfForm is
Identity,
-- Transformation matrix is identity.
Rotation,
-- "Rotation" transformation was applied
Translation,
-- "Translation" with given vector or "from point - to point" was applied
PntMirror,
-- central symmetry
Ax1Mirror,
-- rotational symmetry
Ax2Mirror,
-- bilateral symmetry
Scale,
-- "Scale" transformation was applied
CompoundTrsf,
-- All cases which is not enumerated here
Other
-- Transformation with not-orthogonal matrix
end TrsfForm;
---Purpose: Identifies the type of a geometric transformation.
---Purpose: Enumerates all 24 possible variants of generalized
-- Euler angles, defining general 3d rotation by three
-- rotations around main axes of coordinate system,
-- in different possible orders.
-- The name of the enumeration
-- corresponds to order of rotations, prefixed by type
-- of co-ordinate system used:
-- - Intrinsic: rotations are made around axes of rotating
-- co-ordinate system associated with the object
-- - Extrinsic: rotations are made around axes of fixed
-- (reference) co-ordinate system
-- Two specific values provided for most frequently used
-- conventions: proper Euler angles (intrinsic ZXZ) and
-- yaw-pitch-roll (intrinsic ZYX).
enumeration EulerSequence is
EulerAngles, -- standard Euler angles, alias to Intrinsic_ZXZ
YawPitchRoll, -- Yaw Pitch Roll angles, alias to Intrinsic_ZYX
-- Tait-Bryan angles (using three different axes)
Extrinsic_XYZ,
Extrinsic_XZY,
Extrinsic_YZX,
Extrinsic_YXZ,
Extrinsic_ZXY,
Extrinsic_ZYX,
Intrinsic_XYZ,
Intrinsic_XZY,
Intrinsic_YZX,
Intrinsic_YXZ,
Intrinsic_ZXY,
Intrinsic_ZYX,
-- proper Euler angles (using two different axes, first and third the same)
Extrinsic_XYX,
Extrinsic_XZX,
Extrinsic_YZY,
Extrinsic_YXY,
Extrinsic_ZYZ,
Extrinsic_ZXZ,
Intrinsic_XYX,
Intrinsic_XZX,
Intrinsic_YZY,
Intrinsic_YXY,
Intrinsic_ZXZ,
Intrinsic_ZYZ
;
class XYZ;
class Mat;
class Quaternion;
class Trsf;
class GTrsf;
class Pnt;
class Vec;
class Dir;
class Ax1;
class Ax2;
class Ax3;
class Lin;
class Circ;
class Elips;
class Hypr;
class Parab;
class Pln;
class Cylinder;
class Sphere;
class Torus;
class Cone;
class XY;
class Mat2d;
class Trsf2d;
class GTrsf2d;
class Pnt2d;
class Vec2d;
class Dir2d;
class Ax2d;
class Ax22d;
class Lin2d;
class Circ2d;
class Elips2d;
class Hypr2d;
class Parab2d;
--- Purpose : Method of package gp
Resolution returns Real;
--- Purpose :
-- In geometric computations, defines the tolerance criterion
-- used to determine when two numbers can be considered equal.
-- Many class functions use this tolerance criterion, for
-- example, to avoid division by zero in geometric
-- computations. In the documentation, tolerance criterion is
-- always referred to as gp::Resolution().
---C++: inline
Origin returns Pnt from gp;
--- Purpose : Identifies a Cartesian point with coordinates X = Y = Z = 0.0.0
---C++: return const &
DX returns Dir from gp;
---Purpose: Returns a unit vector with the combination (1,0,0)
---C++: return const &
DY returns Dir from gp;
---Purpose: Returns a unit vector with the combination (0,1,0)
---C++: return const &
DZ returns Dir from gp;
---Purpose: Returns a unit vector with the combination (0,0,1)
---C++: return const &
OX returns Ax1 from gp;
--- Purpose :Identifies an axis where its origin is Origin
-- and its unit vector coordinates X = 1.0, Y = Z = 0.0
---C++: return const &
OY returns Ax1 from gp;
--- Purpose :Identifies an axis where its origin is Origin
-- and its unit vector coordinates Y = 1.0, X = Z = 0.0
---C++: return const &
OZ returns Ax1 from gp;
--- Purpose :Identifies an axis where its origin is Origin
-- and its unit vector coordinates Z = 1.0, Y = X = 0.0
---C++: return const &
XOY returns Ax2 from gp;
--- Purpose :Identifies a coordinate system where its origin is Origin,
-- and its "main Direction" and "X Direction" coordinates
-- Z = 1.0, X = Y =0.0 and X direction coordinates X = 1.0, Y = Z = 0.0
---C++: return const &
ZOX returns Ax2 from gp;
--- Purpose :Identifies a coordinate system where its origin is Origin,
-- and its "main Direction" and "X Direction" coordinates
-- Y = 1.0, X = Z =0.0 and X direction coordinates Z = 1.0, X = Y = 0.0
---C++: return const &
YOZ returns Ax2 from gp;
--- Purpose :Identifies a coordinate system where its origin is Origin,
-- and its "main Direction" and "X Direction" coordinates
-- X = 1.0, Z = Y =0.0 and X direction coordinates Y = 1.0, X = Z = 0.0
---C++: return const &
--- Purpose : In 2D space
Origin2d returns Pnt2d from gp;
--- Purpose : Identifies a Cartesian point with coordinates X = Y = 0.0
---C++: return const &
DX2d returns Dir2d from gp;
---Purpose: Returns a unit vector with the combinations (1,0)
---C++: return const &
DY2d returns Dir2d from gp;
---Purpose: Returns a unit vector with the combinations (0,1)
---C++: return const &
OX2d returns Ax2d from gp;
--- Purpose : Identifies an axis where its origin is Origin2d
-- and its unit vector coordinates are: X = 1.0, Y = 0.0
---C++: return const &
OY2d returns Ax2d from gp;
--- Purpose : Identifies an axis where its origin is Origin2d
-- and its unit vector coordinates are Y = 1.0, X = 0.0
---C++: return const &
end gp;

View File

@@ -12,13 +12,20 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gp.ixx>
#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax2d.hxx>
#include <gp_Dir.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
//=======================================================================
//function : Origin
//purpose :
//=======================================================================
const gp_Pnt& gp::Origin()
{
static gp_Pnt gp_Origin(0,0,0);

212
src/gp/gp.hxx Normal file
View File

@@ -0,0 +1,212 @@
// Created on: 1993-04-13
// Created by: JCV
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_HeaderFile
#define _gp_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
class gp_Pnt;
class gp_Dir;
class gp_Ax1;
class gp_Ax2;
class gp_Pnt2d;
class gp_Dir2d;
class gp_Ax2d;
class gp_XYZ;
class gp_Mat;
class gp_Quaternion;
class gp_Trsf;
class gp_GTrsf;
class gp_Pnt;
class gp_Vec;
class gp_Dir;
class gp_Ax1;
class gp_Ax2;
class gp_Ax3;
class gp_Lin;
class gp_Circ;
class gp_Elips;
class gp_Hypr;
class gp_Parab;
class gp_Pln;
class gp_Cylinder;
class gp_Sphere;
class gp_Torus;
class gp_Cone;
class gp_XY;
class gp_Mat2d;
class gp_Trsf2d;
class gp_GTrsf2d;
class gp_Pnt2d;
class gp_Vec2d;
class gp_Dir2d;
class gp_Ax2d;
class gp_Ax22d;
class gp_Lin2d;
class gp_Circ2d;
class gp_Elips2d;
class gp_Hypr2d;
class gp_Parab2d;
//! The geometric processor package, called gp, provides an
//! implementation of entities used :
//! . for algebraic calculation such as "XYZ" coordinates, "Mat"
//! matrix
//! . for basis analytic geometry such as Transformations, point,
//! vector, line, plane, axis placement, conics, and elementary
//! surfaces.
//! These entities are defined in 2d and 3d space.
//! All the classes of this package are non-persistent.
class gp
{
public:
DEFINE_STANDARD_ALLOC
//! Method of package gp
//!
//! In geometric computations, defines the tolerance criterion
//! used to determine when two numbers can be considered equal.
//! Many class functions use this tolerance criterion, for
//! example, to avoid division by zero in geometric
//! computations. In the documentation, tolerance criterion is
//! always referred to as gp::Resolution().
static Standard_Real Resolution();
//! Identifies a Cartesian point with coordinates X = Y = Z = 0.0.0
Standard_EXPORT static const gp_Pnt& Origin();
//! Returns a unit vector with the combination (1,0,0)
Standard_EXPORT static const gp_Dir& DX();
//! Returns a unit vector with the combination (0,1,0)
Standard_EXPORT static const gp_Dir& DY();
//! Returns a unit vector with the combination (0,0,1)
Standard_EXPORT static const gp_Dir& DZ();
//! Identifies an axis where its origin is Origin
//! and its unit vector coordinates X = 1.0, Y = Z = 0.0
Standard_EXPORT static const gp_Ax1& OX();
//! Identifies an axis where its origin is Origin
//! and its unit vector coordinates Y = 1.0, X = Z = 0.0
Standard_EXPORT static const gp_Ax1& OY();
//! Identifies an axis where its origin is Origin
//! and its unit vector coordinates Z = 1.0, Y = X = 0.0
Standard_EXPORT static const gp_Ax1& OZ();
//! Identifies a coordinate system where its origin is Origin,
//! and its "main Direction" and "X Direction" coordinates
//! Z = 1.0, X = Y =0.0 and X direction coordinates X = 1.0, Y = Z = 0.0
Standard_EXPORT static const gp_Ax2& XOY();
//! Identifies a coordinate system where its origin is Origin,
//! and its "main Direction" and "X Direction" coordinates
//! Y = 1.0, X = Z =0.0 and X direction coordinates Z = 1.0, X = Y = 0.0
Standard_EXPORT static const gp_Ax2& ZOX();
//! Identifies a coordinate system where its origin is Origin,
//! and its "main Direction" and "X Direction" coordinates
//! X = 1.0, Z = Y =0.0 and X direction coordinates Y = 1.0, X = Z = 0.0
//! In 2D space
Standard_EXPORT static const gp_Ax2& YOZ();
//! Identifies a Cartesian point with coordinates X = Y = 0.0
Standard_EXPORT static const gp_Pnt2d& Origin2d();
//! Returns a unit vector with the combinations (1,0)
Standard_EXPORT static const gp_Dir2d& DX2d();
//! Returns a unit vector with the combinations (0,1)
Standard_EXPORT static const gp_Dir2d& DY2d();
//! Identifies an axis where its origin is Origin2d
//! and its unit vector coordinates are: X = 1.0, Y = 0.0
Standard_EXPORT static const gp_Ax2d& OX2d();
//! Identifies an axis where its origin is Origin2d
//! and its unit vector coordinates are Y = 1.0, X = 0.0
Standard_EXPORT static const gp_Ax2d& OY2d();
protected:
private:
friend class gp_XYZ;
friend class gp_Mat;
friend class gp_Quaternion;
friend class gp_Trsf;
friend class gp_GTrsf;
friend class gp_Pnt;
friend class gp_Vec;
friend class gp_Dir;
friend class gp_Ax1;
friend class gp_Ax2;
friend class gp_Ax3;
friend class gp_Lin;
friend class gp_Circ;
friend class gp_Elips;
friend class gp_Hypr;
friend class gp_Parab;
friend class gp_Pln;
friend class gp_Cylinder;
friend class gp_Sphere;
friend class gp_Torus;
friend class gp_Cone;
friend class gp_XY;
friend class gp_Mat2d;
friend class gp_Trsf2d;
friend class gp_GTrsf2d;
friend class gp_Pnt2d;
friend class gp_Vec2d;
friend class gp_Dir2d;
friend class gp_Ax2d;
friend class gp_Ax22d;
friend class gp_Lin2d;
friend class gp_Circ2d;
friend class gp_Elips2d;
friend class gp_Hypr2d;
friend class gp_Parab2d;
};
#include <gp.lxx>
#endif // _gp_HeaderFile

View File

@@ -1,240 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Ax1 from gp
--- Purpose : Describes an axis in 3D space.
-- An axis is defined by:
-- - its origin (also referred to as its "Location point"), and
-- - its unit vector (referred to as its "Direction" or "main Direction").
-- An axis is used:
-- - to describe 3D geometric entities (for example, the
-- axis of a revolution entity). It serves the same purpose
-- as the STEP function "axis placement one axis", or
-- - to define geometric transformations (axis of
-- symmetry, axis of rotation, and so on).
-- For example, this entity can be used to locate a geometric entity
-- or to define a symmetry axis.
uses Ax2 from gp,
Dir from gp,
Pnt from gp,
Trsf from gp,
Vec from gp
is
Create returns Ax1;
---C++: inline
--- Purpose : Creates an axis object representing Z axis of
-- the reference co-ordinate system.
Create (P : Pnt; V : Dir) returns Ax1;
---C++: inline
--- Purpose :
-- P is the location point and V is the direction of <me>.
SetDirection (me : in out; V : Dir) is static;
---C++: inline
--- Purpose : Assigns V as the "Direction" of this axis.
SetLocation (me : in out; P : Pnt) is static;
---C++: inline
--- Purpose : Assigns P as the origin of this axis.
Direction (me) returns Dir is static;
---C++: inline
---C++: return const&
--- Purpose : Returns the direction of <me>.
Location(me) returns Pnt is static;
---C++: inline
---C++: return const&
--- Purpose : Returns the location point of <me>.
IsCoaxial (me; Other : Ax1; AngularTolerance, LinearTolerance : Real)
returns Boolean
is static;
--- Purpose :
-- Returns True if :
-- . the angle between <me> and <Other> is lower or equal
-- to <AngularTolerance> and
-- . the distance between <me>.Location() and <Other> is lower
-- or equal to <LinearTolerance> and
-- . the distance between <Other>.Location() and <me> is lower
-- or equal to LinearTolerance.
IsNormal (me; Other : Ax1; AngularTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose :
-- Returns True if the direction of the <me> and <Other>
-- are normal to each other.
-- That is, if the angle between the two axes is equal to Pi/2.
-- Note: the tolerance criterion is given by AngularTolerance..
IsOpposite (me; Other : Ax1; AngularTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose :
-- Returns True if the direction of <me> and <Other> are
-- parallel with opposite orientation. That is, if the angle
-- between the two axes is equal to Pi.
-- Note: the tolerance criterion is given by AngularTolerance.
IsParallel (me; Other : Ax1; AngularTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose :
-- Returns True if the direction of <me> and <Other> are
-- parallel with same orientation or opposite orientation. That
-- is, if the angle between the two axes is equal to 0 or Pi.
-- Note: the tolerance criterion is given by
-- AngularTolerance.
Angle (me; Other : Ax1) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the angular value, in radians, between <me>.Direction() and
-- <Other>.Direction(). Returns the angle between 0 and 2*PI
-- radians.
Reverse (me : in out) is static;
---C++: inline
--- Purpose : Reverses the unit vector of this axis.
-- and assigns the result to this axis.
Reversed (me) returns Ax1 is static;
---C++: inline
--- Purpose : Reverses the unit vector of this axis and creates a new one.
Mirror (me : in out; P : Pnt) is static;
--- Purpose :
-- Performs the symmetrical transformation of an axis
-- placement with respect to the point P which is the
-- center of the symmetry and assigns the result to this axis.
Mirrored (me; P : Pnt) returns Ax1 is static;
--- Purpose : Performs the symmetrical transformation of an axis
-- placement with respect to the point P which is the
-- center of the symmetry and creates a new axis.
Mirror (me : in out; A1 : Ax1) is static;
--- Purpose :
-- Performs the symmetrical transformation of an axis
-- placement with respect to an axis placement which
-- is the axis of the symmetry and assigns the result to this axis.
Mirrored (me; A1 : Ax1) returns Ax1 is static;
--- Purpose :
-- Performs the symmetrical transformation of an axis
-- placement with respect to an axis placement which
-- is the axis of the symmetry and creates a new axis.
Mirror (me : in out; A2 : Ax2) is static;
--- Purpose :
-- Performs the symmetrical transformation of an axis
-- placement with respect to a plane. The axis placement
-- <A2> locates the plane of the symmetry :
-- (Location, XDirection, YDirection) and assigns the result to this axis.
Mirrored (me; A2 : Ax2) returns Ax1 is static;
--- Purpose :
-- Performs the symmetrical transformation of an axis
-- placement with respect to a plane. The axis placement
-- <A2> locates the plane of the symmetry :
-- (Location, XDirection, YDirection) and creates a new axis.
Rotate (me : in out; A1 : Ax1; Ang : Real)
---C++: inline
---Purpose: Rotates this axis at an angle Ang (in radians) about the axis A1
-- and assigns the result to this axis.
is static;
Rotated (me; A1 : Ax1; Ang : Real) returns Ax1 is static;
---C++: inline
---Purpose: Rotates this axis at an angle Ang (in radians) about the axis A1
-- and creates a new one.
Scale (me : in out; P : Pnt; S : Real) is static;
---C++: inline
---Purpose:
-- Applies a scaling transformation to this axis with:
-- - scale factor S, and
-- - center P and assigns the result to this axis.
Scaled (me; P : Pnt; S : Real) returns Ax1 is static;
---C++: inline
---Purpose:
-- Applies a scaling transformation to this axis with:
-- - scale factor S, and
-- - center P and creates a new axis.
Transform (me : in out; T : Trsf)
---C++: inline
---Purpose: Applies the transformation T to this axis.
-- and assigns the result to this axis.
is static;
Transformed (me; T : Trsf) returns Ax1 is static;
---C++: inline
--- Purpose:
-- Applies the transformation T to this axis and creates a new one.
--- Purpose :
-- Translates an axis plaxement in the direction of the vector
-- <V>. The magnitude of the translation is the vector's magnitude.
Translate (me : in out; V : Vec)
---C++: inline
---Purpose:
-- Translates this axis by the vector V,
-- and assigns the result to this axis.
is static;
Translated (me; V : Vec) returns Ax1 is static;
---C++: inline
---Purpose:
-- Translates this axis by the vector V,
-- and creates a new one.
Translate (me : in out; P1, P2 : Pnt)
---C++: inline
---Purpose:
-- Translates this axis by:
-- the vector (P1, P2) defined from point P1 to point P2.
-- and assigns the result to this axis.
is static;
Translated (me; P1, P2 : Pnt) returns Ax1 is static;
---C++: inline
---Purpose:
-- Translates this axis by:
-- the vector (P1, P2) defined from point P1 to point P2.
-- and creates a new one.
fields
loc : Pnt;
vdir : Dir;
end;

View File

@@ -19,8 +19,14 @@
#define No_Standard_OutOfRange
#include <gp_Ax1.ixx>
#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
Standard_Boolean gp_Ax1::IsCoaxial
(const gp_Ax1& Other,

233
src/gp/gp_Ax1.hxx Normal file
View File

@@ -0,0 +1,233 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Ax1_HeaderFile
#define _gp_Ax1_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
class gp_Pnt;
class gp_Dir;
class gp_Ax2;
class gp_Trsf;
class gp_Vec;
//! Describes an axis in 3D space.
//! An axis is defined by:
//! - its origin (also referred to as its "Location point"), and
//! - its unit vector (referred to as its "Direction" or "main Direction").
//! An axis is used:
//! - to describe 3D geometric entities (for example, the
//! axis of a revolution entity). It serves the same purpose
//! as the STEP function "axis placement one axis", or
//! - to define geometric transformations (axis of
//! symmetry, axis of rotation, and so on).
//! For example, this entity can be used to locate a geometric entity
//! or to define a symmetry axis.
class gp_Ax1
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an axis object representing Z axis of
//! the reference co-ordinate system.
gp_Ax1();
//! P is the location point and V is the direction of <me>.
gp_Ax1(const gp_Pnt& P, const gp_Dir& V);
//! Assigns V as the "Direction" of this axis.
void SetDirection (const gp_Dir& V);
//! Assigns P as the origin of this axis.
void SetLocation (const gp_Pnt& P);
//! Returns the direction of <me>.
const gp_Dir& Direction() const;
//! Returns the location point of <me>.
const gp_Pnt& Location() const;
//! Returns True if :
//! . the angle between <me> and <Other> is lower or equal
//! to <AngularTolerance> and
//! . the distance between <me>.Location() and <Other> is lower
//! or equal to <LinearTolerance> and
//! . the distance between <Other>.Location() and <me> is lower
//! or equal to LinearTolerance.
Standard_EXPORT Standard_Boolean IsCoaxial (const gp_Ax1& Other, const Standard_Real AngularTolerance, const Standard_Real LinearTolerance) const;
//! Returns True if the direction of the <me> and <Other>
//! are normal to each other.
//! That is, if the angle between the two axes is equal to Pi/2.
//! Note: the tolerance criterion is given by AngularTolerance..
Standard_Boolean IsNormal (const gp_Ax1& Other, const Standard_Real AngularTolerance) const;
//! Returns True if the direction of <me> and <Other> are
//! parallel with opposite orientation. That is, if the angle
//! between the two axes is equal to Pi.
//! Note: the tolerance criterion is given by AngularTolerance.
Standard_Boolean IsOpposite (const gp_Ax1& Other, const Standard_Real AngularTolerance) const;
//! Returns True if the direction of <me> and <Other> are
//! parallel with same orientation or opposite orientation. That
//! is, if the angle between the two axes is equal to 0 or Pi.
//! Note: the tolerance criterion is given by
//! AngularTolerance.
Standard_Boolean IsParallel (const gp_Ax1& Other, const Standard_Real AngularTolerance) const;
//! Computes the angular value, in radians, between <me>.Direction() and
//! <Other>.Direction(). Returns the angle between 0 and 2*PI
//! radians.
Standard_Real Angle (const gp_Ax1& Other) const;
//! Reverses the unit vector of this axis.
//! and assigns the result to this axis.
void Reverse();
//! Reverses the unit vector of this axis and creates a new one.
gp_Ax1 Reversed() const;
//! Performs the symmetrical transformation of an axis
//! placement with respect to the point P which is the
//! center of the symmetry and assigns the result to this axis.
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of an axis
//! placement with respect to the point P which is the
//! center of the symmetry and creates a new axis.
Standard_EXPORT gp_Ax1 Mirrored (const gp_Pnt& P) const;
//! Performs the symmetrical transformation of an axis
//! placement with respect to an axis placement which
//! is the axis of the symmetry and assigns the result to this axis.
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of an axis
//! placement with respect to an axis placement which
//! is the axis of the symmetry and creates a new axis.
Standard_EXPORT gp_Ax1 Mirrored (const gp_Ax1& A1) const;
//! Performs the symmetrical transformation of an axis
//! placement with respect to a plane. The axis placement
//! <A2> locates the plane of the symmetry :
//! (Location, XDirection, YDirection) and assigns the result to this axis.
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of an axis
//! placement with respect to a plane. The axis placement
//! <A2> locates the plane of the symmetry :
//! (Location, XDirection, YDirection) and creates a new axis.
Standard_EXPORT gp_Ax1 Mirrored (const gp_Ax2& A2) const;
//! Rotates this axis at an angle Ang (in radians) about the axis A1
//! and assigns the result to this axis.
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates this axis at an angle Ang (in radians) about the axis A1
//! and creates a new one.
gp_Ax1 Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
//! Applies a scaling transformation to this axis with:
//! - scale factor S, and
//! - center P and assigns the result to this axis.
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Applies a scaling transformation to this axis with:
//! - scale factor S, and
//! - center P and creates a new axis.
gp_Ax1 Scaled (const gp_Pnt& P, const Standard_Real S) const;
//! Applies the transformation T to this axis.
//! and assigns the result to this axis.
void Transform (const gp_Trsf& T);
//! Applies the transformation T to this axis and creates a new one.
//!
//! Translates an axis plaxement in the direction of the vector
//! <V>. The magnitude of the translation is the vector's magnitude.
gp_Ax1 Transformed (const gp_Trsf& T) const;
//! Translates this axis by the vector V,
//! and assigns the result to this axis.
void Translate (const gp_Vec& V);
//! Translates this axis by the vector V,
//! and creates a new one.
gp_Ax1 Translated (const gp_Vec& V) const;
//! Translates this axis by:
//! the vector (P1, P2) defined from point P1 to point P2.
//! and assigns the result to this axis.
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates this axis by:
//! the vector (P1, P2) defined from point P1 to point P2.
//! and creates a new one.
gp_Ax1 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Pnt loc;
gp_Dir vdir;
};
#include <gp_Ax1.lxx>
#endif // _gp_Ax1_HeaderFile

View File

@@ -1,394 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Ax2 from gp
--- Purpose :
-- Describes a right-handed coordinate system in 3D space.
-- A coordinate system is defined by:
-- - its origin (also referred to as its "Location point"), and
-- - three orthogonal unit vectors, termed respectively the
-- "X Direction", the "Y Direction" and the "Direction" (also
-- referred to as the "main Direction").
-- The "Direction" of the coordinate system is called its
-- "main Direction" because whenever this unit vector is
-- modified, the "X Direction" and the "Y Direction" are
-- recomputed. However, when we modify either the "X
-- Direction" or the "Y Direction", "Direction" is not modified.
-- The "main Direction" is also the "Z Direction".
-- Since an Ax2 coordinate system is right-handed, its
-- "main Direction" is always equal to the cross product of
-- its "X Direction" and "Y Direction". (To define a
-- left-handed coordinate system, use gp_Ax3.)
-- A coordinate system is used:
-- - to describe geometric entities, in particular to position
-- them. The local coordinate system of a geometric
-- entity serves the same purpose as the STEP function
-- "axis placement two axes", or
-- - to define geometric transformations.
-- Note: we refer to the "X Axis", "Y Axis" and "Z Axis",
-- respectively, as to axes having:
-- - the origin of the coordinate system as their origin, and
-- - the unit vectors "X Direction", "Y Direction" and "main
-- Direction", respectively, as their unit vectors.
-- The "Z Axis" is also the "main Axis".
uses Ax1 from gp,
Dir from gp,
Pnt from gp,
Trsf from gp,
Vec from gp
raises ConstructionError from Standard
is
Create returns Ax2;
---C++:inline
--- Purpose : Creates an object corresponding to the reference
-- coordinate system (OXYZ).
Create (P : Pnt; N, Vx : Dir) returns Ax2
---C++:inline
--- Purpose :
-- Creates an axis placement with an origin P such that:
-- - N is the Direction, and
-- - the "X Direction" is normal to N, in the plane
-- defined by the vectors (N, Vx): "X
-- Direction" = (N ^ Vx) ^ N,
-- Exception: raises ConstructionError if N and Vx are parallel (same or opposite orientation).
raises ConstructionError;
Create (P : Pnt; V : Dir) returns Ax2;
--- Purpose :
-- Creates - a coordinate system with an origin P, where V
-- gives the "main Direction" (here, "X Direction" and "Y
-- Direction" are defined automatically).
SetAxis (me : in out; A1 : Ax1)
--- Purpose : Assigns the origin and "main Direction" of the axis A1 to
-- this coordinate system, then recomputes its "X Direction" and "Y Direction".
-- Note: The new "X Direction" is computed as follows:
-- new "X Direction" = V1 ^(previous "X Direction" ^ V)
-- where V is the "Direction" of A1.
-- Exceptions
-- Standard_ConstructionError if A1 is parallel to the "X
-- Direction" of this coordinate system.
raises ConstructionError
is static;
SetDirection (me : in out; V : Dir)
--- Purpose :
-- Changes the "main Direction" of this coordinate system,
-- then recomputes its "X Direction" and "Y Direction".
-- Note: the new "X Direction" is computed as follows:
-- new "X Direction" = V ^ (previous "X Direction" ^ V)
-- Exceptions
-- Standard_ConstructionError if V is parallel to the "X
-- Direction" of this coordinate system.
raises ConstructionError
is static;
SetLocation (me : in out; P : Pnt) is static;
--- Purpose :
-- Changes the "Location" point (origin) of <me>.
SetXDirection (me : in out; Vx : Dir)
--- Purpose :
-- Changes the "Xdirection" of <me>. The main direction
-- "Direction" is not modified, the "Ydirection" is modified.
-- If <Vx> is not normal to the main direction then <XDirection>
-- is computed as follows XDirection = Direction ^ (Vx ^ Direction).
-- Exceptions
-- Standard_ConstructionError if Vx or Vy is parallel to
-- the "main Direction" of this coordinate system.
raises ConstructionError
is static;
SetYDirection(me : in out; Vy : Dir)
--- Purpose :
-- Changes the "Ydirection" of <me>. The main direction is not
-- modified but the "Xdirection" is changed.
-- If <Vy> is not normal to the main direction then "YDirection"
-- is computed as follows
-- YDirection = Direction ^ (<Vy> ^ Direction).
-- Exceptions
-- Standard_ConstructionError if Vx or Vy is parallel to
-- the "main Direction" of this coordinate system.
raises ConstructionError
is static;
Angle (me; Other : Ax2) returns Real is static;
--- Purpose :
-- Computes the angular value, in radians, between the main direction of
-- <me> and the main direction of <Other>. Returns the angle
-- between 0 and PI in radians.
Axis (me) returns Ax1 is static;
---C++:inline
--- Purpose :
-- Returns the main axis of <me>. It is the "Location" point
-- and the main "Direction".
---C++: return const&
Direction (me) returns Dir is static;
---C++:inline
--- Purpose :
-- Returns the main direction of <me>.
---C++: return const&
Location (me) returns Pnt is static;
---C++:inline
--- Purpose :
-- Returns the "Location" point (origin) of <me>.
---C++: return const&
XDirection (me) returns Dir is static;
---C++:inline
--- Purpose :
-- Returns the "XDirection" of <me>.
---C++: return const&
YDirection(me) returns Dir is static;
---C++:inline
--- Purpose :
-- Returns the "YDirection" of <me>.
---C++: return const&
IsCoplanar (me; Other : Ax2; LinearTolerance, AngularTolerance : Real)
returns Boolean
is static;
-- Returns True if
-- - the "main Direction" of this coordinate system is parallel to:
-- - the "main Direction" of the coordinate system Other, or
-- - the Direction of axis A1, and
--
-- Note: the tolerance criterion for angular equality is given by AngularTolerance.
IsCoplanar (me; A1 : Ax1; LinearTolerance, AngularTolerance : Real)
returns Boolean
is static;
---C++:inline
--- Purpose :
-- Returns True if
-- . the distance between <me> and the "Location" point of A1
-- is lower of equal to LinearTolerance and
-- . the main direction of <me> and the direction of A1 are normal.
-- Note: the tolerance criterion for angular equality is given by AngularTolerance.
Mirror (me : in out; P : Pnt) is static;
---Purpose:
-- Performs a symmetrical transformation of this coordinate
-- system with respect to:
-- - the point P, and assigns the result to this coordinate system.
-- Warning
-- This transformation is always performed on the origin.
-- In case of a reflection with respect to a point:
-- - the main direction of the coordinate system is not changed, and
-- - the "X Direction" and the "Y Direction" are simply reversed
-- In case of a reflection with respect to an axis or a plane:
-- - the transformation is applied to the "X Direction"
-- and the "Y Direction", then
-- - the "main Direction" is recomputed as the cross
-- product "X Direction" ^ "Y Direction".
-- This maintains the right-handed property of the
-- coordinate system.
Mirrored (me; P : Pnt) returns Ax2 is static;
---Purpose:
-- Performs a symmetrical transformation of this coordinate
-- system with respect to:
-- - the point P, and creates a new one.
-- Warning
-- This transformation is always performed on the origin.
-- In case of a reflection with respect to a point:
-- - the main direction of the coordinate system is not changed, and
-- - the "X Direction" and the "Y Direction" are simply reversed
-- In case of a reflection with respect to an axis or a plane:
-- - the transformation is applied to the "X Direction"
-- and the "Y Direction", then
-- - the "main Direction" is recomputed as the cross
-- product "X Direction" ^ "Y Direction".
-- This maintains the right-handed property of the
-- coordinate system.
Mirror (me : in out; A1 : Ax1) is static;
---Purpose:
-- Performs a symmetrical transformation of this coordinate
-- system with respect to:
-- - the axis A1, and assigns the result to this coordinate systeme.
-- Warning
-- This transformation is always performed on the origin.
-- In case of a reflection with respect to a point:
-- - the main direction of the coordinate system is not changed, and
-- - the "X Direction" and the "Y Direction" are simply reversed
-- In case of a reflection with respect to an axis or a plane:
-- - the transformation is applied to the "X Direction"
-- and the "Y Direction", then
-- - the "main Direction" is recomputed as the cross
-- product "X Direction" ^ "Y Direction".
-- This maintains the right-handed property of the
-- coordinate system.
Mirrored (me; A1 : Ax1) returns Ax2 is static;
---Purpose:
-- Performs a symmetrical transformation of this coordinate
-- system with respect to:
-- - the axis A1, and creates a new one.
-- Warning
-- This transformation is always performed on the origin.
-- In case of a reflection with respect to a point:
-- - the main direction of the coordinate system is not changed, and
-- - the "X Direction" and the "Y Direction" are simply reversed
-- In case of a reflection with respect to an axis or a plane:
-- - the transformation is applied to the "X Direction"
-- and the "Y Direction", then
-- - the "main Direction" is recomputed as the cross
-- product "X Direction" ^ "Y Direction".
-- This maintains the right-handed property of the
-- coordinate system.
Mirror (me : in out; A2 : Ax2) is static;
---Purpose:
-- Performs a symmetrical transformation of this coordinate
-- system with respect to:
-- - the plane defined by the origin, "X Direction" and "Y
-- Direction" of coordinate system A2 and assigns the result to this coordinate systeme.
-- Warning
-- This transformation is always performed on the origin.
-- In case of a reflection with respect to a point:
-- - the main direction of the coordinate system is not changed, and
-- - the "X Direction" and the "Y Direction" are simply reversed
-- In case of a reflection with respect to an axis or a plane:
-- - the transformation is applied to the "X Direction"
-- and the "Y Direction", then
-- - the "main Direction" is recomputed as the cross
-- product "X Direction" ^ "Y Direction".
-- This maintains the right-handed property of the
-- coordinate system.
Mirrored (me; A2 : Ax2) returns Ax2 is static;
---Purpose:
-- Performs a symmetrical transformation of this coordinate
-- system with respect to:
-- - the plane defined by the origin, "X Direction" and "Y
-- Direction" of coordinate system A2 and creates a new one.
-- Warning
-- This transformation is always performed on the origin.
-- In case of a reflection with respect to a point:
-- - the main direction of the coordinate system is not changed, and
-- - the "X Direction" and the "Y Direction" are simply reversed
-- In case of a reflection with respect to an axis or a plane:
-- - the transformation is applied to the "X Direction"
-- and the "Y Direction", then
-- - the "main Direction" is recomputed as the cross
-- product "X Direction" ^ "Y Direction".
-- This maintains the right-handed property of the
-- coordinate system.
Rotate (me : in out; A1 : Ax1; Ang : Real) is static;
---C++:inline
Rotated (me; A1 : Ax1; Ang : Real) returns Ax2 is static;
---C++:inline
--- Purpose :
-- Rotates an axis placement. <A1> is the axis of the
-- rotation . Ang is the angular value of the rotation
-- in radians.
Scale (me : in out; P : Pnt; S : Real) is static;
---C++:inline
Scaled (me; P : Pnt; S : Real) returns Ax2 is static;
---C++:inline
--- Purpose :
-- Applies a scaling transformation on the axis placement.
-- The "Location" point of the axisplacement is modified.
--- Warnings :
-- If the scale <S> is negative :
-- . the main direction of the axis placement is not changed.
-- . The "XDirection" and the "YDirection" are reversed.
-- So the axis placement stay right handed.
Transform (me : in out; T : Trsf) is static;
---C++:inline
Transformed (me; T : Trsf) returns Ax2 is static;
---C++:inline
--- Purpose :
-- Transforms an axis placement with a Trsf.
-- The "Location" point, the "XDirection" and the
-- "YDirection" are transformed with T. The resulting
-- main "Direction" of <me> is the cross product between
-- the "XDirection" and the "YDirection" after transformation.
Translate (me : in out; V : Vec)
---C++:inline
is static;
Translated (me; V : Vec) returns Ax2 is static;
---C++:inline
--- Purpose :
-- Translates an axis plaxement in the direction of the vector
-- <V>. The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt)
---C++:inline
is static;
Translated (me; P1, P2 : Pnt) returns Ax2 is static;
---C++:inline
--- Purpose :
-- Translates an axis placement from the point <P1> to the
-- point <P2>.
fields
axis : Ax1;
vydir : Dir;
vxdir : Dir;
end;

View File

@@ -19,8 +19,15 @@
#define No_Standard_OutOfRange
#include <gp_Ax2.ixx>
#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
gp_Ax2::gp_Ax2 (const gp_Pnt& P, const gp_Dir& V) :
axis(P,V)

352
src/gp/gp_Ax2.hxx Normal file
View File

@@ -0,0 +1,352 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Ax2_HeaderFile
#define _gp_Ax2_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax1.hxx>
#include <gp_Dir.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
class Standard_ConstructionError;
class gp_Pnt;
class gp_Dir;
class gp_Ax1;
class gp_Trsf;
class gp_Vec;
//! Describes a right-handed coordinate system in 3D space.
//! A coordinate system is defined by:
//! - its origin (also referred to as its "Location point"), and
//! - three orthogonal unit vectors, termed respectively the
//! "X Direction", the "Y Direction" and the "Direction" (also
//! referred to as the "main Direction").
//! The "Direction" of the coordinate system is called its
//! "main Direction" because whenever this unit vector is
//! modified, the "X Direction" and the "Y Direction" are
//! recomputed. However, when we modify either the "X
//! Direction" or the "Y Direction", "Direction" is not modified.
//! The "main Direction" is also the "Z Direction".
//! Since an Ax2 coordinate system is right-handed, its
//! "main Direction" is always equal to the cross product of
//! its "X Direction" and "Y Direction". (To define a
//! left-handed coordinate system, use gp_Ax3.)
//! A coordinate system is used:
//! - to describe geometric entities, in particular to position
//! them. The local coordinate system of a geometric
//! entity serves the same purpose as the STEP function
//! "axis placement two axes", or
//! - to define geometric transformations.
//! Note: we refer to the "X Axis", "Y Axis" and "Z Axis",
//! respectively, as to axes having:
//! - the origin of the coordinate system as their origin, and
//! - the unit vectors "X Direction", "Y Direction" and "main
//! Direction", respectively, as their unit vectors.
//! The "Z Axis" is also the "main Axis".
class gp_Ax2
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an object corresponding to the reference
//! coordinate system (OXYZ).
gp_Ax2();
//! Creates an axis placement with an origin P such that:
//! - N is the Direction, and
//! - the "X Direction" is normal to N, in the plane
//! defined by the vectors (N, Vx): "X
//! Direction" = (N ^ Vx) ^ N,
//! Exception: raises ConstructionError if N and Vx are parallel (same or opposite orientation).
gp_Ax2(const gp_Pnt& P, const gp_Dir& N, const gp_Dir& Vx);
//! Creates - a coordinate system with an origin P, where V
//! gives the "main Direction" (here, "X Direction" and "Y
//! Direction" are defined automatically).
Standard_EXPORT gp_Ax2(const gp_Pnt& P, const gp_Dir& V);
//! Assigns the origin and "main Direction" of the axis A1 to
//! this coordinate system, then recomputes its "X Direction" and "Y Direction".
//! Note: The new "X Direction" is computed as follows:
//! new "X Direction" = V1 ^(previous "X Direction" ^ V)
//! where V is the "Direction" of A1.
//! Exceptions
//! Standard_ConstructionError if A1 is parallel to the "X
//! Direction" of this coordinate system.
Standard_EXPORT void SetAxis (const gp_Ax1& A1);
//! Changes the "main Direction" of this coordinate system,
//! then recomputes its "X Direction" and "Y Direction".
//! Note: the new "X Direction" is computed as follows:
//! new "X Direction" = V ^ (previous "X Direction" ^ V)
//! Exceptions
//! Standard_ConstructionError if V is parallel to the "X
//! Direction" of this coordinate system.
Standard_EXPORT void SetDirection (const gp_Dir& V);
//! Changes the "Location" point (origin) of <me>.
Standard_EXPORT void SetLocation (const gp_Pnt& P);
//! Changes the "Xdirection" of <me>. The main direction
//! "Direction" is not modified, the "Ydirection" is modified.
//! If <Vx> is not normal to the main direction then <XDirection>
//! is computed as follows XDirection = Direction ^ (Vx ^ Direction).
//! Exceptions
//! Standard_ConstructionError if Vx or Vy is parallel to
//! the "main Direction" of this coordinate system.
Standard_EXPORT void SetXDirection (const gp_Dir& Vx);
//! Changes the "Ydirection" of <me>. The main direction is not
//! modified but the "Xdirection" is changed.
//! If <Vy> is not normal to the main direction then "YDirection"
//! is computed as follows
//! YDirection = Direction ^ (<Vy> ^ Direction).
//! Exceptions
//! Standard_ConstructionError if Vx or Vy is parallel to
//! the "main Direction" of this coordinate system.
Standard_EXPORT void SetYDirection (const gp_Dir& Vy);
//! Computes the angular value, in radians, between the main direction of
//! <me> and the main direction of <Other>. Returns the angle
//! between 0 and PI in radians.
Standard_EXPORT Standard_Real Angle (const gp_Ax2& Other) const;
//! Returns the main axis of <me>. It is the "Location" point
//! and the main "Direction".
const gp_Ax1& Axis() const;
//! Returns the main direction of <me>.
const gp_Dir& Direction() const;
//! Returns the "Location" point (origin) of <me>.
const gp_Pnt& Location() const;
//! Returns the "XDirection" of <me>.
const gp_Dir& XDirection() const;
//! Returns the "YDirection" of <me>.
const gp_Dir& YDirection() const;
Standard_EXPORT Standard_Boolean IsCoplanar (const gp_Ax2& Other, const Standard_Real LinearTolerance, const Standard_Real AngularTolerance) const;
//! Returns True if
//! . the distance between <me> and the "Location" point of A1
//! is lower of equal to LinearTolerance and
//! . the main direction of <me> and the direction of A1 are normal.
//! Note: the tolerance criterion for angular equality is given by AngularTolerance.
Standard_Boolean IsCoplanar (const gp_Ax1& A1, const Standard_Real LinearTolerance, const Standard_Real AngularTolerance) const;
//! Performs a symmetrical transformation of this coordinate
//! system with respect to:
//! - the point P, and assigns the result to this coordinate system.
//! Warning
//! This transformation is always performed on the origin.
//! In case of a reflection with respect to a point:
//! - the main direction of the coordinate system is not changed, and
//! - the "X Direction" and the "Y Direction" are simply reversed
//! In case of a reflection with respect to an axis or a plane:
//! - the transformation is applied to the "X Direction"
//! and the "Y Direction", then
//! - the "main Direction" is recomputed as the cross
//! product "X Direction" ^ "Y Direction".
//! This maintains the right-handed property of the
//! coordinate system.
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs a symmetrical transformation of this coordinate
//! system with respect to:
//! - the point P, and creates a new one.
//! Warning
//! This transformation is always performed on the origin.
//! In case of a reflection with respect to a point:
//! - the main direction of the coordinate system is not changed, and
//! - the "X Direction" and the "Y Direction" are simply reversed
//! In case of a reflection with respect to an axis or a plane:
//! - the transformation is applied to the "X Direction"
//! and the "Y Direction", then
//! - the "main Direction" is recomputed as the cross
//! product "X Direction" ^ "Y Direction".
//! This maintains the right-handed property of the
//! coordinate system.
Standard_EXPORT gp_Ax2 Mirrored (const gp_Pnt& P) const;
//! Performs a symmetrical transformation of this coordinate
//! system with respect to:
//! - the axis A1, and assigns the result to this coordinate systeme.
//! Warning
//! This transformation is always performed on the origin.
//! In case of a reflection with respect to a point:
//! - the main direction of the coordinate system is not changed, and
//! - the "X Direction" and the "Y Direction" are simply reversed
//! In case of a reflection with respect to an axis or a plane:
//! - the transformation is applied to the "X Direction"
//! and the "Y Direction", then
//! - the "main Direction" is recomputed as the cross
//! product "X Direction" ^ "Y Direction".
//! This maintains the right-handed property of the
//! coordinate system.
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs a symmetrical transformation of this coordinate
//! system with respect to:
//! - the axis A1, and creates a new one.
//! Warning
//! This transformation is always performed on the origin.
//! In case of a reflection with respect to a point:
//! - the main direction of the coordinate system is not changed, and
//! - the "X Direction" and the "Y Direction" are simply reversed
//! In case of a reflection with respect to an axis or a plane:
//! - the transformation is applied to the "X Direction"
//! and the "Y Direction", then
//! - the "main Direction" is recomputed as the cross
//! product "X Direction" ^ "Y Direction".
//! This maintains the right-handed property of the
//! coordinate system.
Standard_EXPORT gp_Ax2 Mirrored (const gp_Ax1& A1) const;
//! Performs a symmetrical transformation of this coordinate
//! system with respect to:
//! - the plane defined by the origin, "X Direction" and "Y
//! Direction" of coordinate system A2 and assigns the result to this coordinate systeme.
//! Warning
//! This transformation is always performed on the origin.
//! In case of a reflection with respect to a point:
//! - the main direction of the coordinate system is not changed, and
//! - the "X Direction" and the "Y Direction" are simply reversed
//! In case of a reflection with respect to an axis or a plane:
//! - the transformation is applied to the "X Direction"
//! and the "Y Direction", then
//! - the "main Direction" is recomputed as the cross
//! product "X Direction" ^ "Y Direction".
//! This maintains the right-handed property of the
//! coordinate system.
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs a symmetrical transformation of this coordinate
//! system with respect to:
//! - the plane defined by the origin, "X Direction" and "Y
//! Direction" of coordinate system A2 and creates a new one.
//! Warning
//! This transformation is always performed on the origin.
//! In case of a reflection with respect to a point:
//! - the main direction of the coordinate system is not changed, and
//! - the "X Direction" and the "Y Direction" are simply reversed
//! In case of a reflection with respect to an axis or a plane:
//! - the transformation is applied to the "X Direction"
//! and the "Y Direction", then
//! - the "main Direction" is recomputed as the cross
//! product "X Direction" ^ "Y Direction".
//! This maintains the right-handed property of the
//! coordinate system.
Standard_EXPORT gp_Ax2 Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates an axis placement. <A1> is the axis of the
//! rotation . Ang is the angular value of the rotation
//! in radians.
gp_Ax2 Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Applies a scaling transformation on the axis placement.
//! The "Location" point of the axisplacement is modified.
//! Warnings :
//! If the scale <S> is negative :
//! . the main direction of the axis placement is not changed.
//! . The "XDirection" and the "YDirection" are reversed.
//! So the axis placement stay right handed.
gp_Ax2 Scaled (const gp_Pnt& P, const Standard_Real S) const;
void Transform (const gp_Trsf& T);
//! Transforms an axis placement with a Trsf.
//! The "Location" point, the "XDirection" and the
//! "YDirection" are transformed with T. The resulting
//! main "Direction" of <me> is the cross product between
//! the "XDirection" and the "YDirection" after transformation.
gp_Ax2 Transformed (const gp_Trsf& T) const;
void Translate (const gp_Vec& V);
//! Translates an axis plaxement in the direction of the vector
//! <V>. The magnitude of the translation is the vector's magnitude.
gp_Ax2 Translated (const gp_Vec& V) const;
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates an axis placement from the point <P1> to the
//! point <P2>.
gp_Ax2 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Ax1 axis;
gp_Dir vydir;
gp_Dir vxdir;
};
#include <gp_Ax2.lxx>
#endif // _gp_Ax2_HeaderFile

View File

@@ -1,270 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Ax22d from gp
--- Purpose :
-- Describes a coordinate system in a plane (2D space).
-- A coordinate system is defined by:
-- - its origin (also referred to as its "Location point"), and
-- - two orthogonal unit vectors, respectively, called the "X
-- Direction" and the "Y Direction".
-- A gp_Ax22d may be right-handed ("direct sense") or
-- left-handed ("inverse" or "indirect sense").
-- You use a gp_Ax22d to:
-- - describe 2D geometric entities, in particular to position
-- them. The local coordinate system of a geometric
-- entity serves for the same purpose as the STEP
-- function "axis placement two axes", or
-- - define geometric transformations.
-- Note: we refer to the "X Axis" and "Y Axis" as the axes having:
-- - the origin of the coordinate system as their origin, and
-- - the unit vectors "X Direction" and "Y Direction",
-- respectively, as their unit vectors.
uses Ax2d from gp,
Dir2d from gp,
Pnt2d from gp,
Trsf2d from gp,
Vec2d from gp
raises ConstructionError from Standard
is
Create returns Ax22d;
---C++:inline
--- Purpose : Creates an object representing the reference
-- co-ordinate system (OXY).
Create (P : Pnt2d; Vx, Vy : Dir2d) returns Ax22d
---C++:inline
--- Purpose :
-- Creates a coordinate system with origin P and where:
-- - Vx is the "X Direction", and
-- - the "Y Direction" is orthogonal to Vx and
-- oriented so that the cross products Vx^"Y
-- Direction" and Vx^Vy have the same sign.
-- Raises ConstructionError if Vx and Vy are parallel (same or opposite orientation).
raises ConstructionError;
Create (P : Pnt2d;
V : Dir2d;
Sense : Boolean from Standard = Standard_True) returns Ax22d;
---C++:inline
--- Purpose :
-- Creates - a coordinate system with origin P and "X Direction"
-- V, which is:
-- - right-handed if Sense is true (default value), or
-- - left-handed if Sense is false
Create (A : Ax2d;
Sense : Boolean from Standard = Standard_True) returns Ax22d;
---C++:inline
--- Purpose :
-- Creates - a coordinate system where its origin is the origin of
-- A and its "X Direction" is the unit vector of A, which is:
-- - right-handed if Sense is true (default value), or
-- - left-handed if Sense is false.
SetAxis (me : in out; A1 : Ax22d)
---C++:inline
--- Purpose :
-- Assigns the origin and the two unit vectors of the
-- coordinate system A1 to this coordinate system.
is static;
SetXAxis (me : in out; A1 : Ax2d)
---C++:inline
--- Purpose :
-- Changes the XAxis and YAxis ("Location" point and "Direction")
-- of <me>.
-- The "YDirection" is recomputed in the same sense as before.
is static;
SetYAxis (me : in out; A1 : Ax2d)
---C++:inline
--- Purpose : Changes the XAxis and YAxis ("Location" point and "Direction") of <me>.
-- The "XDirection" is recomputed in the same sense as before.
is static;
SetLocation (me : in out; P : Pnt2d) is static;
---C++:inline
--- Purpose :
-- Changes the "Location" point (origin) of <me>.
SetXDirection (me : in out; Vx : Dir2d)
---C++:inline
--- Purpose :
-- Assigns Vx to the "X Direction" of
-- this coordinate system. The other unit vector of this
-- coordinate system is recomputed, normal to Vx ,
-- without modifying the orientation (right-handed or
-- left-handed) of this coordinate system.
is static;
SetYDirection(me : in out; Vy : Dir2d)
---C++:inline
--- Purpose : Assignsr Vy to the "Y Direction" of
-- this coordinate system. The other unit vector of this
-- coordinate system is recomputed, normal to Vy,
-- without modifying the orientation (right-handed or
-- left-handed) of this coordinate system.
is static;
XAxis (me) returns Ax2d is static;
---C++:inline
--- Purpose : Returns an axis, for which
-- - the origin is that of this coordinate system, and
-- - the unit vector is either the "X Direction" of this coordinate system.
-- Note: the result is the "X Axis" of this coordinate system.
YAxis (me) returns Ax2d is static;
---C++:inline
--- Purpose : Returns an axis, for which
-- - the origin is that of this coordinate system, and
-- - the unit vector is either the "Y Direction" of this coordinate system.
-- Note: the result is the "Y Axis" of this coordinate system.
Location (me) returns Pnt2d is static;
---C++:inline
--- Purpose :
-- Returns the "Location" point (origin) of <me>.
---C++: return const&
XDirection (me) returns Dir2d is static;
---C++:inline
--- Purpose :
-- Returns the "XDirection" of <me>.
---C++: return const&
YDirection(me) returns Dir2d is static;
---C++:inline
--- Purpose :
-- Returns the "YDirection" of <me>.
---C++: return const&
Mirror (me : in out; P : Pnt2d) is static;
Mirrored (me; P : Pnt2d) returns Ax22d is static;
--- Purpose :
-- Performs the symmetrical transformation of an axis
-- placement with respect to the point P which is the
-- center of the symmetry.
--- Warnings :
-- The main direction of the axis placement is not changed.
-- The "XDirection" and the "YDirection" are reversed.
-- So the axis placement stay right handed.
Mirror (me : in out; A : Ax2d) is static;
Mirrored (me; A : Ax2d) returns Ax22d is static;
--- Purpose :
-- Performs the symmetrical transformation of an axis
-- placement with respect to an axis placement which
-- is the axis of the symmetry.
-- The transformation is performed on the "Location"
-- point, on the "XDirection" and "YDirection".
-- The resulting main "Direction" is the cross product between
-- the "XDirection" and the "YDirection" after transformation.
Rotate (me : in out; P : Pnt2d; Ang : Real) is static;
---C++:inline
Rotated (me; P : Pnt2d; Ang : Real) returns Ax22d is static;
---C++:inline
--- Purpose :
-- Rotates an axis placement. <A1> is the axis of the
-- rotation . Ang is the angular value of the rotation
-- in radians.
Scale (me : in out; P : Pnt2d; S : Real) is static;
---C++:inline
Scaled (me; P : Pnt2d; S : Real) returns Ax22d is static;
---C++:inline
--- Purpose :
-- Applies a scaling transformation on the axis placement.
-- The "Location" point of the axisplacement is modified.
--- Warnings :
-- If the scale <S> is negative :
-- . the main direction of the axis placement is not changed.
-- . The "XDirection" and the "YDirection" are reversed.
-- So the axis placement stay right handed.
Transform (me : in out; T : Trsf2d) is static;
---C++:inline
Transformed (me; T : Trsf2d) returns Ax22d is static;
---C++:inline
--- Purpose :
-- Transforms an axis placement with a Trsf.
-- The "Location" point, the "XDirection" and the
-- "YDirection" are transformed with T. The resulting
-- main "Direction" of <me> is the cross product between
-- the "XDirection" and the "YDirection" after transformation.
Translate (me : in out; V : Vec2d)
---C++:inline
is static;
Translated (me; V : Vec2d) returns Ax22d is static;
---C++:inline
--- Purpose :
-- Translates an axis plaxement in the direction of the vector
-- <V>. The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt2d)
---C++:inline
is static;
Translated (me; P1, P2 : Pnt2d) returns Ax22d is static;
---C++:inline
--- Purpose :
-- Translates an axis placement from the point <P1> to the
-- point <P2>.
fields
point : Pnt2d;
vydir : Dir2d;
vxdir : Dir2d;
end;

View File

@@ -17,7 +17,13 @@
// LPA, JCV 07/92 passage sur C1.
// JCV 07/92 Introduction de la method Dump
#include <gp_Ax22d.ixx>
#include <gp_Ax2d.hxx>
#include <gp_Ax22d.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <Standard_ConstructionError.hxx>
void gp_Ax22d::Mirror (const gp_Pnt2d& P)
{

240
src/gp/gp_Ax22d.hxx Normal file
View File

@@ -0,0 +1,240 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Ax22d_HeaderFile
#define _gp_Ax22d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Dir2d.hxx>
#include <Standard_Boolean.hxx>
#include <gp_Ax2d.hxx>
#include <Standard_Real.hxx>
class Standard_ConstructionError;
class gp_Pnt2d;
class gp_Dir2d;
class gp_Ax2d;
class gp_Trsf2d;
class gp_Vec2d;
//! Describes a coordinate system in a plane (2D space).
//! A coordinate system is defined by:
//! - its origin (also referred to as its "Location point"), and
//! - two orthogonal unit vectors, respectively, called the "X
//! Direction" and the "Y Direction".
//! A gp_Ax22d may be right-handed ("direct sense") or
//! left-handed ("inverse" or "indirect sense").
//! You use a gp_Ax22d to:
//! - describe 2D geometric entities, in particular to position
//! them. The local coordinate system of a geometric
//! entity serves for the same purpose as the STEP
//! function "axis placement two axes", or
//! - define geometric transformations.
//! Note: we refer to the "X Axis" and "Y Axis" as the axes having:
//! - the origin of the coordinate system as their origin, and
//! - the unit vectors "X Direction" and "Y Direction",
//! respectively, as their unit vectors.
class gp_Ax22d
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an object representing the reference
//! co-ordinate system (OXY).
gp_Ax22d();
//! Creates a coordinate system with origin P and where:
//! - Vx is the "X Direction", and
//! - the "Y Direction" is orthogonal to Vx and
//! oriented so that the cross products Vx^"Y
//! Direction" and Vx^Vy have the same sign.
//! Raises ConstructionError if Vx and Vy are parallel (same or opposite orientation).
gp_Ax22d(const gp_Pnt2d& P, const gp_Dir2d& Vx, const gp_Dir2d& Vy);
//! Creates - a coordinate system with origin P and "X Direction"
//! V, which is:
//! - right-handed if Sense is true (default value), or
//! - left-handed if Sense is false
gp_Ax22d(const gp_Pnt2d& P, const gp_Dir2d& V, const Standard_Boolean Sense = Standard_True);
//! Creates - a coordinate system where its origin is the origin of
//! A and its "X Direction" is the unit vector of A, which is:
//! - right-handed if Sense is true (default value), or
//! - left-handed if Sense is false.
gp_Ax22d(const gp_Ax2d& A, const Standard_Boolean Sense = Standard_True);
//! Assigns the origin and the two unit vectors of the
//! coordinate system A1 to this coordinate system.
void SetAxis (const gp_Ax22d& A1);
//! Changes the XAxis and YAxis ("Location" point and "Direction")
//! of <me>.
//! The "YDirection" is recomputed in the same sense as before.
void SetXAxis (const gp_Ax2d& A1);
//! Changes the XAxis and YAxis ("Location" point and "Direction") of <me>.
//! The "XDirection" is recomputed in the same sense as before.
void SetYAxis (const gp_Ax2d& A1);
//! Changes the "Location" point (origin) of <me>.
void SetLocation (const gp_Pnt2d& P);
//! Assigns Vx to the "X Direction" of
//! this coordinate system. The other unit vector of this
//! coordinate system is recomputed, normal to Vx ,
//! without modifying the orientation (right-handed or
//! left-handed) of this coordinate system.
void SetXDirection (const gp_Dir2d& Vx);
//! Assignsr Vy to the "Y Direction" of
//! this coordinate system. The other unit vector of this
//! coordinate system is recomputed, normal to Vy,
//! without modifying the orientation (right-handed or
//! left-handed) of this coordinate system.
void SetYDirection (const gp_Dir2d& Vy);
//! Returns an axis, for which
//! - the origin is that of this coordinate system, and
//! - the unit vector is either the "X Direction" of this coordinate system.
//! Note: the result is the "X Axis" of this coordinate system.
gp_Ax2d XAxis() const;
//! Returns an axis, for which
//! - the origin is that of this coordinate system, and
//! - the unit vector is either the "Y Direction" of this coordinate system.
//! Note: the result is the "Y Axis" of this coordinate system.
gp_Ax2d YAxis() const;
//! Returns the "Location" point (origin) of <me>.
const gp_Pnt2d& Location() const;
//! Returns the "XDirection" of <me>.
const gp_Dir2d& XDirection() const;
//! Returns the "YDirection" of <me>.
const gp_Dir2d& YDirection() const;
Standard_EXPORT void Mirror (const gp_Pnt2d& P);
//! Performs the symmetrical transformation of an axis
//! placement with respect to the point P which is the
//! center of the symmetry.
//! Warnings :
//! The main direction of the axis placement is not changed.
//! The "XDirection" and the "YDirection" are reversed.
//! So the axis placement stay right handed.
Standard_EXPORT gp_Ax22d Mirrored (const gp_Pnt2d& P) const;
Standard_EXPORT void Mirror (const gp_Ax2d& A);
//! Performs the symmetrical transformation of an axis
//! placement with respect to an axis placement which
//! is the axis of the symmetry.
//! The transformation is performed on the "Location"
//! point, on the "XDirection" and "YDirection".
//! The resulting main "Direction" is the cross product between
//! the "XDirection" and the "YDirection" after transformation.
Standard_EXPORT gp_Ax22d Mirrored (const gp_Ax2d& A) const;
void Rotate (const gp_Pnt2d& P, const Standard_Real Ang);
//! Rotates an axis placement. <A1> is the axis of the
//! rotation . Ang is the angular value of the rotation
//! in radians.
gp_Ax22d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
void Scale (const gp_Pnt2d& P, const Standard_Real S);
//! Applies a scaling transformation on the axis placement.
//! The "Location" point of the axisplacement is modified.
//! Warnings :
//! If the scale <S> is negative :
//! . the main direction of the axis placement is not changed.
//! . The "XDirection" and the "YDirection" are reversed.
//! So the axis placement stay right handed.
gp_Ax22d Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
void Transform (const gp_Trsf2d& T);
//! Transforms an axis placement with a Trsf.
//! The "Location" point, the "XDirection" and the
//! "YDirection" are transformed with T. The resulting
//! main "Direction" of <me> is the cross product between
//! the "XDirection" and the "YDirection" after transformation.
gp_Ax22d Transformed (const gp_Trsf2d& T) const;
void Translate (const gp_Vec2d& V);
//! Translates an axis plaxement in the direction of the vector
//! <V>. The magnitude of the translation is the vector's magnitude.
gp_Ax22d Translated (const gp_Vec2d& V) const;
void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2);
//! Translates an axis placement from the point <P1> to the
//! point <P2>.
gp_Ax22d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
protected:
private:
gp_Pnt2d point;
gp_Dir2d vydir;
gp_Dir2d vxdir;
};
#include <gp_Ax22d.lxx>
#endif // _gp_Ax22d_HeaderFile

View File

@@ -1,212 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Ax2d from gp
---Purpose:
-- Describes an axis in the plane (2D space).
-- An axis is defined by:
-- - its origin (also referred to as its "Location point"), and
-- - its unit vector (referred to as its "Direction").
-- An axis implicitly defines a direct, right-handed
-- coordinate system in 2D space by:
-- - its origin,
-- - its "Direction" (giving the "X Direction" of the coordinate system), and
-- - the unit vector normal to "Direction" (positive angle
-- measured in the trigonometric sense).
-- An axis is used:
-- - to describe 2D geometric entities (for example, the
-- axis which defines angular coordinates on a circle).
-- It serves for the same purpose as the STEP function
-- "axis placement one axis", or
-- - to define geometric transformations (axis of
-- symmetry, axis of rotation, and so on).
-- Note: to define a left-handed 2D coordinate system, use gp_Ax22d.
uses Dir2d, Pnt2d, Trsf2d, Vec2d
is
Create returns Ax2d;
---C++:inline
--- Purpose : Creates an axis object representing X axis of
-- the reference co-ordinate system.
Create (P : Pnt2d; V : Dir2d) returns Ax2d;
---C++:inline
--- Purpose :
-- Creates an Ax2d. <P> is the "Location" point of
-- the axis placement and V is the "Direction" of
-- the axis placement.
SetLocation (me : out; Locat : Pnt2d) is static;
---C++:inline
--- Purpose : Changes the "Location" point (origin) of <me>.
SetDirection (me : out; V : Dir2d) is static;
---C++:inline
--- Purpose : Changes the direction of <me>.
Location (me) returns Pnt2d is static;
---C++:inline
--- Purpose : Returns the origin of <me>.
---C++: return const&
Direction (me) returns Dir2d is static;
---C++:inline
--- Purpose : Returns the direction of <me>.
---C++: return const&
IsCoaxial (me; Other : Ax2d; AngularTolerance, LinearTolerance : Real)
returns Boolean
is static;
--- Purpose :
-- Returns True if :
-- . the angle between <me> and <Other> is lower or equal
-- to <AngularTolerance> and
-- . the distance between <me>.Location() and <Other> is lower
-- or equal to <LinearTolerance> and
-- . the distance between <Other>.Location() and <me> is lower
-- or equal to LinearTolerance.
IsNormal (me; Other : Ax2d; AngularTolerance : Real) returns Boolean
is static;
---C++:inline
--- Purpose : Returns true if this axis and the axis Other are normal to
-- each other. That is, if the angle between the two axes is equal to Pi/2 or -Pi/2.
-- Note: the tolerance criterion is given by AngularTolerance.
IsOpposite (me; Other : Ax2d; AngularTolerance : Real) returns Boolean
is static;
---C++:inline
--- Purpose : Returns true if this axis and the axis Other are parallel,
-- and have opposite orientations. That is, if the angle
-- between the two axes is equal to Pi or -Pi.
-- Note: the tolerance criterion is given by AngularTolerance.
IsParallel (me; Other : Ax2d; AngularTolerance : Real) returns Boolean
is static;
---C++:inline
--- Purpose : Returns true if this axis and the axis Other are parallel,
-- and have either the same or opposite orientations. That
-- is, if the angle between the two axes is equal to 0, Pi or -Pi.
-- Note: the tolerance criterion is given by AngularTolerance.
Angle (me; Other : Ax2d) returns Real is static;
---C++:inline
--- Purpose :
-- Computes the angle, in radians, between this axis and
-- the axis Other. The value of the angle is between -Pi and Pi.
Reverse (me : in out) is static;
---C++:inline
--- Purpose : Reverses the direction of <me> and assigns the result to this axis.
Reversed (me) returns Ax2d is static;
---C++:inline
--- Purpose :
-- Computes a new axis placement with a direction opposite to
-- the direction of <me>.
Mirror (me : in out; P : Pnt2d) is static;
Mirrored (me; P : Pnt2d) returns Ax2d is static;
--- Purpose :
-- Performs the symmetrical transformation of an axis
-- placement with respect to the point P which is the
-- center of the symmetry.
Mirror (me : in out; A : Ax2d) is static;
Mirrored (me; A : Ax2d) returns Ax2d is static;
--- Purpose :
-- Performs the symmetrical transformation of an axis
-- placement with respect to an axis placement which
-- is the axis of the symmetry.
Rotate (me : in out; P : Pnt2d; Ang : Real) is static;
---C++:inline
Rotated (me; P : Pnt2d; Ang : Real) returns Ax2d is static;
---C++:inline
--- Purpose :
-- Rotates an axis placement. <P> is the center of the
-- rotation . Ang is the angular value of the rotation
-- in radians.
Scale (me : in out; P : Pnt2d; S : Real) is static;
Scaled (me; P : Pnt2d; S : Real) returns Ax2d is static;
---C++:inline
--- Purpose :
-- Applies a scaling transformation on the axis placement.
-- The "Location" point of the axisplacement is modified.
-- The "Direction" is reversed if the scale is negative.
Transform (me : in out; T : Trsf2d) is static;
---C++:inline
Transformed(me; T : Trsf2d) returns Ax2d is static;
---C++:inline
--- Purpose : Transforms an axis placement with a Trsf.
Translate (me : in out; V : Vec2d) is static;
---C++:inline
Translated (me; V : Vec2d) returns Ax2d is static;
---C++:inline
--- Purpose :
-- Translates an axis placement in the direction of the vector
-- <V>. The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt2d) is static;
---C++:inline
Translated (me; P1, P2 : Pnt2d) returns Ax2d is static;
---C++:inline
--- Purpose :
-- Translates an axis placement from the point <P1> to the
-- point <P2>.
fields
loc : Pnt2d;
vdir : Dir2d;
end;

View File

@@ -18,7 +18,12 @@
#define No_Standard_OutOfRange
#include <gp_Ax2d.ixx>
#include <gp_Ax2d.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <gp_XY.hxx>
Standard_Boolean gp_Ax2d::IsCoaxial (const gp_Ax2d& Other,

197
src/gp/gp_Ax2d.hxx Normal file
View File

@@ -0,0 +1,197 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Ax2d_HeaderFile
#define _gp_Ax2d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Dir2d.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
class gp_Pnt2d;
class gp_Dir2d;
class gp_Trsf2d;
class gp_Vec2d;
//! Describes an axis in the plane (2D space).
//! An axis is defined by:
//! - its origin (also referred to as its "Location point"), and
//! - its unit vector (referred to as its "Direction").
//! An axis implicitly defines a direct, right-handed
//! coordinate system in 2D space by:
//! - its origin,
//! - its "Direction" (giving the "X Direction" of the coordinate system), and
//! - the unit vector normal to "Direction" (positive angle
//! measured in the trigonometric sense).
//! An axis is used:
//! - to describe 2D geometric entities (for example, the
//! axis which defines angular coordinates on a circle).
//! It serves for the same purpose as the STEP function
//! "axis placement one axis", or
//! - to define geometric transformations (axis of
//! symmetry, axis of rotation, and so on).
//! Note: to define a left-handed 2D coordinate system, use gp_Ax22d.
class gp_Ax2d
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an axis object representing X axis of
//! the reference co-ordinate system.
gp_Ax2d();
//! Creates an Ax2d. <P> is the "Location" point of
//! the axis placement and V is the "Direction" of
//! the axis placement.
gp_Ax2d(const gp_Pnt2d& P, const gp_Dir2d& V);
//! Changes the "Location" point (origin) of <me>.
void SetLocation (const gp_Pnt2d& Locat);
//! Changes the direction of <me>.
void SetDirection (const gp_Dir2d& V);
//! Returns the origin of <me>.
const gp_Pnt2d& Location() const;
//! Returns the direction of <me>.
const gp_Dir2d& Direction() const;
//! Returns True if :
//! . the angle between <me> and <Other> is lower or equal
//! to <AngularTolerance> and
//! . the distance between <me>.Location() and <Other> is lower
//! or equal to <LinearTolerance> and
//! . the distance between <Other>.Location() and <me> is lower
//! or equal to LinearTolerance.
Standard_EXPORT Standard_Boolean IsCoaxial (const gp_Ax2d& Other, const Standard_Real AngularTolerance, const Standard_Real LinearTolerance) const;
//! Returns true if this axis and the axis Other are normal to
//! each other. That is, if the angle between the two axes is equal to Pi/2 or -Pi/2.
//! Note: the tolerance criterion is given by AngularTolerance.
Standard_Boolean IsNormal (const gp_Ax2d& Other, const Standard_Real AngularTolerance) const;
//! Returns true if this axis and the axis Other are parallel,
//! and have opposite orientations. That is, if the angle
//! between the two axes is equal to Pi or -Pi.
//! Note: the tolerance criterion is given by AngularTolerance.
Standard_Boolean IsOpposite (const gp_Ax2d& Other, const Standard_Real AngularTolerance) const;
//! Returns true if this axis and the axis Other are parallel,
//! and have either the same or opposite orientations. That
//! is, if the angle between the two axes is equal to 0, Pi or -Pi.
//! Note: the tolerance criterion is given by AngularTolerance.
Standard_Boolean IsParallel (const gp_Ax2d& Other, const Standard_Real AngularTolerance) const;
//! Computes the angle, in radians, between this axis and
//! the axis Other. The value of the angle is between -Pi and Pi.
Standard_Real Angle (const gp_Ax2d& Other) const;
//! Reverses the direction of <me> and assigns the result to this axis.
void Reverse();
//! Computes a new axis placement with a direction opposite to
//! the direction of <me>.
gp_Ax2d Reversed() const;
Standard_EXPORT void Mirror (const gp_Pnt2d& P);
//! Performs the symmetrical transformation of an axis
//! placement with respect to the point P which is the
//! center of the symmetry.
Standard_EXPORT gp_Ax2d Mirrored (const gp_Pnt2d& P) const;
Standard_EXPORT void Mirror (const gp_Ax2d& A);
//! Performs the symmetrical transformation of an axis
//! placement with respect to an axis placement which
//! is the axis of the symmetry.
Standard_EXPORT gp_Ax2d Mirrored (const gp_Ax2d& A) const;
void Rotate (const gp_Pnt2d& P, const Standard_Real Ang);
//! Rotates an axis placement. <P> is the center of the
//! rotation . Ang is the angular value of the rotation
//! in radians.
gp_Ax2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
Standard_EXPORT void Scale (const gp_Pnt2d& P, const Standard_Real S);
//! Applies a scaling transformation on the axis placement.
//! The "Location" point of the axisplacement is modified.
//! The "Direction" is reversed if the scale is negative.
gp_Ax2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
void Transform (const gp_Trsf2d& T);
//! Transforms an axis placement with a Trsf.
gp_Ax2d Transformed (const gp_Trsf2d& T) const;
void Translate (const gp_Vec2d& V);
//! Translates an axis placement in the direction of the vector
//! <V>. The magnitude of the translation is the vector's magnitude.
gp_Ax2d Translated (const gp_Vec2d& V) const;
void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2);
//! Translates an axis placement from the point <P1> to the
//! point <P2>.
gp_Ax2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
protected:
private:
gp_Pnt2d loc;
gp_Dir2d vdir;
};
#include <gp_Ax2d.lxx>
#endif // _gp_Ax2d_HeaderFile

View File

@@ -1,349 +0,0 @@
-- Created on: 1993-08-02
-- Created by: Laurent BOURESCHE
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Ax3 from gp
--- Purpose : Describes a coordinate system in 3D space. Unlike a
-- gp_Ax2 coordinate system, a gp_Ax3 can be
-- right-handed ("direct sense") or left-handed ("indirect sense").
-- A coordinate system is defined by:
-- - its origin (also referred to as its "Location point"), and
-- - three orthogonal unit vectors, termed the "X
-- Direction", the "Y Direction" and the "Direction" (also
-- referred to as the "main Direction").
-- The "Direction" of the coordinate system is called its
-- "main Direction" because whenever this unit vector is
-- modified, the "X Direction" and the "Y Direction" are
-- recomputed. However, when we modify either the "X
-- Direction" or the "Y Direction", "Direction" is not modified.
-- "Direction" is also the "Z Direction".
-- The "main Direction" is always parallel to the cross
-- product of its "X Direction" and "Y Direction".
-- If the coordinate system is right-handed, it satisfies the equation:
-- "main Direction" = "X Direction" ^ "Y Direction"
-- and if it is left-handed, it satisfies the equation:
-- "main Direction" = -"X Direction" ^ "Y Direction"
-- A coordinate system is used:
-- - to describe geometric entities, in particular to position
-- them. The local coordinate system of a geometric
-- entity serves the same purpose as the STEP function
-- "axis placement three axes", or
-- - to define geometric transformations.
-- Note:
-- - We refer to the "X Axis", "Y Axis" and "Z Axis",
-- respectively, as the axes having:
-- - the origin of the coordinate system as their origin, and
-- - the unit vectors "X Direction", "Y Direction" and
-- "main Direction", respectively, as their unit vectors.
-- - The "Z Axis" is also the "main Axis".
-- - gp_Ax2 is used to define a coordinate system that must be always right-handed.
uses Ax1 from gp,
Ax2 from gp,
Dir from gp,
Pnt from gp,
Trsf from gp,
Vec from gp
raises ConstructionError from Standard
is
Create returns Ax3 from gp;
--- Purpose : Creates an object corresponding to the reference
-- coordinate system (OXYZ).
Create (A : Ax2 from gp) returns Ax3 from gp;
---Purpose: Creates a coordinate system from a right-handed
-- coordinate system.
Create (P : Pnt from gp; N, Vx : Dir from gp) returns Ax3 from gp
--- Purpose : Creates a right handed axis placement with the
-- "Location" point P and two directions, N gives the
-- "Direction" and Vx gives the "XDirection".
-- Raises ConstructionError if N and Vx are parallel (same or opposite orientation).
raises ConstructionError;
Create (P : Pnt from gp; V : Dir from gp) returns Ax3 from gp;
--- Purpose :
-- Creates an axis placement with the "Location" point <P>
-- and the normal direction <V>.
XReverse(me : in out)
---Purpose: Reverses the X direction of <me>.
is static;
YReverse(me : in out)
---Purpose: Reverses the Y direction of <me>.
is static;
ZReverse(me : in out)
---Purpose: Reverses the Z direction of <me>.
is static;
SetAxis (me : in out; A1 : Ax1)
--- Purpose : Assigns the origin and "main Direction" of the axis A1 to
-- this coordinate system, then recomputes its "X Direction" and "Y Direction".
-- Note:
-- - The new "X Direction" is computed as follows:
-- new "X Direction" = V1 ^(previous "X Direction" ^ V)
-- where V is the "Direction" of A1.
-- - The orientation of this coordinate system
-- (right-handed or left-handed) is not modified.
-- Raises ConstructionError if the "Direction" of <A1> and the "XDirection" of <me>
-- are parallel (same or opposite orientation) because it is
-- impossible to calculate the new "XDirection" and the new
-- "YDirection".
raises ConstructionError
is static;
SetDirection (me : in out; V : Dir)
--- Purpose :
-- Changes the main direction of this coordinate system,
-- then recomputes its "X Direction" and "Y Direction".
-- Note:
-- - The new "X Direction" is computed as follows:
-- new "X Direction" = V ^ (previous "X Direction" ^ V).
-- - The orientation of this coordinate system (left- or right-handed) is not modified.
-- Raises ConstructionError if <V< and the previous "XDirection" are parallel
-- because it is impossible to calculate the new "XDirection"
-- and the new "YDirection".
raises ConstructionError
is static;
SetLocation (me : in out; P : Pnt) is static;
--- Purpose :
-- Changes the "Location" point (origin) of <me>.
SetXDirection (me : in out; Vx : Dir)
--- Purpose :
-- Changes the "Xdirection" of <me>. The main direction
-- "Direction" is not modified, the "Ydirection" is modified.
-- If <Vx> is not normal to the main direction then <XDirection>
-- is computed as follows XDirection = Direction ^ (Vx ^ Direction).
-- Raises ConstructionError if <Vx> is parallel (same or opposite
-- orientation) to the main direction of <me>
raises ConstructionError
is static;
SetYDirection(me : in out; Vy : Dir)
---C++:inline
--- Purpose :
-- Changes the "Ydirection" of <me>. The main direction is not
-- modified but the "Xdirection" is changed.
-- If <Vy> is not normal to the main direction then "YDirection"
-- is computed as follows
-- YDirection = Direction ^ (<Vy> ^ Direction).
-- Raises ConstructionError if <Vy> is parallel to the main direction of <me>
raises ConstructionError
is static;
Angle (me; Other : Ax3) returns Real is static;
---C++:inline
--- Purpose :
-- Computes the angular value between the main direction of
-- <me> and the main direction of <Other>. Returns the angle
-- between 0 and PI in radians.
Axis (me) returns Ax1 is static;
---C++:inline
--- Purpose :
-- Returns the main axis of <me>. It is the "Location" point
-- and the main "Direction".
---C++: return const&
Ax2 (me) returns Ax2 from gp
---Purpose: Computes a right-handed coordinate system with the
-- same "X Direction" and "Y Direction" as those of this
-- coordinate system, then recomputes the "main Direction".
-- If this coordinate system is right-handed, the result
-- returned is the same coordinate system. If this
-- coordinate system is left-handed, the result is reversed.
is static;
Direction (me) returns Dir is static;
---C++:inline
--- Purpose :
-- Returns the main direction of <me>.
---C++: return const&
Location (me) returns Pnt is static;
---C++:inline
--- Purpose :
-- Returns the "Location" point (origin) of <me>.
---C++: return const&
XDirection (me) returns Dir is static;
---C++:inline
--- Purpose :
-- Returns the "XDirection" of <me>.
---C++: return const&
YDirection(me) returns Dir is static;
---C++:inline
--- Purpose :
-- Returns the "YDirection" of <me>.
---C++: return const&
Direct(me) returns Boolean
---C++:inline
---Purpose: Returns True if the coordinate system is right-handed. i.e.
-- XDirection().Crossed(YDirection()).Dot(Direction()) > 0
is static;
IsCoplanar (me; Other : Ax3; LinearTolerance, AngularTolerance : Real)
returns Boolean
is static;
---C++:inline
--- Purpose :
-- Returns True if
-- . the distance between the "Location" point of <me> and
-- <Other> is lower or equal to LinearTolerance and
-- . the distance between the "Location" point of <Other> and
-- <me> is lower or equal to LinearTolerance and
-- . the main direction of <me> and the main direction of
-- <Other> are parallel (same or opposite orientation).
IsCoplanar (me; A1 : Ax1; LinearTolerance, AngularTolerance : Real)
returns Boolean
is static;
---C++:inline
--- Purpose : Returns True if
-- . the distance between <me> and the "Location" point of A1
-- is lower of equal to LinearTolerance and
-- . the distance between A1 and the "Location" point of <me>
-- is lower or equal to LinearTolerance and
-- . the main direction of <me> and the direction of A1 are normal.
Mirror (me : in out; P : Pnt) is static;
Mirrored (me; P : Pnt) returns Ax3 is static;
--- Purpose :
-- Performs the symmetrical transformation of an axis
-- placement with respect to the point P which is the
-- center of the symmetry.
-- Warnings :
-- The main direction of the axis placement is not changed.
-- The "XDirection" and the "YDirection" are reversed.
-- So the axis placement stay right handed.
Mirror (me : in out; A1 : Ax1) is static;
Mirrored (me; A1 : Ax1) returns Ax3 is static;
--- Purpose :
-- Performs the symmetrical transformation of an axis
-- placement with respect to an axis placement which
-- is the axis of the symmetry.
-- The transformation is performed on the "Location"
-- point, on the "XDirection" and "YDirection".
-- The resulting main "Direction" is the cross product between
-- the "XDirection" and the "YDirection" after transformation.
Mirror (me : in out; A2 : Ax2) is static;
Mirrored (me; A2 : Ax2) returns Ax3 is static;
--- Purpose :
-- Performs the symmetrical transformation of an axis
-- placement with respect to a plane.
-- The axis placement <A2> locates the plane of the symmetry :
-- (Location, XDirection, YDirection).
-- The transformation is performed on the "Location"
-- point, on the "XDirection" and "YDirection".
-- The resulting main "Direction" is the cross product between
-- the "XDirection" and the "YDirection" after transformation.
Rotate (me : in out; A1 : Ax1; Ang : Real) is static;
Rotated (me; A1 : Ax1; Ang : Real) returns Ax3 is static;
--- Purpose :
-- Rotates an axis placement. <A1> is the axis of the
-- rotation . Ang is the angular value of the rotation
-- in radians.
Scale (me : in out; P : Pnt; S : Real) is static;
Scaled (me; P : Pnt; S : Real) returns Ax3 is static;
--- Purpose :
-- Applies a scaling transformation on the axis placement.
-- The "Location" point of the axisplacement is modified.
-- Warnings :
-- If the scale <S> is negative :
-- . the main direction of the axis placement is not changed.
-- . The "XDirection" and the "YDirection" are reversed.
-- So the axis placement stay right handed.
Transform (me : in out; T : Trsf) is static;
Transformed (me; T : Trsf) returns Ax3 is static;
--- Purpose :
-- Transforms an axis placement with a Trsf.
-- The "Location" point, the "XDirection" and the
-- "YDirection" are transformed with T. The resulting
-- main "Direction" of <me> is the cross product between
-- the "XDirection" and the "YDirection" after transformation.
Translate (me : in out; V : Vec) is static;
Translated (me; V : Vec) returns Ax3 is static;
--- Purpose :
-- Translates an axis plaxement in the direction of the vector
-- <V>. The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt) is static;
Translated (me; P1, P2 : Pnt) returns Ax3 is static;
--- Purpose :
-- Translates an axis placement from the point <P1> to the
-- point <P2>.
fields
axis : Ax1 from gp;
vydir : Dir from gp;
vxdir : Dir from gp;
end;

View File

@@ -14,13 +14,20 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gp_Ax3.ixx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
//=======================================================================
//function : gp_Ax3
//purpose :
//=======================================================================
gp_Ax3::gp_Ax3 (const gp_Pnt& P,
const gp_Dir& V) : axis(P,V)
{

319
src/gp/gp_Ax3.hxx Normal file
View File

@@ -0,0 +1,319 @@
// Created on: 1993-08-02
// Created by: Laurent BOURESCHE
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Ax3_HeaderFile
#define _gp_Ax3_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax1.hxx>
#include <gp_Dir.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
class Standard_ConstructionError;
class gp_Ax2;
class gp_Pnt;
class gp_Dir;
class gp_Ax1;
class gp_Trsf;
class gp_Vec;
//! Describes a coordinate system in 3D space. Unlike a
//! gp_Ax2 coordinate system, a gp_Ax3 can be
//! right-handed ("direct sense") or left-handed ("indirect sense").
//! A coordinate system is defined by:
//! - its origin (also referred to as its "Location point"), and
//! - three orthogonal unit vectors, termed the "X
//! Direction", the "Y Direction" and the "Direction" (also
//! referred to as the "main Direction").
//! The "Direction" of the coordinate system is called its
//! "main Direction" because whenever this unit vector is
//! modified, the "X Direction" and the "Y Direction" are
//! recomputed. However, when we modify either the "X
//! Direction" or the "Y Direction", "Direction" is not modified.
//! "Direction" is also the "Z Direction".
//! The "main Direction" is always parallel to the cross
//! product of its "X Direction" and "Y Direction".
//! If the coordinate system is right-handed, it satisfies the equation:
//! "main Direction" = "X Direction" ^ "Y Direction"
//! and if it is left-handed, it satisfies the equation:
//! "main Direction" = -"X Direction" ^ "Y Direction"
//! A coordinate system is used:
//! - to describe geometric entities, in particular to position
//! them. The local coordinate system of a geometric
//! entity serves the same purpose as the STEP function
//! "axis placement three axes", or
//! - to define geometric transformations.
//! Note:
//! - We refer to the "X Axis", "Y Axis" and "Z Axis",
//! respectively, as the axes having:
//! - the origin of the coordinate system as their origin, and
//! - the unit vectors "X Direction", "Y Direction" and
//! "main Direction", respectively, as their unit vectors.
//! - The "Z Axis" is also the "main Axis".
//! - gp_Ax2 is used to define a coordinate system that must be always right-handed.
class gp_Ax3
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an object corresponding to the reference
//! coordinate system (OXYZ).
Standard_EXPORT gp_Ax3();
//! Creates a coordinate system from a right-handed
//! coordinate system.
Standard_EXPORT gp_Ax3(const gp_Ax2& A);
//! Creates a right handed axis placement with the
//! "Location" point P and two directions, N gives the
//! "Direction" and Vx gives the "XDirection".
//! Raises ConstructionError if N and Vx are parallel (same or opposite orientation).
Standard_EXPORT gp_Ax3(const gp_Pnt& P, const gp_Dir& N, const gp_Dir& Vx);
//! Creates an axis placement with the "Location" point <P>
//! and the normal direction <V>.
Standard_EXPORT gp_Ax3(const gp_Pnt& P, const gp_Dir& V);
//! Reverses the X direction of <me>.
Standard_EXPORT void XReverse();
//! Reverses the Y direction of <me>.
Standard_EXPORT void YReverse();
//! Reverses the Z direction of <me>.
Standard_EXPORT void ZReverse();
//! Assigns the origin and "main Direction" of the axis A1 to
//! this coordinate system, then recomputes its "X Direction" and "Y Direction".
//! Note:
//! - The new "X Direction" is computed as follows:
//! new "X Direction" = V1 ^(previous "X Direction" ^ V)
//! where V is the "Direction" of A1.
//! - The orientation of this coordinate system
//! (right-handed or left-handed) is not modified.
//! Raises ConstructionError if the "Direction" of <A1> and the "XDirection" of <me>
//! are parallel (same or opposite orientation) because it is
//! impossible to calculate the new "XDirection" and the new
//! "YDirection".
Standard_EXPORT void SetAxis (const gp_Ax1& A1);
//! Changes the main direction of this coordinate system,
//! then recomputes its "X Direction" and "Y Direction".
//! Note:
//! - The new "X Direction" is computed as follows:
//! new "X Direction" = V ^ (previous "X Direction" ^ V).
//! - The orientation of this coordinate system (left- or right-handed) is not modified.
//! Raises ConstructionError if <V< and the previous "XDirection" are parallel
//! because it is impossible to calculate the new "XDirection"
//! and the new "YDirection".
Standard_EXPORT void SetDirection (const gp_Dir& V);
//! Changes the "Location" point (origin) of <me>.
Standard_EXPORT void SetLocation (const gp_Pnt& P);
//! Changes the "Xdirection" of <me>. The main direction
//! "Direction" is not modified, the "Ydirection" is modified.
//! If <Vx> is not normal to the main direction then <XDirection>
//! is computed as follows XDirection = Direction ^ (Vx ^ Direction).
//! Raises ConstructionError if <Vx> is parallel (same or opposite
//! orientation) to the main direction of <me>
Standard_EXPORT void SetXDirection (const gp_Dir& Vx);
//! Changes the "Ydirection" of <me>. The main direction is not
//! modified but the "Xdirection" is changed.
//! If <Vy> is not normal to the main direction then "YDirection"
//! is computed as follows
//! YDirection = Direction ^ (<Vy> ^ Direction).
//! Raises ConstructionError if <Vy> is parallel to the main direction of <me>
void SetYDirection (const gp_Dir& Vy);
//! Computes the angular value between the main direction of
//! <me> and the main direction of <Other>. Returns the angle
//! between 0 and PI in radians.
Standard_Real Angle (const gp_Ax3& Other) const;
//! Returns the main axis of <me>. It is the "Location" point
//! and the main "Direction".
const gp_Ax1& Axis() const;
//! Computes a right-handed coordinate system with the
//! same "X Direction" and "Y Direction" as those of this
//! coordinate system, then recomputes the "main Direction".
//! If this coordinate system is right-handed, the result
//! returned is the same coordinate system. If this
//! coordinate system is left-handed, the result is reversed.
Standard_EXPORT gp_Ax2 Ax2() const;
//! Returns the main direction of <me>.
const gp_Dir& Direction() const;
//! Returns the "Location" point (origin) of <me>.
const gp_Pnt& Location() const;
//! Returns the "XDirection" of <me>.
const gp_Dir& XDirection() const;
//! Returns the "YDirection" of <me>.
const gp_Dir& YDirection() const;
//! Returns True if the coordinate system is right-handed. i.e.
//! XDirection().Crossed(YDirection()).Dot(Direction()) > 0
Standard_Boolean Direct() const;
//! Returns True if
//! . the distance between the "Location" point of <me> and
//! <Other> is lower or equal to LinearTolerance and
//! . the distance between the "Location" point of <Other> and
//! <me> is lower or equal to LinearTolerance and
//! . the main direction of <me> and the main direction of
//! <Other> are parallel (same or opposite orientation).
Standard_Boolean IsCoplanar (const gp_Ax3& Other, const Standard_Real LinearTolerance, const Standard_Real AngularTolerance) const;
//! Returns True if
//! . the distance between <me> and the "Location" point of A1
//! is lower of equal to LinearTolerance and
//! . the distance between A1 and the "Location" point of <me>
//! is lower or equal to LinearTolerance and
//! . the main direction of <me> and the direction of A1 are normal.
Standard_Boolean IsCoplanar (const gp_Ax1& A1, const Standard_Real LinearTolerance, const Standard_Real AngularTolerance) const;
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of an axis
//! placement with respect to the point P which is the
//! center of the symmetry.
//! Warnings :
//! The main direction of the axis placement is not changed.
//! The "XDirection" and the "YDirection" are reversed.
//! So the axis placement stay right handed.
Standard_EXPORT gp_Ax3 Mirrored (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of an axis
//! placement with respect to an axis placement which
//! is the axis of the symmetry.
//! The transformation is performed on the "Location"
//! point, on the "XDirection" and "YDirection".
//! The resulting main "Direction" is the cross product between
//! the "XDirection" and the "YDirection" after transformation.
Standard_EXPORT gp_Ax3 Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of an axis
//! placement with respect to a plane.
//! The axis placement <A2> locates the plane of the symmetry :
//! (Location, XDirection, YDirection).
//! The transformation is performed on the "Location"
//! point, on the "XDirection" and "YDirection".
//! The resulting main "Direction" is the cross product between
//! the "XDirection" and the "YDirection" after transformation.
Standard_EXPORT gp_Ax3 Mirrored (const gp_Ax2& A2) const;
Standard_EXPORT void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates an axis placement. <A1> is the axis of the
//! rotation . Ang is the angular value of the rotation
//! in radians.
Standard_EXPORT gp_Ax3 Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
Standard_EXPORT void Scale (const gp_Pnt& P, const Standard_Real S);
//! Applies a scaling transformation on the axis placement.
//! The "Location" point of the axisplacement is modified.
//! Warnings :
//! If the scale <S> is negative :
//! . the main direction of the axis placement is not changed.
//! . The "XDirection" and the "YDirection" are reversed.
//! So the axis placement stay right handed.
Standard_EXPORT gp_Ax3 Scaled (const gp_Pnt& P, const Standard_Real S) const;
Standard_EXPORT void Transform (const gp_Trsf& T);
//! Transforms an axis placement with a Trsf.
//! The "Location" point, the "XDirection" and the
//! "YDirection" are transformed with T. The resulting
//! main "Direction" of <me> is the cross product between
//! the "XDirection" and the "YDirection" after transformation.
Standard_EXPORT gp_Ax3 Transformed (const gp_Trsf& T) const;
Standard_EXPORT void Translate (const gp_Vec& V);
//! Translates an axis plaxement in the direction of the vector
//! <V>. The magnitude of the translation is the vector's magnitude.
Standard_EXPORT gp_Ax3 Translated (const gp_Vec& V) const;
Standard_EXPORT void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates an axis placement from the point <P1> to the
//! point <P2>.
Standard_EXPORT gp_Ax3 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Ax1 axis;
gp_Dir vydir;
gp_Dir vxdir;
};
#include <gp_Ax3.lxx>
#endif // _gp_Ax3_HeaderFile

View File

@@ -1,262 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Circ from gp
--- Purpose :
-- Describes a circle in 3D space.
-- A circle is defined by its radius and positioned in space
-- with a coordinate system (a gp_Ax2 object) as follows:
-- - the origin of the coordinate system is the center of the circle, and
-- - the origin, "X Direction" and "Y Direction" of the
-- coordinate system define the plane of the circle.
-- This positioning coordinate system is the "local
-- coordinate system" of the circle. Its "main Direction"
-- gives the normal vector to the plane of the circle. The
-- "main Axis" of the coordinate system is referred to as
-- the "Axis" of the circle.
-- Note: when a gp_Circ circle is converted into a
-- Geom_Circle circle, some implicit properties of the
-- circle are used explicitly:
-- - the "main Direction" of the local coordinate system
-- gives an implicit orientation to the circle (and defines
-- its trigonometric sense),
-- - this orientation corresponds to the direction in
-- which parameter values increase,
-- - the starting point for parameterization is that of the
-- "X Axis" of the local coordinate system (i.e. the "X Axis" of the circle).
-- See Also
-- gce_MakeCirc which provides functions for more complex circle constructions
-- Geom_Circle which provides additional functions for
-- constructing circles and works, in particular, with the
-- parametric equations of circles
uses Ax1 from gp,
Ax2 from gp,
Pln from gp,
Pnt from gp,
Trsf from gp,
Vec from gp
raises ConstructionError from Standard
is
Create returns Circ;
---C++: inline
--- Purpose : Creates an indefinite circle.
Create (A2 : Ax2; Radius : Real) returns Circ
---C++: inline
--- Purpose :
-- A2 locates the circle and gives its orientation in 3D space.
-- Warnings :
-- It is not forbidden to create a circle with Radius = 0.0 Raises ConstructionError if Radius < 0.0
raises ConstructionError;
SetAxis (me : in out; A1 : Ax1)
---C++: inline
--- Purpose :
-- Changes the main axis of the circle. It is the axis
-- perpendicular to the plane of the circle.
-- Raises ConstructionError if the direction of A1
-- is parallel to the "XAxis" of the circle.
raises ConstructionError
is static;
SetLocation (me : in out; P :Pnt) is static;
---C++:inline
--- Purpose :
-- Changes the "Location" point (center) of the circle.
SetPosition (me : in out; A2 : Ax2) is static;
---C++:inline
--- Purpose : Changes the position of the circle.
SetRadius (me : out; Radius : Real)
---C++: inline
---Purpose: Modifies the radius of this circle.
-- Warning. This class does not prevent the creation of a circle where Radius is null.
-- Exceptions
-- Standard_ConstructionError if Radius is negative.
raises ConstructionError
is static;
Area (me) returns Real is static;
---C++: inline
--- Purpose : Computes the area of the circle.
Axis (me) returns Ax1 is static;
---C++: inline
--- Purpose :
-- Returns the main axis of the circle.
-- It is the axis perpendicular to the plane of the circle,
-- passing through the "Location" point (center) of the circle.
---C++: return const&
Length (me) returns Real is static;
---C++: inline
--- Purpose : Computes the circumference of the circle.
Location (me) returns Pnt is static;
---C++: inline
--- Purpose :
-- Returns the center of the circle. It is the
-- "Location" point of the local coordinate system
-- of the circle
---C++: return const&
Position (me) returns Ax2 is static;
--- Purpose :
-- Returns the position of the circle.
-- It is the local coordinate system of the circle.
---C++: inline
---C++: return const&
Radius (me) returns Real is static;
---C++: inline
---Purpose: Returns the radius of this circle.
XAxis (me) returns Ax1 is static;
---C++: inline
--- Purpose :
-- Returns the "XAxis" of the circle.
-- This axis is perpendicular to the axis of the conic.
-- This axis and the "Yaxis" define the plane of the conic.
YAxis (me) returns Ax1 is static;
---C++: inline
--- Purpose :
-- Returns the "YAxis" of the circle.
-- This axis and the "Xaxis" define the plane of the conic.
-- The "YAxis" is perpendicular to the "Xaxis".
Distance (me; P : Pnt) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the minimum of distance between the point P and
-- any point on the circumference of the circle.
SquareDistance (me; P : Pnt) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the square distance between <me> and the point P.
Contains (me; P : Pnt; LinearTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose :
-- Returns True if the point P is on the circumference.
-- The distance between <me> and <P> must be lower or
-- equal to LinearTolerance.
Mirror (me : in out; P : Pnt) is static;
Mirrored (me; P : Pnt) returns Circ is static;
--- Purpose :
-- Performs the symmetrical transformation of a circle
-- with respect to the point P which is the center of the
-- symmetry.
Mirror (me : in out; A1 : Ax1) is static;
Mirrored (me; A1 : Ax1) returns Circ is static;
--- Purpose :
-- Performs the symmetrical transformation of a circle with
-- respect to an axis placement which is the axis of the
-- symmetry.
Mirror (me : in out; A2 : Ax2) is static;
Mirrored (me; A2 : Ax2) returns Circ is static;
--- Purpose :
-- Performs the symmetrical transformation of a circle with respect
-- to a plane. The axis placement A2 locates the plane of the
-- of the symmetry : (Location, XDirection, YDirection).
Rotate (me : in out; A1 : Ax1; Ang : Real) is static;
---C++: inline
Rotated (me; A1 : Ax1; Ang : Real) returns Circ is static;
---C++: inline
--- Purpose :
-- Rotates a circle. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt; S : Real) is static;
---C++: inline
Scaled (me; P : Pnt; S : Real) returns Circ is static;
---C++: inline
--- Purpose :
-- Scales a circle. S is the scaling value.
-- Warnings :
-- If S is negative the radius stay positive but
-- the "XAxis" and the "YAxis" are reversed as for
-- an ellipse.
Transform (me : in out; T : Trsf) is static;
---C++: inline
Transformed (me; T : Trsf) returns Circ is static;
---C++: inline
--- Purpose :
-- Transforms a circle with the transformation T from class Trsf.
Translate (me : in out; V : Vec) is static;
---C++: inline
Translated (me; V : Vec) returns Circ is static;
---C++: inline
--- Purpose :
-- Translates a circle in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt) is static;
---C++: inline
Translated (me; P1, P2 : Pnt) returns Circ is static;
---C++: inline
--- Purpose :
-- Translates a circle from the point P1 to the point P2.
fields
pos : Ax2;
radius : Real;
end;

View File

@@ -12,7 +12,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gp_Circ.ixx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Circ.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
void gp_Circ::Mirror (const gp_Pnt& P)
{ pos.Mirror(P); }

236
src/gp/gp_Circ.hxx Normal file
View File

@@ -0,0 +1,236 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Circ_HeaderFile
#define _gp_Circ_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax2.hxx>
#include <Standard_Real.hxx>
#include <gp_Ax1.hxx>
#include <Standard_Boolean.hxx>
class Standard_ConstructionError;
class gp_Ax2;
class gp_Ax1;
class gp_Pnt;
class gp_Trsf;
class gp_Vec;
//! Describes a circle in 3D space.
//! A circle is defined by its radius and positioned in space
//! with a coordinate system (a gp_Ax2 object) as follows:
//! - the origin of the coordinate system is the center of the circle, and
//! - the origin, "X Direction" and "Y Direction" of the
//! coordinate system define the plane of the circle.
//! This positioning coordinate system is the "local
//! coordinate system" of the circle. Its "main Direction"
//! gives the normal vector to the plane of the circle. The
//! "main Axis" of the coordinate system is referred to as
//! the "Axis" of the circle.
//! Note: when a gp_Circ circle is converted into a
//! Geom_Circle circle, some implicit properties of the
//! circle are used explicitly:
//! - the "main Direction" of the local coordinate system
//! gives an implicit orientation to the circle (and defines
//! its trigonometric sense),
//! - this orientation corresponds to the direction in
//! which parameter values increase,
//! - the starting point for parameterization is that of the
//! "X Axis" of the local coordinate system (i.e. the "X Axis" of the circle).
//! See Also
//! gce_MakeCirc which provides functions for more complex circle constructions
//! Geom_Circle which provides additional functions for
//! constructing circles and works, in particular, with the
//! parametric equations of circles
class gp_Circ
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an indefinite circle.
gp_Circ();
//! A2 locates the circle and gives its orientation in 3D space.
//! Warnings :
//! It is not forbidden to create a circle with Radius = 0.0 Raises ConstructionError if Radius < 0.0
gp_Circ(const gp_Ax2& A2, const Standard_Real Radius);
//! Changes the main axis of the circle. It is the axis
//! perpendicular to the plane of the circle.
//! Raises ConstructionError if the direction of A1
//! is parallel to the "XAxis" of the circle.
void SetAxis (const gp_Ax1& A1);
//! Changes the "Location" point (center) of the circle.
void SetLocation (const gp_Pnt& P);
//! Changes the position of the circle.
void SetPosition (const gp_Ax2& A2);
//! Modifies the radius of this circle.
//! Warning. This class does not prevent the creation of a circle where Radius is null.
//! Exceptions
//! Standard_ConstructionError if Radius is negative.
void SetRadius (const Standard_Real Radius);
//! Computes the area of the circle.
Standard_Real Area() const;
//! Returns the main axis of the circle.
//! It is the axis perpendicular to the plane of the circle,
//! passing through the "Location" point (center) of the circle.
const gp_Ax1& Axis() const;
//! Computes the circumference of the circle.
Standard_Real Length() const;
//! Returns the center of the circle. It is the
//! "Location" point of the local coordinate system
//! of the circle
const gp_Pnt& Location() const;
//! Returns the position of the circle.
//! It is the local coordinate system of the circle.
const gp_Ax2& Position() const;
//! Returns the radius of this circle.
Standard_Real Radius() const;
//! Returns the "XAxis" of the circle.
//! This axis is perpendicular to the axis of the conic.
//! This axis and the "Yaxis" define the plane of the conic.
gp_Ax1 XAxis() const;
//! Returns the "YAxis" of the circle.
//! This axis and the "Xaxis" define the plane of the conic.
//! The "YAxis" is perpendicular to the "Xaxis".
gp_Ax1 YAxis() const;
//! Computes the minimum of distance between the point P and
//! any point on the circumference of the circle.
Standard_Real Distance (const gp_Pnt& P) const;
//! Computes the square distance between <me> and the point P.
Standard_Real SquareDistance (const gp_Pnt& P) const;
//! Returns True if the point P is on the circumference.
//! The distance between <me> and <P> must be lower or
//! equal to LinearTolerance.
Standard_Boolean Contains (const gp_Pnt& P, const Standard_Real LinearTolerance) const;
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of a circle
//! with respect to the point P which is the center of the
//! symmetry.
Standard_EXPORT gp_Circ Mirrored (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of a circle with
//! respect to an axis placement which is the axis of the
//! symmetry.
Standard_EXPORT gp_Circ Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of a circle with respect
//! to a plane. The axis placement A2 locates the plane of the
//! of the symmetry : (Location, XDirection, YDirection).
Standard_EXPORT gp_Circ Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates a circle. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Circ Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Scales a circle. S is the scaling value.
//! Warnings :
//! If S is negative the radius stay positive but
//! the "XAxis" and the "YAxis" are reversed as for
//! an ellipse.
gp_Circ Scaled (const gp_Pnt& P, const Standard_Real S) const;
void Transform (const gp_Trsf& T);
//! Transforms a circle with the transformation T from class Trsf.
gp_Circ Transformed (const gp_Trsf& T) const;
void Translate (const gp_Vec& V);
//! Translates a circle in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Circ Translated (const gp_Vec& V) const;
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates a circle from the point P1 to the point P2.
gp_Circ Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Ax2 pos;
Standard_Real radius;
};
#include <gp_Circ.lxx>
#endif // _gp_Circ_HeaderFile

View File

@@ -1,264 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Circ2d from gp
--- Purpose : Describes a circle in the plane (2D space).
-- A circle is defined by its radius and positioned in the
-- plane with a coordinate system (a gp_Ax22d object) as follows:
-- - the origin of the coordinate system is the center of the circle, and
-- - the orientation (direct or indirect) of the coordinate
-- system gives an implicit orientation to the circle (and
-- defines its trigonometric sense).
-- This positioning coordinate system is the "local
-- coordinate system" of the circle.
-- Note: when a gp_Circ2d circle is converted into a
-- Geom2d_Circle circle, some implicit properties of the
-- circle are used explicitly:
-- - the implicit orientation corresponds to the direction in
-- which parameter values increase,
-- - the starting point for parameterization is that of the "X
-- Axis" of the local coordinate system (i.e. the "X Axis" of the circle).
-- See Also
-- GccAna and Geom2dGcc packages which provide
-- functions for constructing circles defined by geometric constraints
-- gce_MakeCirc2d which provides functions for more
-- complex circle constructions
-- Geom2d_Circle which provides additional functions for
-- constructing circles and works, with the parametric
-- equations of circles in particular gp_Ax22d
uses Ax2d from gp,
Ax22d from gp,
Pnt2d from gp,
Trsf2d from gp,
Vec2d from gp
raises ConstructionError from Standard
is
Create returns Circ2d;
---C++: inline
--- Purpose : creates an indefinite circle.
Create (XAxis : Ax2d;
Radius : Real;
Sense : Boolean from Standard = Standard_True) returns Circ2d
---C++: inline
--- Purpose :
-- The location point of XAxis is the center of the circle.
-- Warnings :
-- It is not forbidden to create a circle with Radius = 0.0 Raises ConstructionError if Radius < 0.0.
raises ConstructionError;
--- Purpose : Raised if Radius < 0.0.
Create (Axis : Ax22d; Radius : Real) returns Circ2d
---C++: inline
--- Purpose :
-- Axis defines the Xaxis and Yaxis of the circle which defines
-- the origin and the sense of parametrization.
-- The location point of Axis is the center of the circle.
-- Warnings :
-- It is not forbidden to create a circle with Radius = 0.0 Raises ConstructionError if Radius < 0.0.
raises ConstructionError;
--- Purpose : Raised if Radius < 0.0.
SetLocation (me : in out; P : Pnt2d) is static;
--- Purpose : Changes the location point (center) of the circle.
SetXAxis (me : in out; A : Ax2d) is static;
---C++:inline
--- Purpose : Changes the X axis of the circle.
SetAxis (me : in out; A : Ax22d) is static;
---C++:inline
--- Purpose : Changes the X axis of the circle.
SetYAxis (me : in out; A : Ax2d) is static;
---C++:inline
--- Purpose : Changes the Y axis of the circle.
SetRadius (me : in out; Radius : Real)
---C++:inline
---Purpose: Modifies the radius of this circle.
-- This class does not prevent the creation of a circle where
-- Radius is null.
-- Exceptions
-- Standard_ConstructionError if Radius is negative.
raises ConstructionError
is static;
Area (me) returns Real is static;
---C++: inline
--- Purpose : Computes the area of the circle.
Coefficients (me; A, B, C, D, E, F : out Real) is static;
---C++: inline
--- Purpose :
-- Returns the normalized coefficients from the implicit equation
-- of the circle :
-- A * (X**2) + B * (Y**2) + 2*C*(X*Y) + 2*D*X + 2*E*Y + F = 0.0
Contains (me; P : Pnt2d; LinearTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose : Does <me> contain P ?
-- Returns True if the distance between P and any point on
-- the circumference of the circle is lower of equal to
-- <LinearTolerance>.
Distance (me; P : Pnt2d) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the minimum of distance between the point P and any
-- point on the circumference of the circle.
SquareDistance (me; P : Pnt2d) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the square distance between <me> and the point P.
Length (me) returns Real is static;
--- Purpose : computes the circumference of the circle.
---C++: inline
Location (me) returns Pnt2d is static;
---C++:inline
--- Purpose : Returns the location point (center) of the circle.
---C++: return const&
Radius (me) returns Real is static;
--- Purpose : Returns the radius value of the circle.
---C++: inline
Axis (me) returns Ax22d is static;
--- Purpose : returns the position of the circle.
---C++: inline
---C++: return const&
Position (me) returns Ax22d is static;
--- Purpose : returns the position of the circle. Idem Axis(me).
---C++: inline
---C++: return const&
XAxis (me) returns Ax2d is static;
---C++: inline
--- Purpose : returns the X axis of the circle.
YAxis (me) returns Ax2d is static;
---C++: inline
--- Purpose : Returns the Y axis of the circle.
--- Purpose : Reverses the direction of the circle.
Reverse (me : in out) is static;
---C++: inline
--- Purpose: Reverses the orientation of the local coordinate system
-- of this circle (the "Y Direction" is reversed) and therefore
--- changes the implicit orientation of this circle.
-- Reverse assigns the result to this circle,
Reversed (me) returns Circ2d is static;
---C++: inline
---Purpose: Reverses the orientation of the local coordinate system
-- of this circle (the "Y Direction" is reversed) and therefore
-- changes the implicit orientation of this circle.
-- Reversed creates a new circle.
IsDirect (me) returns Boolean is static;
---C++: inline
--- Purpose : Returns true if the local coordinate system is direct
-- and false in the other case.
Mirror (me : in out; P : Pnt2d) is static;
Mirrored (me; P : Pnt2d) returns Circ2d is static;
--- Purpose :
-- Performs the symmetrical transformation of a circle with respect
-- to the point P which is the center of the symmetry
Mirror (me : in out; A : Ax2d) is static;
Mirrored (me; A : Ax2d) returns Circ2d is static;
--- Purpose :
-- Performs the symmetrical transformation of a circle with respect
-- to an axis placement which is the axis of the symmetry.
Rotate (me : in out; P : Pnt2d; Ang : Real) is static;
---C++: inline
Rotated (me; P : Pnt2d; Ang : Real) returns Circ2d is static;
---C++: inline
--- Purpose :
-- Rotates a circle. P is the center of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt2d; S : Real) is static;
---C++: inline
Scaled (me; P : Pnt2d; S : Real) returns Circ2d is static;
---C++: inline
--- Purpose :
-- Scales a circle. S is the scaling value.
-- Warnings :
-- If S is negative the radius stay positive but
-- the "XAxis" and the "YAxis" are reversed as for
-- an ellipse.
Transform (me : in out; T : Trsf2d) is static;
---C++: inline
Transformed (me; T : Trsf2d) returns Circ2d is static;
---C++: inline
--- Purpose :
-- Transforms a circle with the transformation T from class Trsf2d.
Translate (me : in out; V : Vec2d) is static;
---C++: inline
Translated (me; V : Vec2d) returns Circ2d is static;
---C++: inline
--- Purpose :
-- Translates a circle in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt2d) is static;
---C++: inline
Translated (me; P1, P2 : Pnt2d) returns Circ2d is static;
---C++: inline
--- Purpose :
-- Translates a circle from the point P1 to the point P2.
fields
pos : Ax22d;
radius : Real;
end;

View File

@@ -14,7 +14,13 @@
//modif JCV 10/01/91 suite a la deuxieme revue de projet toolkit geometry
#include <gp_Circ2d.ixx>
#include <gp_Ax2d.hxx>
#include <gp_Ax22d.hxx>
#include <gp_Circ2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <Standard_ConstructionError.hxx>
void gp_Circ2d::Mirror (const gp_Pnt2d& P)
{ pos.Mirror(P); }

241
src/gp/gp_Circ2d.hxx Normal file
View File

@@ -0,0 +1,241 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Circ2d_HeaderFile
#define _gp_Circ2d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax22d.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <gp_Ax2d.hxx>
class Standard_ConstructionError;
class gp_Ax2d;
class gp_Ax22d;
class gp_Pnt2d;
class gp_Trsf2d;
class gp_Vec2d;
//! Describes a circle in the plane (2D space).
//! A circle is defined by its radius and positioned in the
//! plane with a coordinate system (a gp_Ax22d object) as follows:
//! - the origin of the coordinate system is the center of the circle, and
//! - the orientation (direct or indirect) of the coordinate
//! system gives an implicit orientation to the circle (and
//! defines its trigonometric sense).
//! This positioning coordinate system is the "local
//! coordinate system" of the circle.
//! Note: when a gp_Circ2d circle is converted into a
//! Geom2d_Circle circle, some implicit properties of the
//! circle are used explicitly:
//! - the implicit orientation corresponds to the direction in
//! which parameter values increase,
//! - the starting point for parameterization is that of the "X
//! Axis" of the local coordinate system (i.e. the "X Axis" of the circle).
//! See Also
//! GccAna and Geom2dGcc packages which provide
//! functions for constructing circles defined by geometric constraints
//! gce_MakeCirc2d which provides functions for more
//! complex circle constructions
//! Geom2d_Circle which provides additional functions for
//! constructing circles and works, with the parametric
//! equations of circles in particular gp_Ax22d
class gp_Circ2d
{
public:
DEFINE_STANDARD_ALLOC
//! creates an indefinite circle.
gp_Circ2d();
//! The location point of XAxis is the center of the circle.
//! Warnings :
//! It is not forbidden to create a circle with Radius = 0.0 Raises ConstructionError if Radius < 0.0.
//! Raised if Radius < 0.0.
gp_Circ2d(const gp_Ax2d& XAxis, const Standard_Real Radius, const Standard_Boolean Sense = Standard_True);
//! Axis defines the Xaxis and Yaxis of the circle which defines
//! the origin and the sense of parametrization.
//! The location point of Axis is the center of the circle.
//! Warnings :
//! It is not forbidden to create a circle with Radius = 0.0 Raises ConstructionError if Radius < 0.0.
//! Raised if Radius < 0.0.
gp_Circ2d(const gp_Ax22d& Axis, const Standard_Real Radius);
//! Changes the location point (center) of the circle.
Standard_EXPORT void SetLocation (const gp_Pnt2d& P);
//! Changes the X axis of the circle.
void SetXAxis (const gp_Ax2d& A);
//! Changes the X axis of the circle.
void SetAxis (const gp_Ax22d& A);
//! Changes the Y axis of the circle.
void SetYAxis (const gp_Ax2d& A);
//! Modifies the radius of this circle.
//! This class does not prevent the creation of a circle where
//! Radius is null.
//! Exceptions
//! Standard_ConstructionError if Radius is negative.
void SetRadius (const Standard_Real Radius);
//! Computes the area of the circle.
Standard_Real Area() const;
//! Returns the normalized coefficients from the implicit equation
//! of the circle :
//! A * (X**2) + B * (Y**2) + 2*C*(X*Y) + 2*D*X + 2*E*Y + F = 0.0
void Coefficients (Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& D, Standard_Real& E, Standard_Real& F) const;
//! Does <me> contain P ?
//! Returns True if the distance between P and any point on
//! the circumference of the circle is lower of equal to
//! <LinearTolerance>.
Standard_Boolean Contains (const gp_Pnt2d& P, const Standard_Real LinearTolerance) const;
//! Computes the minimum of distance between the point P and any
//! point on the circumference of the circle.
Standard_Real Distance (const gp_Pnt2d& P) const;
//! Computes the square distance between <me> and the point P.
Standard_Real SquareDistance (const gp_Pnt2d& P) const;
//! computes the circumference of the circle.
Standard_Real Length() const;
//! Returns the location point (center) of the circle.
const gp_Pnt2d& Location() const;
//! Returns the radius value of the circle.
Standard_Real Radius() const;
//! returns the position of the circle.
const gp_Ax22d& Axis() const;
//! returns the position of the circle. Idem Axis(me).
const gp_Ax22d& Position() const;
//! returns the X axis of the circle.
gp_Ax2d XAxis() const;
//! Returns the Y axis of the circle.
//! Reverses the direction of the circle.
gp_Ax2d YAxis() const;
//! Reverses the orientation of the local coordinate system
//! of this circle (the "Y Direction" is reversed) and therefore
//! changes the implicit orientation of this circle.
//! Reverse assigns the result to this circle,
void Reverse();
//! Reverses the orientation of the local coordinate system
//! of this circle (the "Y Direction" is reversed) and therefore
//! changes the implicit orientation of this circle.
//! Reversed creates a new circle.
gp_Circ2d Reversed() const;
//! Returns true if the local coordinate system is direct
//! and false in the other case.
Standard_Boolean IsDirect() const;
Standard_EXPORT void Mirror (const gp_Pnt2d& P);
//! Performs the symmetrical transformation of a circle with respect
//! to the point P which is the center of the symmetry
Standard_EXPORT gp_Circ2d Mirrored (const gp_Pnt2d& P) const;
Standard_EXPORT void Mirror (const gp_Ax2d& A);
//! Performs the symmetrical transformation of a circle with respect
//! to an axis placement which is the axis of the symmetry.
Standard_EXPORT gp_Circ2d Mirrored (const gp_Ax2d& A) const;
void Rotate (const gp_Pnt2d& P, const Standard_Real Ang);
//! Rotates a circle. P is the center of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Circ2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
void Scale (const gp_Pnt2d& P, const Standard_Real S);
//! Scales a circle. S is the scaling value.
//! Warnings :
//! If S is negative the radius stay positive but
//! the "XAxis" and the "YAxis" are reversed as for
//! an ellipse.
gp_Circ2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
void Transform (const gp_Trsf2d& T);
//! Transforms a circle with the transformation T from class Trsf2d.
gp_Circ2d Transformed (const gp_Trsf2d& T) const;
void Translate (const gp_Vec2d& V);
//! Translates a circle in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Circ2d Translated (const gp_Vec2d& V) const;
void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2);
//! Translates a circle from the point P1 to the point P2.
gp_Circ2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
protected:
private:
gp_Ax22d pos;
Standard_Real radius;
};
#include <gp_Circ2d.lxx>
#endif // _gp_Circ2d_HeaderFile

View File

@@ -1,268 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Cone from gp
--- Purpose :
-- Defines an infinite conical surface.
-- A cone is defined by its half-angle at the apex and
-- positioned in space with a coordinate system (a gp_Ax3
-- object) and a "reference radius" where:
-- - the "main Axis" of the coordinate system is the axis of revolution of the cone,
-- - the plane defined by the origin, the "X Direction" and
-- the "Y Direction" of the coordinate system is the
-- reference plane of the cone; the intersection of the
-- cone with this reference plane is a circle of radius
-- equal to the reference radius,
-- if the half-angle is positive, the apex of the cone is on
-- the negative side of the "main Axis" of the coordinate
-- system. If the half-angle is negative, the apex is on the positive side.
-- This coordinate system is the "local coordinate system" of the cone.
-- Note: when a gp_Cone cone is converted into a
-- Geom_ConicalSurface cone, some implicit properties of
-- its local coordinate system are used explicitly:
-- - its origin, "X Direction", "Y Direction" and "main
-- Direction" are used directly to define the parametric
-- directions on the cone and the origin of the parameters,
-- - its implicit orientation (right-handed or left-handed)
-- gives the orientation (direct or indirect) of the
-- Geom_ConicalSurface cone.
-- See Also
-- gce_MakeCone which provides functions for more
-- complex cone constructions
-- Geom_ConicalSurface which provides additional
-- functions for constructing cones and works, in particular,
-- with the parametric equations of cones gp_Ax3
uses Ax1 from gp,
Ax2 from gp,
Ax3 from gp,
Dir from gp,
Pnt from gp,
Trsf from gp,
Vec from gp
raises ConstructionError from Standard
is
Create returns Cone;
---C++:inline
--- Purpose : Creates an indefinite Cone.
Create (A3 : Ax3; Ang : Real; Radius : Real) returns Cone
---C++:inline
--- Purpose :
-- Creates an infinite conical surface. A3 locates the cone
-- in the space and defines the reference plane of the surface.
-- Ang is the conical surface semi-angle between 0 and PI/2 radians.
-- Radius is the radius of the circle in the reference plane of
-- the cone.
--- Raises ConstructionError
-- . if Radius is lower than 0.0
-- . Ang < Resolution from gp or Ang >= (PI/2) - Resolution.
raises ConstructionError;
SetAxis (me : in out; A1 : Ax1)
---C++:inline
--- Purpose : Changes the symmetry axis of the cone. Raises ConstructionError
-- the direction of A1 is parallel to the "XDirection"
-- of the coordinate system of the cone.
raises ConstructionError
is static;
SetLocation (me : in out; Loc : Pnt) is static;
---C++:inline
--- Purpose : Changes the location of the cone.
SetPosition (me : in out; A3 : Ax3) is static;
---C++:inline
--- Purpose :
-- Changes the local coordinate system of the cone.
-- This coordinate system defines the reference plane of the cone.
SetRadius (me : in out; R : Real)
---C++:inline
--- Purpose :
-- Changes the radius of the cone in the reference plane of
-- the cone.
raises ConstructionError
--- Purpose : Raised if R < 0.0
is static;
SetSemiAngle (me : in out; Ang : Real)
---C++:inline
--- Purpose :
-- Changes the semi-angle of the cone.
-- Ang is the conical surface semi-angle ]0,PI/2[.
-- Raises ConstructionError if Ang < Resolution from gp or Ang >= PI/2 - Resolution
raises ConstructionError
is static;
Apex (me) returns Pnt is static;
---C++:inline
--- Purpose :
-- Computes the cone's top. The Apex of the cone is on the
-- negative side of the symmetry axis of the cone.
UReverse (me : in out)
---C++:inline
---Purpose: Reverses the U parametrization of the cone
-- reversing the YAxis.
is static;
VReverse (me : in out)
---C++:inline
---Purpose: Reverses the V parametrization of the cone reversing the ZAxis.
is static;
Direct (me) returns Boolean from Standard
---C++:inline
---Purpose: Returns true if the local coordinate system of this cone is right-handed.
is static;
Axis (me) returns Ax1 is static;
---C++:inline
--- Purpose : returns the symmetry axis of the cone.
---C++: return const&
Coefficients (me; A1, A2, A3, B1, B2, B3, C1, C2, C3, D : out Real)
is static;
--- Purpose :
-- Computes the coefficients of the implicit equation of the quadric
-- in the absolute cartesian coordinates system :
-- A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) +
-- 2.(C1.X + C2.Y + C3.Z) + D = 0.0
Location (me) returns Pnt is static;
---C++:inline
--- Purpose : returns the "Location" point of the cone.
---C++: return const&
Position (me) returns Ax3 is static;
--- Purpose :
-- Returns the local coordinates system of the cone.
---C++: inline
---C++: return const&
RefRadius (me) returns Real is static;
---C++: inline
--- Purpose :
-- Returns the radius of the cone in the reference plane.
SemiAngle (me) returns Real is static;
---C++: inline
---Purpose: Returns the half-angle at the apex of this cone.
XAxis (me) returns Ax1 is static;
---C++:inline
--- Purpose : Returns the XAxis of the reference plane.
YAxis (me) returns Ax1 is static;
---C++:inline
--- Purpose : Returns the YAxis of the reference plane.
Mirror (me : in out; P : Pnt) is static;
Mirrored (me; P : Pnt) returns Cone is static;
--- Purpose :
-- Performs the symmetrical transformation of a cone
-- with respect to the point P which is the center of the
-- symmetry.
Mirror (me : in out; A1 : Ax1) is static;
Mirrored (me; A1 : Ax1) returns Cone is static;
--- Purpose :
-- Performs the symmetrical transformation of a cone with
-- respect to an axis placement which is the axis of the
-- symmetry.
Mirror (me : in out; A2 : Ax2) is static;
Mirrored (me; A2 : Ax2) returns Cone is static;
--- Purpose :
-- Performs the symmetrical transformation of a cone with respect
-- to a plane. The axis placement A2 locates the plane of the
-- of the symmetry : (Location, XDirection, YDirection).
Rotate (me : in out; A1 : Ax1; Ang : Real) is static;
---C++: inline
Rotated (me; A1 : Ax1; Ang : Real) returns Cone is static;
---C++: inline
--- Purpose :
-- Rotates a cone. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt; S : Real) is static;
---C++: inline
Scaled (me; P : Pnt; S : Real) returns Cone is static;
---C++: inline
--- Purpose :
-- Scales a cone. S is the scaling value.
-- The absolute value of S is used to scale the cone
Transform (me : in out; T : Trsf) is static;
---C++: inline
Transformed (me; T : Trsf) returns Cone is static;
---C++: inline
--- Purpose :
-- Transforms a cone with the transformation T from class Trsf.
Translate (me : in out; V : Vec) is static;
---C++: inline
Translated (me; V : Vec) returns Cone is static;
---C++: inline
--- Purpose :
-- Translates a cone in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt) is static;
---C++: inline
Translated (me; P1, P2 : Pnt) returns Cone is static;
---C++: inline
--- Purpose :
-- Translates a cone from the point P1 to the point P2.
fields
pos : Ax3;
radius : Real;
semiAngle : Real;
end;

View File

@@ -15,7 +15,14 @@
// LPA, JCV 07/92 passage sur C1.
// JCV 07/92 Introduction de la method Dump
#include <gp_Cone.ixx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>
#include <gp_Cone.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
void gp_Cone::Coefficients
(Standard_Real& A1, Standard_Real& A2, Standard_Real& A3,

241
src/gp/gp_Cone.hxx Normal file
View File

@@ -0,0 +1,241 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Cone_HeaderFile
#define _gp_Cone_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax3.hxx>
#include <Standard_Real.hxx>
#include <gp_Pnt.hxx>
#include <Standard_Boolean.hxx>
#include <gp_Ax1.hxx>
class Standard_ConstructionError;
class gp_Ax3;
class gp_Ax1;
class gp_Pnt;
class gp_Ax2;
class gp_Trsf;
class gp_Vec;
//! Defines an infinite conical surface.
//! A cone is defined by its half-angle at the apex and
//! positioned in space with a coordinate system (a gp_Ax3
//! object) and a "reference radius" where:
//! - the "main Axis" of the coordinate system is the axis of revolution of the cone,
//! - the plane defined by the origin, the "X Direction" and
//! the "Y Direction" of the coordinate system is the
//! reference plane of the cone; the intersection of the
//! cone with this reference plane is a circle of radius
//! equal to the reference radius,
//! if the half-angle is positive, the apex of the cone is on
//! the negative side of the "main Axis" of the coordinate
//! system. If the half-angle is negative, the apex is on the positive side.
//! This coordinate system is the "local coordinate system" of the cone.
//! Note: when a gp_Cone cone is converted into a
//! Geom_ConicalSurface cone, some implicit properties of
//! its local coordinate system are used explicitly:
//! - its origin, "X Direction", "Y Direction" and "main
//! Direction" are used directly to define the parametric
//! directions on the cone and the origin of the parameters,
//! - its implicit orientation (right-handed or left-handed)
//! gives the orientation (direct or indirect) of the
//! Geom_ConicalSurface cone.
//! See Also
//! gce_MakeCone which provides functions for more
//! complex cone constructions
//! Geom_ConicalSurface which provides additional
//! functions for constructing cones and works, in particular,
//! with the parametric equations of cones gp_Ax3
class gp_Cone
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an indefinite Cone.
gp_Cone();
//! Creates an infinite conical surface. A3 locates the cone
//! in the space and defines the reference plane of the surface.
//! Ang is the conical surface semi-angle between 0 and PI/2 radians.
//! Radius is the radius of the circle in the reference plane of
//! the cone.
//! Raises ConstructionError
//! . if Radius is lower than 0.0
//! . Ang < Resolution from gp or Ang >= (PI/2) - Resolution.
gp_Cone(const gp_Ax3& A3, const Standard_Real Ang, const Standard_Real Radius);
//! Changes the symmetry axis of the cone. Raises ConstructionError
//! the direction of A1 is parallel to the "XDirection"
//! of the coordinate system of the cone.
void SetAxis (const gp_Ax1& A1);
//! Changes the location of the cone.
void SetLocation (const gp_Pnt& Loc);
//! Changes the local coordinate system of the cone.
//! This coordinate system defines the reference plane of the cone.
void SetPosition (const gp_Ax3& A3);
//! Changes the radius of the cone in the reference plane of
//! the cone.
//! Raised if R < 0.0
void SetRadius (const Standard_Real R);
//! Changes the semi-angle of the cone.
//! Ang is the conical surface semi-angle ]0,PI/2[.
//! Raises ConstructionError if Ang < Resolution from gp or Ang >= PI/2 - Resolution
void SetSemiAngle (const Standard_Real Ang);
//! Computes the cone's top. The Apex of the cone is on the
//! negative side of the symmetry axis of the cone.
gp_Pnt Apex() const;
//! Reverses the U parametrization of the cone
//! reversing the YAxis.
void UReverse();
//! Reverses the V parametrization of the cone reversing the ZAxis.
void VReverse();
//! Returns true if the local coordinate system of this cone is right-handed.
Standard_Boolean Direct() const;
//! returns the symmetry axis of the cone.
const gp_Ax1& Axis() const;
//! Computes the coefficients of the implicit equation of the quadric
//! in the absolute cartesian coordinates system :
//! A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) +
//! 2.(C1.X + C2.Y + C3.Z) + D = 0.0
Standard_EXPORT void Coefficients (Standard_Real& A1, Standard_Real& A2, Standard_Real& A3, Standard_Real& B1, Standard_Real& B2, Standard_Real& B3, Standard_Real& C1, Standard_Real& C2, Standard_Real& C3, Standard_Real& D) const;
//! returns the "Location" point of the cone.
const gp_Pnt& Location() const;
//! Returns the local coordinates system of the cone.
const gp_Ax3& Position() const;
//! Returns the radius of the cone in the reference plane.
Standard_Real RefRadius() const;
//! Returns the half-angle at the apex of this cone.
Standard_Real SemiAngle() const;
//! Returns the XAxis of the reference plane.
gp_Ax1 XAxis() const;
//! Returns the YAxis of the reference plane.
gp_Ax1 YAxis() const;
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of a cone
//! with respect to the point P which is the center of the
//! symmetry.
Standard_EXPORT gp_Cone Mirrored (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of a cone with
//! respect to an axis placement which is the axis of the
//! symmetry.
Standard_EXPORT gp_Cone Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of a cone with respect
//! to a plane. The axis placement A2 locates the plane of the
//! of the symmetry : (Location, XDirection, YDirection).
Standard_EXPORT gp_Cone Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates a cone. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Cone Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Scales a cone. S is the scaling value.
//! The absolute value of S is used to scale the cone
gp_Cone Scaled (const gp_Pnt& P, const Standard_Real S) const;
void Transform (const gp_Trsf& T);
//! Transforms a cone with the transformation T from class Trsf.
gp_Cone Transformed (const gp_Trsf& T) const;
void Translate (const gp_Vec& V);
//! Translates a cone in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Cone Translated (const gp_Vec& V) const;
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates a cone from the point P1 to the point P2.
gp_Cone Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Ax3 pos;
Standard_Real radius;
Standard_Real semiAngle;
};
#include <gp_Cone.lxx>
#endif // _gp_Cone_HeaderFile

View File

@@ -1,229 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Cylinder from gp
--- Purpose :
-- Describes an infinite cylindrical surface.
-- A cylinder is defined by its radius and positioned in space
-- with a coordinate system (a gp_Ax3 object), the "main
-- Axis" of which is the axis of the cylinder. This coordinate
-- system is the "local coordinate system" of the cylinder.
-- Note: when a gp_Cylinder cylinder is converted into a
-- Geom_CylindricalSurface cylinder, some implicit
-- properties of its local coordinate system are used explicitly:
-- - its origin, "X Direction", "Y Direction" and "main
-- Direction" are used directly to define the parametric
-- directions on the cylinder and the origin of the parameters,
-- - its implicit orientation (right-handed or left-handed)
-- gives an orientation (direct or indirect) to the
-- Geom_CylindricalSurface cylinder.
-- See Also
-- gce_MakeCylinder which provides functions for more
-- complex cylinder constructions
-- Geom_CylindricalSurface which provides additional
-- functions for constructing cylinders and works, in
-- particular, with the parametric equations of cylinders gp_Ax3
uses Ax1 from gp,
Ax2 from gp,
Ax3 from gp,
Dir from gp,
Pnt from gp,
Trsf from gp,
Vec from gp
raises ConstructionError from Standard
is
Create returns Cylinder;
---C++: inline
--- Purpose : Creates a indefinite cylinder.
Create (A3 : Ax3; Radius : Real) returns Cylinder
---C++: inline
--- Purpose : Creates a cylinder of radius Radius, whose axis is the "main
-- Axis" of A3. A3 is the local coordinate system of the cylinder. Raises ConstructionErrord if R < 0.0
raises ConstructionError;
SetAxis (me : in out; A1 : Ax1)
---C++: inline
--- Purpose : Changes the symmetry axis of the cylinder. Raises ConstructionError if the direction of A1 is parallel to the "XDirection"
-- of the coordinate system of the cylinder.
raises ConstructionError
is static;
SetLocation (me : in out; Loc : Pnt) is static;
---C++:inline
--- Purpose : Changes the location of the surface.
SetPosition (me : in out; A3 : Ax3) is static;
---C++:inline
--- Purpose : Change the local coordinate system of the surface.
SetRadius (me : in out; R : Real)
---C++: inline
---Purpose: Modifies the radius of this cylinder.
-- Exceptions
-- Standard_ConstructionError if R is negative.
raises ConstructionError
is static;
UReverse (me : in out)
---C++:inline
---Purpose: Reverses the U parametrization of the cylinder
-- reversing the YAxis.
is static;
VReverse (me : in out)
---C++:inline
---Purpose: Reverses the V parametrization of the plane
-- reversing the Axis.
is static;
Direct (me) returns Boolean from Standard
---C++: inline
---Purpose: Returns true if the local coordinate system of this cylinder is right-handed.
is static;
Axis (me) returns Ax1 is static;
---C++: inline
--- Purpose : Returns the symmetry axis of the cylinder.
---C++: return const&
Coefficients (me; A1, A2, A3, B1, B2, B3, C1, C2, C3, D : out Real)
is static;
--- Purpose :
-- Computes the coefficients of the implicit equation of the quadric
-- in the absolute cartesian coordinate system :
-- A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) +
-- 2.(C1.X + C2.Y + C3.Z) + D = 0.0
Location (me) returns Pnt is static;
---C++: inline
--- Purpose : Returns the "Location" point of the cylinder.
---C++: return const&
Position (me) returns Ax3 is static;
--- Purpose :
-- Returns the local coordinate system of the cylinder.
---C++: inline
---C++: return const&
Radius (me) returns Real is static;
---C++: inline
--- Purpose : Returns the radius of the cylinder.
XAxis (me) returns Ax1 is static;
---C++: inline
--- Purpose : Returns the axis X of the cylinder.
YAxis (me) returns Ax1 is static;
---C++: inline
--- Purpose : Returns the axis Y of the cylinder.
Mirror (me : in out; P : Pnt) is static;
Mirrored (me; P : Pnt) returns Cylinder is static;
--- Purpose :
-- Performs the symmetrical transformation of a cylinder
-- with respect to the point P which is the center of the
-- symmetry.
Mirror (me : in out; A1 : Ax1) is static;
Mirrored (me; A1 : Ax1) returns Cylinder is static;
--- Purpose :
-- Performs the symmetrical transformation of a cylinder with
-- respect to an axis placement which is the axis of the
-- symmetry.
Mirror (me : in out; A2 : Ax2) is static;
Mirrored (me; A2 : Ax2) returns Cylinder is static;
--- Purpose :
-- Performs the symmetrical transformation of a cylinder with respect
-- to a plane. The axis placement A2 locates the plane of the
-- of the symmetry : (Location, XDirection, YDirection).
Rotate (me : in out; A1 : Ax1; Ang : Real) is static;
---C++: inline
Rotated (me; A1 : Ax1; Ang : Real) returns Cylinder is static;
---C++: inline
--- Purpose :
-- Rotates a cylinder. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt; S : Real) is static;
---C++: inline
Scaled (me; P : Pnt; S : Real) returns Cylinder is static;
---C++: inline
--- Purpose :
-- Scales a cylinder. S is the scaling value.
-- The absolute value of S is used to scale the cylinder
Transform (me : in out; T : Trsf) is static;
---C++: inline
Transformed (me; T : Trsf) returns Cylinder is static;
---C++: inline
--- Purpose :
-- Transforms a cylinder with the transformation T from class Trsf.
Translate (me : in out; V : Vec) is static;
---C++: inline
Translated (me; V : Vec) returns Cylinder is static;
---C++: inline
--- Purpose :
-- Translates a cylinder in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt) is static;
---C++: inline
Translated (me; P1, P2 : Pnt) returns Cylinder is static;
---C++: inline
--- Purpose :
-- Translates a cylinder from the point P1 to the point P2.
fields
pos : Ax3;
radius : Real;
end;

View File

@@ -16,7 +16,13 @@
// JCV 07/92 Introduction de la method Dump
// LBO 08/93 passage aux Ax3
#include <gp_Cylinder.ixx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
void gp_Cylinder::Coefficients

205
src/gp/gp_Cylinder.hxx Normal file
View File

@@ -0,0 +1,205 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Cylinder_HeaderFile
#define _gp_Cylinder_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax3.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <gp_Ax1.hxx>
class Standard_ConstructionError;
class gp_Ax3;
class gp_Ax1;
class gp_Pnt;
class gp_Ax2;
class gp_Trsf;
class gp_Vec;
//! Describes an infinite cylindrical surface.
//! A cylinder is defined by its radius and positioned in space
//! with a coordinate system (a gp_Ax3 object), the "main
//! Axis" of which is the axis of the cylinder. This coordinate
//! system is the "local coordinate system" of the cylinder.
//! Note: when a gp_Cylinder cylinder is converted into a
//! Geom_CylindricalSurface cylinder, some implicit
//! properties of its local coordinate system are used explicitly:
//! - its origin, "X Direction", "Y Direction" and "main
//! Direction" are used directly to define the parametric
//! directions on the cylinder and the origin of the parameters,
//! - its implicit orientation (right-handed or left-handed)
//! gives an orientation (direct or indirect) to the
//! Geom_CylindricalSurface cylinder.
//! See Also
//! gce_MakeCylinder which provides functions for more
//! complex cylinder constructions
//! Geom_CylindricalSurface which provides additional
//! functions for constructing cylinders and works, in
//! particular, with the parametric equations of cylinders gp_Ax3
class gp_Cylinder
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a indefinite cylinder.
gp_Cylinder();
//! Creates a cylinder of radius Radius, whose axis is the "main
//! Axis" of A3. A3 is the local coordinate system of the cylinder. Raises ConstructionErrord if R < 0.0
gp_Cylinder(const gp_Ax3& A3, const Standard_Real Radius);
//! Changes the symmetry axis of the cylinder. Raises ConstructionError if the direction of A1 is parallel to the "XDirection"
//! of the coordinate system of the cylinder.
void SetAxis (const gp_Ax1& A1);
//! Changes the location of the surface.
void SetLocation (const gp_Pnt& Loc);
//! Change the local coordinate system of the surface.
void SetPosition (const gp_Ax3& A3);
//! Modifies the radius of this cylinder.
//! Exceptions
//! Standard_ConstructionError if R is negative.
void SetRadius (const Standard_Real R);
//! Reverses the U parametrization of the cylinder
//! reversing the YAxis.
void UReverse();
//! Reverses the V parametrization of the plane
//! reversing the Axis.
void VReverse();
//! Returns true if the local coordinate system of this cylinder is right-handed.
Standard_Boolean Direct() const;
//! Returns the symmetry axis of the cylinder.
const gp_Ax1& Axis() const;
//! Computes the coefficients of the implicit equation of the quadric
//! in the absolute cartesian coordinate system :
//! A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) +
//! 2.(C1.X + C2.Y + C3.Z) + D = 0.0
Standard_EXPORT void Coefficients (Standard_Real& A1, Standard_Real& A2, Standard_Real& A3, Standard_Real& B1, Standard_Real& B2, Standard_Real& B3, Standard_Real& C1, Standard_Real& C2, Standard_Real& C3, Standard_Real& D) const;
//! Returns the "Location" point of the cylinder.
const gp_Pnt& Location() const;
//! Returns the local coordinate system of the cylinder.
const gp_Ax3& Position() const;
//! Returns the radius of the cylinder.
Standard_Real Radius() const;
//! Returns the axis X of the cylinder.
gp_Ax1 XAxis() const;
//! Returns the axis Y of the cylinder.
gp_Ax1 YAxis() const;
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of a cylinder
//! with respect to the point P which is the center of the
//! symmetry.
Standard_EXPORT gp_Cylinder Mirrored (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of a cylinder with
//! respect to an axis placement which is the axis of the
//! symmetry.
Standard_EXPORT gp_Cylinder Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of a cylinder with respect
//! to a plane. The axis placement A2 locates the plane of the
//! of the symmetry : (Location, XDirection, YDirection).
Standard_EXPORT gp_Cylinder Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates a cylinder. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Cylinder Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Scales a cylinder. S is the scaling value.
//! The absolute value of S is used to scale the cylinder
gp_Cylinder Scaled (const gp_Pnt& P, const Standard_Real S) const;
void Transform (const gp_Trsf& T);
//! Transforms a cylinder with the transformation T from class Trsf.
gp_Cylinder Transformed (const gp_Trsf& T) const;
void Translate (const gp_Vec& V);
//! Translates a cylinder in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Cylinder Translated (const gp_Vec& V) const;
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates a cylinder from the point P1 to the point P2.
gp_Cylinder Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Ax3 pos;
Standard_Real radius;
};
#include <gp_Cylinder.lxx>
#endif // _gp_Cylinder_HeaderFile

View File

@@ -1,319 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Dir from gp
---Purpose:
-- Describes a unit vector in 3D space. This unit vector is also called "Direction".
-- See Also
-- gce_MakeDir which provides functions for more complex
-- unit vector constructions
-- Geom_Direction which provides additional functions for
-- constructing unit vectors and works, in particular, with the
-- parametric equations of unit vectors.
uses Ax1 from gp,
Ax2 from gp,
Trsf from gp,
Vec from gp,
XYZ from gp
raises ConstructionError from Standard,
DomainError from Standard,
OutOfRange from Standard
is
Create returns Dir;
---C++:inline
--- Purpose : Creates a direction corresponding to X axis.
Create (V : Vec) returns Dir
---C++:inline
--- Purpose : Normalizes the vector V and creates a direction. Raises ConstructionError if V.Magnitude() <= Resolution.
raises ConstructionError;
Create (Coord : XYZ) returns Dir
---C++:inline
--- Purpose : Creates a direction from a triplet of coordinates. Raises ConstructionError if Coord.Modulus() <= Resolution from gp.
raises ConstructionError;
Create ( Xv, Yv, Zv : Real) returns Dir
---C++:inline
--- Purpose : Creates a direction with its 3 cartesian coordinates. Raises ConstructionError if Sqrt(Xv*Xv + Yv*Yv + Zv*Zv) <= Resolution
raises ConstructionError;
--- Purpose : Modification of the direction's coordinates
-- If Sqrt (X*X + Y*Y + Z*Z) <= Resolution from gp where
-- X, Y ,Z are the new coordinates it is not possible to
-- construct the direction and the method raises the
-- exception ConstructionError.
SetCoord (me: in out; Index : Integer; Xi : Real)
---C++:inline
---Purpose:
-- For this unit vector, assigns the value Xi to:
-- - the X coordinate if Index is 1, or
-- - the Y coordinate if Index is 2, or
-- - the Z coordinate if Index is 3,
-- and then normalizes it.
-- Warning
-- Remember that all the coordinates of a unit vector are
-- implicitly modified when any single one is changed directly.
-- Exceptions
-- Standard_OutOfRange if Index is not 1, 2, or 3.
-- Standard_ConstructionError if either of the following
-- is less than or equal to gp::Resolution():
-- - Sqrt(Xv*Xv + Yv*Yv + Zv*Zv), or
-- - the modulus of the number triple formed by the new
-- value Xi and the two other coordinates of this vector
-- that were not directly modified.
raises OutOfRange,
ConstructionError
is static;
SetCoord (me : in out; Xv, Yv, Zv : Real) raises ConstructionError is static;
---C++:inline
---Purpose: For this unit vector, assigns the values Xv, Yv and Zv to its three coordinates.
-- Remember that all the coordinates of a unit vector are
-- implicitly modified when any single one is changed directly.
SetX (me: in out; X : Real) raises ConstructionError is static;
---C++:inline
---Purpose: Assigns the given value to the X coordinate of this unit vector.
SetY (me: in out; Y : Real) raises ConstructionError is static;
---C++:inline
---Purpose: Assigns the given value to the Y coordinate of this unit vector.
SetZ (me: in out; Z : Real) raises ConstructionError is static;
---C++:inline
---Purpose: Assigns the given value to the Z coordinate of this unit vector.
SetXYZ (me: in out; Coord : XYZ) raises ConstructionError is static;
---C++:inline
---Purpose: Assigns the three coordinates of Coord to this unit vector.
Coord (me; Index : Integer) returns Real
---C++:inline
--- Purpose :
-- Returns the coordinate of range Index :
-- Index = 1 => X is returned
-- Index = 2 => Y is returned
-- Index = 3 => Z is returned
-- Exceptions
-- Standard_OutOfRange if Index is not 1, 2, or 3.
raises OutOfRange
is static;
Coord (me; Xv, Yv, Zv : out Real) is static;
---C++:inline
---Purpose: Returns for the unit vector its three coordinates Xv, Yv, and Zv.
X (me) returns Real is static;
---C++:inline
---Purpose: Returns the X coordinate for a unit vector.
Y (me) returns Real is static;
---C++:inline
---Purpose: Returns the Y coordinate for a unit vector.
Z (me) returns Real is static;
---C++:inline
---Purpose: Returns the Z coordinate for a unit vector.
XYZ (me) returns XYZ is static;
---C++: inline
---C++: return const&
--- Purpose : for this unit vector, returns its three coordinates as a number triplea.
IsEqual (me; Other : Dir; AngularTolerance : Real) returns Boolean
is static;
---C++:inline
--- Purpose :
-- Returns True if the angle between the two directions is
-- lower or equal to AngularTolerance.
IsNormal(me; Other : Dir; AngularTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose :
-- Returns True if the angle between this unit vector and the unit vector Other is equal to Pi/2 (normal).
IsOpposite (me; Other : Dir; AngularTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose:
-- Returns True if the angle between this unit vector and the unit vector Other is equal to Pi (opposite).
IsParallel (me; Other : Dir; AngularTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose :
-- Returns true if the angle between this unit vector and the
-- unit vector Other is equal to 0 or to Pi.
-- Note: the tolerance criterion is given by AngularTolerance.
Angle (me; Other : Dir) returns Real is static;
--- Purpose :
-- Computes the angular value in radians between <me> and
-- <Other>. This value is always positive in 3D space.
-- Returns the angle in the range [0, PI]
AngleWithRef (me; Other, VRef : Dir) returns Real
--- Purpose :
-- Computes the angular value between <me> and <Other>.
-- <VRef> is the direction of reference normal to <me> and <Other>
-- and its orientation gives the positive sense of rotation.
-- If the cross product <me> ^ <Other> has the same orientation
-- as <VRef> the angular value is positive else negative.
-- Returns the angular value in the range -PI and PI (in radians). Raises DomainError if <me> and <Other> are not parallel this exception is raised
-- when <VRef> is in the same plane as <me> and <Other>
-- The tolerance criterion is Resolution from package gp.
raises DomainError
is static;
Cross (me : in out; Right : Dir) raises ConstructionError is static;
--- Purpose : Computes the cross product between two directions
-- Raises the exception ConstructionError if the two directions
-- are parallel because the computed vector cannot be normalized
-- to create a direction.
---C++: inline
---C++: alias operator ^=
Crossed (me; Right : Dir) returns Dir raises ConstructionError is static;
--- Purpose : Computes the triple vector product.
-- <me> ^ (V1 ^ V2)
-- Raises the exception ConstructionError if V1 and V2 are parallel
-- or <me> and (V1^V2) are parallel because the computed vector
-- can't be normalized to create a direction.
---C++: inline
---C++: alias operator ^
CrossCross (me : in out; V1, V2 : Dir) raises ConstructionError is static;
--- Propose: Computes the double vector product this ^ (V1 ^ V2).
-- CrossCross assigns the result to this unit vector
-- Exceptions
-- Standard_ConstructionError if:
-- - V1 and V2 are parallel, or
-- - this unit vector and (V1 ^ V2) are parallel.
-- This is because, in these conditions, the computed vector
-- is null and cannot be normalized.
---C++: inline
CrossCrossed (me; V1, V2 : Dir) returns Dir raises ConstructionError
is static;
--- Purpose: Computes the double vector product this ^ (V1 ^ V2).
-- - CrossCrossed creates a new unit vector.
-- Exceptions
-- Standard_ConstructionError if:
-- - V1 and V2 are parallel, or
-- - this unit vector and (V1 ^ V2) are parallel.
-- This is because, in these conditions, the computed vector
-- is null and cannot be normalized.
---C++: inline
Dot (me; Other : Dir) returns Real is static;
--- Purpose : Computes the scalar product
---C++: inline
---C++: alias operator *
DotCross (me; V1, V2 : Dir) returns Real is static;
--- Purpose :
-- Computes the triple scalar product <me> * (V1 ^ V2).
-- Warnings :
-- The computed vector V1' = V1 ^ V2 is not normalized
-- to create a unitary vector. So this method never
-- raises an exception even if V1 and V2 are parallel.
---C++: inline
Reverse (me : in out) is static;
---C++: inline
Reversed (me) returns Dir is static;
--- Purpose : Reverses the orientation of a direction
---C++: inline
---C++: alias operator -
--- Purpose : geometric transformations
-- Performs the symmetrical transformation of a direction
-- with respect to the direction V which is the center of
-- the symmetry.]
Mirror (me : in out; V : Dir) is static;
Mirrored (me; V : Dir) returns Dir is static;
--- Purpose :
-- Performs the symmetrical transformation of a direction
-- with respect to the direction V which is the center of
-- the symmetry.
Mirror (me : in out; A1 : Ax1) is static;
Mirrored (me; A1 : Ax1) returns Dir is static;
--- Purpose :
-- Performs the symmetrical transformation of a direction
-- with respect to an axis placement which is the axis
-- of the symmetry.
Mirror (me : in out; A2 : Ax2) is static;
Mirrored (me; A2 : Ax2) returns Dir is static;
--- Purpose :
-- Performs the symmetrical transformation of a direction
-- with respect to a plane. The axis placement A2 locates
-- the plane of the symmetry : (Location, XDirection, YDirection).
Rotate (me : in out; A1 : Ax1; Ang : Real) is static;
---C++: inline
Rotated (me; A1 : Ax1; Ang : Real) returns Dir is static;
---C++: inline
--- Purpose :
-- Rotates a direction. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Transform (me : in out; T : Trsf) is static;
Transformed (me; T : Trsf) returns Dir is static;
--- Purpose :
-- Transforms a direction with a "Trsf" from gp.
-- Warnings :
-- If the scale factor of the "Trsf" T is negative then the
-- direction <me> is reversed.
---C++: inline
fields
coord : XYZ;
end;

View File

@@ -14,8 +14,15 @@
// JCV 07/12/90 Modifs suite a l'introduction des classes XYZ et Mat dans gp
#include <gp_Dir.ixx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Dir.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <gp_XYZ.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_OutOfRange.hxx>
Standard_Real gp_Dir::Angle (const gp_Dir& Other) const
{

290
src/gp/gp_Dir.hxx Normal file
View File

@@ -0,0 +1,290 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Dir_HeaderFile
#define _gp_Dir_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_XYZ.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class Standard_ConstructionError;
class Standard_DomainError;
class Standard_OutOfRange;
class gp_Vec;
class gp_XYZ;
class gp_Ax1;
class gp_Ax2;
class gp_Trsf;
//! Describes a unit vector in 3D space. This unit vector is also called "Direction".
//! See Also
//! gce_MakeDir which provides functions for more complex
//! unit vector constructions
//! Geom_Direction which provides additional functions for
//! constructing unit vectors and works, in particular, with the
//! parametric equations of unit vectors.
class gp_Dir
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a direction corresponding to X axis.
gp_Dir();
//! Normalizes the vector V and creates a direction. Raises ConstructionError if V.Magnitude() <= Resolution.
gp_Dir(const gp_Vec& V);
//! Creates a direction from a triplet of coordinates. Raises ConstructionError if Coord.Modulus() <= Resolution from gp.
gp_Dir(const gp_XYZ& Coord);
//! Creates a direction with its 3 cartesian coordinates. Raises ConstructionError if Sqrt(Xv*Xv + Yv*Yv + Zv*Zv) <= Resolution
//! Modification of the direction's coordinates
//! If Sqrt (X*X + Y*Y + Z*Z) <= Resolution from gp where
//! X, Y ,Z are the new coordinates it is not possible to
//! construct the direction and the method raises the
//! exception ConstructionError.
gp_Dir(const Standard_Real Xv, const Standard_Real Yv, const Standard_Real Zv);
//! For this unit vector, assigns the value Xi to:
//! - the X coordinate if Index is 1, or
//! - the Y coordinate if Index is 2, or
//! - the Z coordinate if Index is 3,
//! and then normalizes it.
//! Warning
//! Remember that all the coordinates of a unit vector are
//! implicitly modified when any single one is changed directly.
//! Exceptions
//! Standard_OutOfRange if Index is not 1, 2, or 3.
//! Standard_ConstructionError if either of the following
//! is less than or equal to gp::Resolution():
//! - Sqrt(Xv*Xv + Yv*Yv + Zv*Zv), or
//! - the modulus of the number triple formed by the new
//! value Xi and the two other coordinates of this vector
//! that were not directly modified.
void SetCoord (const Standard_Integer Index, const Standard_Real Xi);
//! For this unit vector, assigns the values Xv, Yv and Zv to its three coordinates.
//! Remember that all the coordinates of a unit vector are
//! implicitly modified when any single one is changed directly.
void SetCoord (const Standard_Real Xv, const Standard_Real Yv, const Standard_Real Zv);
//! Assigns the given value to the X coordinate of this unit vector.
void SetX (const Standard_Real X);
//! Assigns the given value to the Y coordinate of this unit vector.
void SetY (const Standard_Real Y);
//! Assigns the given value to the Z coordinate of this unit vector.
void SetZ (const Standard_Real Z);
//! Assigns the three coordinates of Coord to this unit vector.
void SetXYZ (const gp_XYZ& Coord);
//! Returns the coordinate of range Index :
//! Index = 1 => X is returned
//! Index = 2 => Y is returned
//! Index = 3 => Z is returned
//! Exceptions
//! Standard_OutOfRange if Index is not 1, 2, or 3.
Standard_Real Coord (const Standard_Integer Index) const;
//! Returns for the unit vector its three coordinates Xv, Yv, and Zv.
void Coord (Standard_Real& Xv, Standard_Real& Yv, Standard_Real& Zv) const;
//! Returns the X coordinate for a unit vector.
Standard_Real X() const;
//! Returns the Y coordinate for a unit vector.
Standard_Real Y() const;
//! Returns the Z coordinate for a unit vector.
Standard_Real Z() const;
//! for this unit vector, returns its three coordinates as a number triplea.
const gp_XYZ& XYZ() const;
//! Returns True if the angle between the two directions is
//! lower or equal to AngularTolerance.
Standard_Boolean IsEqual (const gp_Dir& Other, const Standard_Real AngularTolerance) const;
//! Returns True if the angle between this unit vector and the unit vector Other is equal to Pi/2 (normal).
Standard_Boolean IsNormal (const gp_Dir& Other, const Standard_Real AngularTolerance) const;
//! Returns True if the angle between this unit vector and the unit vector Other is equal to Pi (opposite).
Standard_Boolean IsOpposite (const gp_Dir& Other, const Standard_Real AngularTolerance) const;
//! Returns true if the angle between this unit vector and the
//! unit vector Other is equal to 0 or to Pi.
//! Note: the tolerance criterion is given by AngularTolerance.
Standard_Boolean IsParallel (const gp_Dir& Other, const Standard_Real AngularTolerance) const;
//! Computes the angular value in radians between <me> and
//! <Other>. This value is always positive in 3D space.
//! Returns the angle in the range [0, PI]
Standard_EXPORT Standard_Real Angle (const gp_Dir& Other) const;
//! Computes the angular value between <me> and <Other>.
//! <VRef> is the direction of reference normal to <me> and <Other>
//! and its orientation gives the positive sense of rotation.
//! If the cross product <me> ^ <Other> has the same orientation
//! as <VRef> the angular value is positive else negative.
//! Returns the angular value in the range -PI and PI (in radians). Raises DomainError if <me> and <Other> are not parallel this exception is raised
//! when <VRef> is in the same plane as <me> and <Other>
//! The tolerance criterion is Resolution from package gp.
Standard_EXPORT Standard_Real AngleWithRef (const gp_Dir& Other, const gp_Dir& VRef) const;
//! Computes the cross product between two directions
//! Raises the exception ConstructionError if the two directions
//! are parallel because the computed vector cannot be normalized
//! to create a direction.
void Cross (const gp_Dir& Right);
void operator ^= (const gp_Dir& Right)
{
Cross(Right);
}
//! Computes the triple vector product.
//! <me> ^ (V1 ^ V2)
//! Raises the exception ConstructionError if V1 and V2 are parallel
//! or <me> and (V1^V2) are parallel because the computed vector
//! can't be normalized to create a direction.
gp_Dir Crossed (const gp_Dir& Right) const;
gp_Dir operator ^ (const gp_Dir& Right) const
{
return Crossed(Right);
}
void CrossCross (const gp_Dir& V1, const gp_Dir& V2);
//! Computes the double vector product this ^ (V1 ^ V2).
//! - CrossCrossed creates a new unit vector.
//! Exceptions
//! Standard_ConstructionError if:
//! - V1 and V2 are parallel, or
//! - this unit vector and (V1 ^ V2) are parallel.
//! This is because, in these conditions, the computed vector
//! is null and cannot be normalized.
gp_Dir CrossCrossed (const gp_Dir& V1, const gp_Dir& V2) const;
//! Computes the scalar product
Standard_Real Dot (const gp_Dir& Other) const;
Standard_Real operator * (const gp_Dir& Other) const
{
return Dot(Other);
}
//! Computes the triple scalar product <me> * (V1 ^ V2).
//! Warnings :
//! The computed vector V1' = V1 ^ V2 is not normalized
//! to create a unitary vector. So this method never
//! raises an exception even if V1 and V2 are parallel.
Standard_Real DotCross (const gp_Dir& V1, const gp_Dir& V2) const;
void Reverse();
//! Reverses the orientation of a direction
//! geometric transformations
//! Performs the symmetrical transformation of a direction
//! with respect to the direction V which is the center of
//! the symmetry.]
gp_Dir Reversed() const;
gp_Dir operator -() const
{
return Reversed();
}
Standard_EXPORT void Mirror (const gp_Dir& V);
//! Performs the symmetrical transformation of a direction
//! with respect to the direction V which is the center of
//! the symmetry.
Standard_EXPORT gp_Dir Mirrored (const gp_Dir& V) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of a direction
//! with respect to an axis placement which is the axis
//! of the symmetry.
Standard_EXPORT gp_Dir Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of a direction
//! with respect to a plane. The axis placement A2 locates
//! the plane of the symmetry : (Location, XDirection, YDirection).
Standard_EXPORT gp_Dir Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates a direction. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Dir Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
Standard_EXPORT void Transform (const gp_Trsf& T);
//! Transforms a direction with a "Trsf" from gp.
//! Warnings :
//! If the scale factor of the "Trsf" T is negative then the
//! direction <me> is reversed.
gp_Dir Transformed (const gp_Trsf& T) const;
protected:
private:
gp_XYZ coord;
};
#include <gp_Dir.lxx>
#endif // _gp_Dir_HeaderFile

View File

@@ -1,293 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Dir2d from gp
---Purpose: Describes a unit vector in the plane (2D space). This unit
-- vector is also called "Direction".
-- See Also
-- gce_MakeDir2d which provides functions for more
-- complex unit vector constructions
-- Geom2d_Direction which provides additional functions
-- for constructing unit vectors and works, in particular, with
-- the parametric equations of unit vectors
uses Ax2d from gp,
Trsf2d from gp,
Vec2d from gp,
XY from gp
raises ConstructionError from Standard,
DomainError from Standard,
OutOfRange from Standard
is
Create returns Dir2d;
--- Purpose : Creates a direction corresponding to X axis.
---C++:inline
Create (V : Vec2d) returns Dir2d
--- Purpose : Normalizes the vector V and creates a Direction. Raises ConstructionError if V.Magnitude() <= Resolution from gp.
---C++:inline
raises ConstructionError;
Create (Coord : XY) returns Dir2d
--- Purpose : Creates a Direction from a doublet of coordinates. Raises ConstructionError if Coord.Modulus() <= Resolution from gp.
---C++:inline
raises ConstructionError;
Create ( Xv, Yv : Real) returns Dir2d
--- Purpose : Creates a Direction with its 2 cartesian coordinates. Raises ConstructionError if Sqrt(Xv*Xv + Yv*Yv) <= Resolution from gp.
---C++:inline
raises ConstructionError;
SetCoord (me: in out; Index : Integer; Xi : Real)
---C++:inline
--- Purpose :
-- For this unit vector, assigns:
-- the value Xi to:
-- - the X coordinate if Index is 1, or
-- - the Y coordinate if Index is 2, and then normalizes it.
-- Warning
-- Remember that all the coordinates of a unit vector are
-- implicitly modified when any single one is changed directly.
-- Exceptions
-- Standard_OutOfRange if Index is not 1 or 2.
-- Standard_ConstructionError if either of the following
-- is less than or equal to gp::Resolution():
-- - Sqrt(Xv*Xv + Yv*Yv), or
-- - the modulus of the number pair formed by the new
-- value Xi and the other coordinate of this vector that
-- was not directly modified.
-- Raises OutOfRange if Index != {1, 2}.
raises OutOfRange,
ConstructionError
is static;
SetCoord (me : in out; Xv, Yv : Real) raises ConstructionError is static;
---C++:inline
--- Purpose :
-- For this unit vector, assigns:
-- - the values Xv and Yv to its two coordinates,
-- Warning
-- Remember that all the coordinates of a unit vector are
-- implicitly modified when any single one is changed directly.
-- Exceptions
-- Standard_OutOfRange if Index is not 1 or 2.
-- Standard_ConstructionError if either of the following
-- is less than or equal to gp::Resolution():
-- - Sqrt(Xv*Xv + Yv*Yv), or
-- - the modulus of the number pair formed by the new
-- value Xi and the other coordinate of this vector that
-- was not directly modified.
-- Raises OutOfRange if Index != {1, 2}.
SetX (me: in out; X : Real) raises ConstructionError is static;
---C++:inline
---Purpose:
-- Assigns the given value to the X coordinate of this unit vector,
-- and then normalizes it.
-- Warning
-- Remember that all the coordinates of a unit vector are
-- implicitly modified when any single one is changed directly.
-- Exceptions
-- Standard_ConstructionError if either of the following
-- is less than or equal to gp::Resolution():
-- - the modulus of Coord, or
-- - the modulus of the number pair formed from the new
-- X or Y coordinate and the other coordinate of this
-- vector that was not directly modified.
SetY (me: in out; Y : Real) raises ConstructionError is static;
---C++:inline
---Purpose:
-- Assigns the given value to the Y coordinate of this unit vector,
-- and then normalizes it.
-- Warning
-- Remember that all the coordinates of a unit vector are
-- implicitly modified when any single one is changed directly.
-- Exceptions
-- Standard_ConstructionError if either of the following
-- is less than or equal to gp::Resolution():
-- - the modulus of Coord, or
-- - the modulus of the number pair formed from the new
-- X or Y coordinate and the other coordinate of this
-- vector that was not directly modified.
SetXY (me: in out; Coord : XY) raises ConstructionError is static;
---C++:inline
---Purpose:
-- Assigns:
-- - the two coordinates of Coord to this unit vector,
-- and then normalizes it.
-- Warning
-- Remember that all the coordinates of a unit vector are
-- implicitly modified when any single one is changed directly.
-- Exceptions
-- Standard_ConstructionError if either of the following
-- is less than or equal to gp::Resolution():
-- - the modulus of Coord, or
-- - the modulus of the number pair formed from the new
-- X or Y coordinate and the other coordinate of this
-- vector that was not directly modified.
Coord (me; Index : Integer) returns Real
---C++:inline
--- Purpose :
-- For this unit vector returns the coordinate of range Index :
-- Index = 1 => X is returned
-- Index = 2 => Y is returned
-- Raises OutOfRange if Index != {1, 2}.
raises OutOfRange
is static;
Coord (me; Xv, Yv : out Real) is static;
---C++:inline
---Purpose: For this unit vector returns its two coordinates Xv and Yv.
-- Raises OutOfRange if Index != {1, 2}.
X (me) returns Real is static;
---C++:inline
--- Purpose: For this unit vector, returns its X coordinate.
Y (me) returns Real is static;
---C++:inline
--- Purpose: For this unit vector, returns its Y coordinate.
XY (me) returns XY is static;
---C++: inline
---C++: return const&
--- Purpose: For this unit vector, returns its two coordinates as a number pair.
--- Purpose : Comparison between Directions
-- The precision value is an input data.
IsEqual (me; Other : Dir2d; AngularTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose :
-- Returns True if the two vectors have the same direction
-- i.e. the angle between this unit vector and the
-- unit vector Other is less than or equal to AngularTolerance.
IsNormal (me; Other : Dir2d; AngularTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose :
-- Returns True if the angle between this unit vector and the
-- unit vector Other is equal to Pi/2 or -Pi/2 (normal)
-- i.e. Abs(Abs(<me>.Angle(Other)) - PI/2.) <= AngularTolerance
IsOpposite (me; Other : Dir2d; AngularTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose :
-- Returns True if the angle between this unit vector and the
-- unit vector Other is equal to Pi or -Pi (opposite).
-- i.e. PI - Abs(<me>.Angle(Other)) <= AngularTolerance
IsParallel (me; Other : Dir2d; AngularTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose :
-- returns true if if the angle between this unit vector and unit
-- vector Other is equal to 0, Pi or -Pi.
-- i.e. Abs(Angle(<me>, Other)) <= AngularTolerance or
-- PI - Abs(Angle(<me>, Other)) <= AngularTolerance
Angle (me; Other : Dir2d) returns Real is static;
--- Purpose :
-- Computes the angular value in radians between <me> and
-- <Other>. Returns the angle in the range [-PI, PI].
Crossed (me; Right : Dir2d) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the cross product between two directions.
---C++: alias operator ^
Dot (me; Other : Dir2d) returns Real is static;
---C++: inline
--- Purpose : Computes the scalar product
---C++: alias operator *
Reverse (me : in out) is static;
---C++: inline
Reversed (me) returns Dir2d is static;
---C++: inline
---C++: alias operator -
--- Purpose : Reverses the orientation of a direction
Mirror (me : in out; V : Dir2d) is static;
Mirrored (me; V : Dir2d) returns Dir2d is static;
--- Purpose :
-- Performs the symmetrical transformation of a direction
-- with respect to the direction V which is the center of
-- the symmetry.
Mirror (me : in out; A : Ax2d) is static;
Mirrored (me; A : Ax2d) returns Dir2d is static;
--- Purpose :
-- Performs the symmetrical transformation of a direction
-- with respect to an axis placement which is the axis
-- of the symmetry.
Rotate (me : in out; Ang : Real) is static;
---C++: inline
Rotated (me; Ang : Real) returns Dir2d is static;
--- Purpose :
-- Rotates a direction. Ang is the angular value of
-- the rotation in radians.
---C++: inline
Transform (me : in out; T : Trsf2d) is static;
Transformed (me; T : Trsf2d) returns Dir2d is static;
---C++: inline
--- Purpose :
-- Transforms a direction with the "Trsf" T.
--- Warnings :
-- If the scale factor of the "Trsf" T is negative then the
-- direction <me> is reversed.
fields
coord : XY;
end;

View File

@@ -14,7 +14,14 @@
// JCV 08/01/90 Modifs suite a l'introduction des classes XY et Mat2d dans gp
#include <gp_Dir2d.ixx>
#include <gp_Ax2d.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <gp_XY.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_OutOfRange.hxx>
Standard_Real gp_Dir2d::Angle (const gp_Dir2d& Other) const
{

277
src/gp/gp_Dir2d.hxx Normal file
View File

@@ -0,0 +1,277 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Dir2d_HeaderFile
#define _gp_Dir2d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_XY.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class Standard_ConstructionError;
class Standard_DomainError;
class Standard_OutOfRange;
class gp_Vec2d;
class gp_XY;
class gp_Ax2d;
class gp_Trsf2d;
//! Describes a unit vector in the plane (2D space). This unit
//! vector is also called "Direction".
//! See Also
//! gce_MakeDir2d which provides functions for more
//! complex unit vector constructions
//! Geom2d_Direction which provides additional functions
//! for constructing unit vectors and works, in particular, with
//! the parametric equations of unit vectors
class gp_Dir2d
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a direction corresponding to X axis.
gp_Dir2d();
//! Normalizes the vector V and creates a Direction. Raises ConstructionError if V.Magnitude() <= Resolution from gp.
gp_Dir2d(const gp_Vec2d& V);
//! Creates a Direction from a doublet of coordinates. Raises ConstructionError if Coord.Modulus() <= Resolution from gp.
gp_Dir2d(const gp_XY& Coord);
//! Creates a Direction with its 2 cartesian coordinates. Raises ConstructionError if Sqrt(Xv*Xv + Yv*Yv) <= Resolution from gp.
gp_Dir2d(const Standard_Real Xv, const Standard_Real Yv);
//! For this unit vector, assigns:
//! the value Xi to:
//! - the X coordinate if Index is 1, or
//! - the Y coordinate if Index is 2, and then normalizes it.
//! Warning
//! Remember that all the coordinates of a unit vector are
//! implicitly modified when any single one is changed directly.
//! Exceptions
//! Standard_OutOfRange if Index is not 1 or 2.
//! Standard_ConstructionError if either of the following
//! is less than or equal to gp::Resolution():
//! - Sqrt(Xv*Xv + Yv*Yv), or
//! - the modulus of the number pair formed by the new
//! value Xi and the other coordinate of this vector that
//! was not directly modified.
//! Raises OutOfRange if Index != {1, 2}.
void SetCoord (const Standard_Integer Index, const Standard_Real Xi);
//! For this unit vector, assigns:
//! - the values Xv and Yv to its two coordinates,
//! Warning
//! Remember that all the coordinates of a unit vector are
//! implicitly modified when any single one is changed directly.
//! Exceptions
//! Standard_OutOfRange if Index is not 1 or 2.
//! Standard_ConstructionError if either of the following
//! is less than or equal to gp::Resolution():
//! - Sqrt(Xv*Xv + Yv*Yv), or
//! - the modulus of the number pair formed by the new
//! value Xi and the other coordinate of this vector that
//! was not directly modified.
//! Raises OutOfRange if Index != {1, 2}.
void SetCoord (const Standard_Real Xv, const Standard_Real Yv);
//! Assigns the given value to the X coordinate of this unit vector,
//! and then normalizes it.
//! Warning
//! Remember that all the coordinates of a unit vector are
//! implicitly modified when any single one is changed directly.
//! Exceptions
//! Standard_ConstructionError if either of the following
//! is less than or equal to gp::Resolution():
//! - the modulus of Coord, or
//! - the modulus of the number pair formed from the new
//! X or Y coordinate and the other coordinate of this
//! vector that was not directly modified.
void SetX (const Standard_Real X);
//! Assigns the given value to the Y coordinate of this unit vector,
//! and then normalizes it.
//! Warning
//! Remember that all the coordinates of a unit vector are
//! implicitly modified when any single one is changed directly.
//! Exceptions
//! Standard_ConstructionError if either of the following
//! is less than or equal to gp::Resolution():
//! - the modulus of Coord, or
//! - the modulus of the number pair formed from the new
//! X or Y coordinate and the other coordinate of this
//! vector that was not directly modified.
void SetY (const Standard_Real Y);
//! Assigns:
//! - the two coordinates of Coord to this unit vector,
//! and then normalizes it.
//! Warning
//! Remember that all the coordinates of a unit vector are
//! implicitly modified when any single one is changed directly.
//! Exceptions
//! Standard_ConstructionError if either of the following
//! is less than or equal to gp::Resolution():
//! - the modulus of Coord, or
//! - the modulus of the number pair formed from the new
//! X or Y coordinate and the other coordinate of this
//! vector that was not directly modified.
void SetXY (const gp_XY& Coord);
//! For this unit vector returns the coordinate of range Index :
//! Index = 1 => X is returned
//! Index = 2 => Y is returned
//! Raises OutOfRange if Index != {1, 2}.
Standard_Real Coord (const Standard_Integer Index) const;
//! For this unit vector returns its two coordinates Xv and Yv.
//! Raises OutOfRange if Index != {1, 2}.
void Coord (Standard_Real& Xv, Standard_Real& Yv) const;
//! For this unit vector, returns its X coordinate.
Standard_Real X() const;
//! For this unit vector, returns its Y coordinate.
Standard_Real Y() const;
//! For this unit vector, returns its two coordinates as a number pair.
//! Comparison between Directions
//! The precision value is an input data.
const gp_XY& XY() const;
//! Returns True if the two vectors have the same direction
//! i.e. the angle between this unit vector and the
//! unit vector Other is less than or equal to AngularTolerance.
Standard_Boolean IsEqual (const gp_Dir2d& Other, const Standard_Real AngularTolerance) const;
//! Returns True if the angle between this unit vector and the
//! unit vector Other is equal to Pi/2 or -Pi/2 (normal)
//! i.e. Abs(Abs(<me>.Angle(Other)) - PI/2.) <= AngularTolerance
Standard_Boolean IsNormal (const gp_Dir2d& Other, const Standard_Real AngularTolerance) const;
//! Returns True if the angle between this unit vector and the
//! unit vector Other is equal to Pi or -Pi (opposite).
//! i.e. PI - Abs(<me>.Angle(Other)) <= AngularTolerance
Standard_Boolean IsOpposite (const gp_Dir2d& Other, const Standard_Real AngularTolerance) const;
//! returns true if if the angle between this unit vector and unit
//! vector Other is equal to 0, Pi or -Pi.
//! i.e. Abs(Angle(<me>, Other)) <= AngularTolerance or
//! PI - Abs(Angle(<me>, Other)) <= AngularTolerance
Standard_Boolean IsParallel (const gp_Dir2d& Other, const Standard_Real AngularTolerance) const;
//! Computes the angular value in radians between <me> and
//! <Other>. Returns the angle in the range [-PI, PI].
Standard_EXPORT Standard_Real Angle (const gp_Dir2d& Other) const;
//! Computes the cross product between two directions.
Standard_Real Crossed (const gp_Dir2d& Right) const;
Standard_Real operator ^ (const gp_Dir2d& Right) const
{
return Crossed(Right);
}
//! Computes the scalar product
Standard_Real Dot (const gp_Dir2d& Other) const;
Standard_Real operator * (const gp_Dir2d& Other) const
{
return Dot(Other);
}
void Reverse();
//! Reverses the orientation of a direction
gp_Dir2d Reversed() const;
gp_Dir2d operator -() const
{
return Reversed();
}
Standard_EXPORT void Mirror (const gp_Dir2d& V);
//! Performs the symmetrical transformation of a direction
//! with respect to the direction V which is the center of
//! the symmetry.
Standard_EXPORT gp_Dir2d Mirrored (const gp_Dir2d& V) const;
Standard_EXPORT void Mirror (const gp_Ax2d& A);
//! Performs the symmetrical transformation of a direction
//! with respect to an axis placement which is the axis
//! of the symmetry.
Standard_EXPORT gp_Dir2d Mirrored (const gp_Ax2d& A) const;
void Rotate (const Standard_Real Ang);
//! Rotates a direction. Ang is the angular value of
//! the rotation in radians.
gp_Dir2d Rotated (const Standard_Real Ang) const;
Standard_EXPORT void Transform (const gp_Trsf2d& T);
//! Transforms a direction with the "Trsf" T.
//! Warnings :
//! If the scale factor of the "Trsf" T is negative then the
//! direction <me> is reversed.
gp_Dir2d Transformed (const gp_Trsf2d& T) const;
protected:
private:
gp_XY coord;
};
#include <gp_Dir2d.lxx>
#endif // _gp_Dir2d_HeaderFile

View File

@@ -1,341 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Elips from gp
--- Purpose :
-- Describes an ellipse in 3D space.
-- An ellipse is defined by its major and minor radii and
-- positioned in space with a coordinate system (a gp_Ax2 object) as follows:
-- - the origin of the coordinate system is the center of the ellipse,
-- - its "X Direction" defines the major axis of the ellipse, and
-- - its "Y Direction" defines the minor axis of the ellipse.
-- Together, the origin, "X Direction" and "Y Direction" of
-- this coordinate system define the plane of the ellipse.
-- This coordinate system is the "local coordinate system"
-- of the ellipse. In this coordinate system, the equation of
-- the ellipse is:
-- X*X / (MajorRadius**2) + Y*Y / (MinorRadius**2) = 1.0
-- The "main Direction" of the local coordinate system gives
-- the normal vector to the plane of the ellipse. This vector
-- gives an implicit orientation to the ellipse (definition of the
-- trigonometric sense). We refer to the "main Axis" of the
-- local coordinate system as the "Axis" of the ellipse.
-- See Also
-- gce_MakeElips which provides functions for more
-- complex ellipse constructions
-- Geom_Ellipse which provides additional functions for
-- constructing ellipses and works, in particular, with the
-- parametric equations of ellipses
uses Ax1 from gp,
Ax2 from gp,
Pnt from gp,
Trsf from gp,
Vec from gp
raises ConstructionError from Standard
is
Create returns Elips;
---C++:inline
--- Purpose : Creates an indefinite ellipse.
Create (A2 : Ax2; MajorRadius, MinorRadius : Real) returns Elips
---C++: inline
--- Purpose :
-- The major radius of the ellipse is on the "XAxis" and the
-- minor radius is on the "YAxis" of the ellipse. The "XAxis"
-- is defined with the "XDirection" of A2 and the "YAxis" is
-- defined with the "YDirection" of A2.
-- Warnings :
-- It is not forbidden to create an ellipse with MajorRadius =
-- MinorRadius.
-- Raises ConstructionError if MajorRadius < MinorRadius or MinorRadius < 0.
raises ConstructionError;
SetAxis (me : in out; A1 : Ax1)
---C++:inline
--- Purpose :
-- Changes the axis normal to the plane of the ellipse.
-- It modifies the definition of this plane.
-- The "XAxis" and the "YAxis" are recomputed.
-- The local coordinate system is redefined so that:
-- - its origin and "main Direction" become those of the
-- axis A1 (the "X Direction" and "Y Direction" are then
-- recomputed in the same way as for any gp_Ax2), or
-- Raises ConstructionError if the direction of A1
-- is parallel to the direction of the "XAxis" of the ellipse.
raises ConstructionError
is static;
SetLocation (me : in out; P : Pnt) is static;
---C++: inline
--- Purpose :Modifies this ellipse, by redefining its local coordinate
-- so that its origin becomes P.
SetMajorRadius (me : in out; MajorRadius : Real)
---C++: inline
--- Purpose :
-- The major radius of the ellipse is on the "XAxis" (major axis)
-- of the ellipse.
-- Raises ConstructionError if MajorRadius < MinorRadius.
raises ConstructionError
is static;
SetMinorRadius (me : in out; MinorRadius : Real)
---C++: inline
--- Purpose :
-- The minor radius of the ellipse is on the "YAxis" (minor axis)
-- of the ellipse.
-- Raises ConstructionError if MinorRadius > MajorRadius or MinorRadius < 0.
raises ConstructionError
is static;
SetPosition (me : in out; A2 : Ax2) is static;
---C++: inline
--- Purpose : Modifies this ellipse, by redefining its local coordinate
-- so that it becomes A2e.
Area (me) returns Real is static;
--- Purpose : Computes the area of the Ellipse.
---C++: inline
Axis (me) returns Ax1 is static;
---C++: inline
--- Purpose:
-- Computes the axis normal to the plane of the ellipse.
---C++: return const&
Directrix1 (me) returns Ax1
---C++:inline
--- Purpose : Computes the first or second directrix of this ellipse.
-- These are the lines, in the plane of the ellipse, normal to
-- the major axis, at a distance equal to
-- MajorRadius/e from the center of the ellipse, where
-- e is the eccentricity of the ellipse.
-- The first directrix (Directrix1) is on the positive side of
-- the major axis. The second directrix (Directrix2) is on
-- the negative side.
-- The directrix is returned as an axis (gp_Ax1 object), the
-- origin of which is situated on the "X Axis" of the local
-- coordinate system of this ellipse.
-- Exceptions
-- Standard_ConstructionError if the eccentricity is null
-- (the ellipse has degenerated into a circle).
raises ConstructionError
is static;
Directrix2 (me) returns Ax1
---C++:inline
--- Purpose :
-- This line is obtained by the symmetrical transformation
-- of "Directrix1" with respect to the "YAxis" of the ellipse.
-- Exceptions
-- Standard_ConstructionError if the eccentricity is null
-- (the ellipse has degenerated into a circle).
raises ConstructionError
is static;
Eccentricity (me) returns Real
---C++:inline
--- Purpose :
-- Returns the eccentricity of the ellipse between 0.0 and 1.0
-- If f is the distance between the center of the ellipse and
-- the Focus1 then the eccentricity e = f / MajorRadius.
-- Raises ConstructionError if MajorRadius = 0.0
raises ConstructionError
is static;
Focal (me) returns Real is static;
---C++:inline
--- Purpose :
-- Computes the focal distance. It is the distance between the
-- two focus focus1 and focus2 of the ellipse.
Focus1( me) returns Pnt is static;
---C++:inline
--- Purpose :
-- Returns the first focus of the ellipse. This focus is on the
-- positive side of the "XAxis" of the ellipse.
Focus2 (me) returns Pnt is static;
---C++:inline
--- Purpose :
-- Returns the second focus of the ellipse. This focus is on the
-- negative side of the "XAxis" of the ellipse.
Location (me) returns Pnt is static;
---C++:inline
--- Purpose :
-- Returns the center of the ellipse. It is the "Location"
-- point of the coordinate system of the ellipse.
---C++: return const&
MajorRadius (me) returns Real is static;
--- Purpose : Returns the major radius of the ellipse.
---C++: inline
MinorRadius (me) returns Real is static;
--- Purpose : Returns the minor radius of the ellipse.
---C++: inline
Parameter (me) returns Real is static;
---C++: inline
--- Purpose :
-- Returns p = (1 - e * e) * MajorRadius where e is the eccentricity
-- of the ellipse.
-- Returns 0 if MajorRadius = 0
Position (me) returns Ax2 is static;
--- Purpose : Returns the coordinate system of the ellipse.
---C++: inline
---C++: return const&
XAxis (me) returns Ax1 is static;
---C++:inline
--- Purpose :
-- Returns the "XAxis" of the ellipse whose origin
-- is the center of this ellipse. It is the major axis of the
-- ellipse.
YAxis (me) returns Ax1 is static;
---C++:inline
--- Purpose :
-- Returns the "YAxis" of the ellipse whose unit vector is the "X Direction" or the "Y Direction"
-- of the local coordinate system of this ellipse.
-- This is the minor axis of the ellipse.
Mirror (me : in out; P : Pnt)
is static;
Mirrored (me; P : Pnt) returns Elips is static;
--- Purpose :
-- Performs the symmetrical transformation of an ellipse with
-- respect to the point P which is the center of the symmetry.
Mirror (me : in out; A1 : Ax1)
is static;
Mirrored (me; A1 : Ax1) returns Elips is static;
--- Purpose :
-- Performs the symmetrical transformation of an ellipse with
-- respect to an axis placement which is the axis of the symmetry.
Mirror (me : in out; A2 : Ax2)
is static;
Mirrored (me; A2 : Ax2) returns Elips is static;
--- Purpose :
-- Performs the symmetrical transformation of an ellipse with
-- respect to a plane. The axis placement A2 locates the plane
-- of the symmetry (Location, XDirection, YDirection).
Rotate (me : in out; A1 : Ax1; Ang : Real)
---C++: inline
is static;
Rotated (me; A1 : Ax1; Ang : Real) returns Elips is static;
---C++: inline
--- Purpose :
-- Rotates an ellipse. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt; S : Real) is static;
---C++: inline
Scaled (me; P : Pnt; S : Real) returns Elips is static;
---C++: inline
--- Purpose :
-- Scales an ellipse. S is the scaling value.
Transform (me : in out; T : Trsf) is static;
---C++: inline
Transformed (me; T : Trsf) returns Elips is static;
---C++: inline
--- Purpose :
-- Transforms an ellipse with the transformation T from class Trsf.
Translate (me : in out; V : Vec)
---C++: inline
is static;
Translated (me; V : Vec) returns Elips is static;
---C++: inline
--- Purpose :
-- Translates an ellipse in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt)
---C++: inline
is static;
Translated (me; P1, P2 : Pnt) returns Elips is static;
---C++: inline
--- Purpose :
-- Translates an ellipse from the point P1 to the point P2.
fields
pos : Ax2;
majorRadius : Real;
minorRadius : Real;
end;

View File

@@ -14,7 +14,13 @@
//Modif JCV 12/12/90
#include <gp_Elips.ixx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Elips.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
void gp_Elips::Mirror (const gp_Pnt& P)
{ pos.Mirror(P); }

277
src/gp/gp_Elips.hxx Normal file
View File

@@ -0,0 +1,277 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Elips_HeaderFile
#define _gp_Elips_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax2.hxx>
#include <Standard_Real.hxx>
#include <gp_Ax1.hxx>
#include <gp_Pnt.hxx>
class Standard_ConstructionError;
class gp_Ax2;
class gp_Ax1;
class gp_Pnt;
class gp_Trsf;
class gp_Vec;
//! Describes an ellipse in 3D space.
//! An ellipse is defined by its major and minor radii and
//! positioned in space with a coordinate system (a gp_Ax2 object) as follows:
//! - the origin of the coordinate system is the center of the ellipse,
//! - its "X Direction" defines the major axis of the ellipse, and
//! - its "Y Direction" defines the minor axis of the ellipse.
//! Together, the origin, "X Direction" and "Y Direction" of
//! this coordinate system define the plane of the ellipse.
//! This coordinate system is the "local coordinate system"
//! of the ellipse. In this coordinate system, the equation of
//! the ellipse is:
//! X*X / (MajorRadius**2) + Y*Y / (MinorRadius**2) = 1.0
//! The "main Direction" of the local coordinate system gives
//! the normal vector to the plane of the ellipse. This vector
//! gives an implicit orientation to the ellipse (definition of the
//! trigonometric sense). We refer to the "main Axis" of the
//! local coordinate system as the "Axis" of the ellipse.
//! See Also
//! gce_MakeElips which provides functions for more
//! complex ellipse constructions
//! Geom_Ellipse which provides additional functions for
//! constructing ellipses and works, in particular, with the
//! parametric equations of ellipses
class gp_Elips
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an indefinite ellipse.
gp_Elips();
//! The major radius of the ellipse is on the "XAxis" and the
//! minor radius is on the "YAxis" of the ellipse. The "XAxis"
//! is defined with the "XDirection" of A2 and the "YAxis" is
//! defined with the "YDirection" of A2.
//! Warnings :
//! It is not forbidden to create an ellipse with MajorRadius =
//! MinorRadius.
//! Raises ConstructionError if MajorRadius < MinorRadius or MinorRadius < 0.
gp_Elips(const gp_Ax2& A2, const Standard_Real MajorRadius, const Standard_Real MinorRadius);
//! Changes the axis normal to the plane of the ellipse.
//! It modifies the definition of this plane.
//! The "XAxis" and the "YAxis" are recomputed.
//! The local coordinate system is redefined so that:
//! - its origin and "main Direction" become those of the
//! axis A1 (the "X Direction" and "Y Direction" are then
//! recomputed in the same way as for any gp_Ax2), or
//! Raises ConstructionError if the direction of A1
//! is parallel to the direction of the "XAxis" of the ellipse.
void SetAxis (const gp_Ax1& A1);
//! Modifies this ellipse, by redefining its local coordinate
//! so that its origin becomes P.
void SetLocation (const gp_Pnt& P);
//! The major radius of the ellipse is on the "XAxis" (major axis)
//! of the ellipse.
//! Raises ConstructionError if MajorRadius < MinorRadius.
void SetMajorRadius (const Standard_Real MajorRadius);
//! The minor radius of the ellipse is on the "YAxis" (minor axis)
//! of the ellipse.
//! Raises ConstructionError if MinorRadius > MajorRadius or MinorRadius < 0.
void SetMinorRadius (const Standard_Real MinorRadius);
//! Modifies this ellipse, by redefining its local coordinate
//! so that it becomes A2e.
void SetPosition (const gp_Ax2& A2);
//! Computes the area of the Ellipse.
Standard_Real Area() const;
//! Computes the axis normal to the plane of the ellipse.
const gp_Ax1& Axis() const;
//! Computes the first or second directrix of this ellipse.
//! These are the lines, in the plane of the ellipse, normal to
//! the major axis, at a distance equal to
//! MajorRadius/e from the center of the ellipse, where
//! e is the eccentricity of the ellipse.
//! The first directrix (Directrix1) is on the positive side of
//! the major axis. The second directrix (Directrix2) is on
//! the negative side.
//! The directrix is returned as an axis (gp_Ax1 object), the
//! origin of which is situated on the "X Axis" of the local
//! coordinate system of this ellipse.
//! Exceptions
//! Standard_ConstructionError if the eccentricity is null
//! (the ellipse has degenerated into a circle).
gp_Ax1 Directrix1() const;
//! This line is obtained by the symmetrical transformation
//! of "Directrix1" with respect to the "YAxis" of the ellipse.
//! Exceptions
//! Standard_ConstructionError if the eccentricity is null
//! (the ellipse has degenerated into a circle).
gp_Ax1 Directrix2() const;
//! Returns the eccentricity of the ellipse between 0.0 and 1.0
//! If f is the distance between the center of the ellipse and
//! the Focus1 then the eccentricity e = f / MajorRadius.
//! Raises ConstructionError if MajorRadius = 0.0
Standard_Real Eccentricity() const;
//! Computes the focal distance. It is the distance between the
//! two focus focus1 and focus2 of the ellipse.
Standard_Real Focal() const;
//! Returns the first focus of the ellipse. This focus is on the
//! positive side of the "XAxis" of the ellipse.
gp_Pnt Focus1() const;
//! Returns the second focus of the ellipse. This focus is on the
//! negative side of the "XAxis" of the ellipse.
gp_Pnt Focus2() const;
//! Returns the center of the ellipse. It is the "Location"
//! point of the coordinate system of the ellipse.
const gp_Pnt& Location() const;
//! Returns the major radius of the ellipse.
Standard_Real MajorRadius() const;
//! Returns the minor radius of the ellipse.
Standard_Real MinorRadius() const;
//! Returns p = (1 - e * e) * MajorRadius where e is the eccentricity
//! of the ellipse.
//! Returns 0 if MajorRadius = 0
Standard_Real Parameter() const;
//! Returns the coordinate system of the ellipse.
const gp_Ax2& Position() const;
//! Returns the "XAxis" of the ellipse whose origin
//! is the center of this ellipse. It is the major axis of the
//! ellipse.
gp_Ax1 XAxis() const;
//! Returns the "YAxis" of the ellipse whose unit vector is the "X Direction" or the "Y Direction"
//! of the local coordinate system of this ellipse.
//! This is the minor axis of the ellipse.
gp_Ax1 YAxis() const;
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of an ellipse with
//! respect to the point P which is the center of the symmetry.
Standard_EXPORT gp_Elips Mirrored (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of an ellipse with
//! respect to an axis placement which is the axis of the symmetry.
Standard_EXPORT gp_Elips Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of an ellipse with
//! respect to a plane. The axis placement A2 locates the plane
//! of the symmetry (Location, XDirection, YDirection).
Standard_EXPORT gp_Elips Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates an ellipse. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Elips Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Scales an ellipse. S is the scaling value.
gp_Elips Scaled (const gp_Pnt& P, const Standard_Real S) const;
void Transform (const gp_Trsf& T);
//! Transforms an ellipse with the transformation T from class Trsf.
gp_Elips Transformed (const gp_Trsf& T) const;
void Translate (const gp_Vec& V);
//! Translates an ellipse in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Elips Translated (const gp_Vec& V) const;
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates an ellipse from the point P1 to the point P2.
gp_Elips Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Ax2 pos;
Standard_Real majorRadius;
Standard_Real minorRadius;
};
#include <gp_Elips.lxx>
#endif // _gp_Elips_HeaderFile

View File

@@ -1,325 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Elips2d from gp
--- Purpose :
-- Describes an ellipse in the plane (2D space).
-- An ellipse is defined by its major and minor radii and
-- positioned in the plane with a coordinate system (a
-- gp_Ax22d object) as follows:
-- - the origin of the coordinate system is the center of the ellipse,
-- - its "X Direction" defines the major axis of the ellipse, and
-- - its "Y Direction" defines the minor axis of the ellipse.
-- This coordinate system is the "local coordinate system"
-- of the ellipse. Its orientation (direct or indirect) gives an
-- implicit orientation to the ellipse. In this coordinate
-- system, the equation of the ellipse is:
-- X*X / (MajorRadius**2) + Y*Y / (MinorRadius**2) = 1.0
-- See Also
-- gce_MakeElips2d which provides functions for more
-- complex ellipse constructions
-- Geom2d_Ellipse which provides additional functions for
-- constructing ellipses and works, in particular, with the
-- parametric equations of ellipses
uses Ax2d from gp,
Ax22d from gp,
Pnt2d from gp,
Trsf2d from gp,
Vec2d from gp
raises ConstructionError from Standard
is
Create returns Elips2d;
---C++:inline
--- Purpose : Creates an indefinite ellipse.
Create (MajorAxis : Ax2d;
MajorRadius, MinorRadius : Real;
Sense : Boolean from Standard = Standard_True)
returns Elips2d
---C++:inline
--- Purpose :
-- Creates an ellipse with the major axis, the major and the
-- minor radius. The location of the MajorAxis is the center
-- of the ellipse.
-- The sense of parametrization is given by Sense.
-- Warnings :
-- It is possible to create an ellipse with
-- MajorRadius = MinorRadius.
-- Raises ConstructionError if MajorRadius < MinorRadius or MinorRadius < 0.0
raises ConstructionError;
Create (A : Ax22d; MajorRadius, MinorRadius : Real)
returns Elips2d
--- Purpose : Creates an ellipse with radii MajorRadius and
-- MinorRadius, positioned in the plane by coordinate system A where:
-- - the origin of A is the center of the ellipse,
-- - the "X Direction" of A defines the major axis of
-- the ellipse, that is, the major radius MajorRadius
-- is measured along this axis, and
-- - the "Y Direction" of A defines the minor axis of
-- the ellipse, that is, the minor radius MinorRadius
-- is measured along this axis, and
-- - the orientation (direct or indirect sense) of A
-- gives the orientation of the ellipse.
-- Warnings :
-- It is possible to create an ellipse with
-- MajorRadius = MinorRadius.
-- Raises ConstructionError if MajorRadius < MinorRadius or MinorRadius < 0.0
raises ConstructionError;
SetLocation (me : in out; P : Pnt2d) is static;
--- Purpose : Modifies this ellipse, by redefining its local coordinate system so that
-- - its origin becomes P.
SetMajorRadius (me : in out; MajorRadius : Real)
--- Purpose : Changes the value of the major radius.
-- Raises ConstructionError if MajorRadius < MinorRadius.
raises ConstructionError
is static;
SetMinorRadius (me : in out; MinorRadius : Real)
--- Purpose : Changes the value of the minor radius.
-- Raises ConstructionError if MajorRadius < MinorRadius or MinorRadius < 0.0
raises ConstructionError
is static;
SetAxis (me : in out; A : Ax22d) is static;
--- Purpose : Modifies this ellipse, by redefining its local coordinate system so that
-- it becomes A.
SetXAxis (me : in out; A : Ax2d) is static;
--- Purpose : Modifies this ellipse, by redefining its local coordinate system so that
-- its origin and its "X Direction" become those
-- of the axis A. The "Y Direction" is then
-- recomputed. The orientation of the local coordinate
-- system is not modified.
SetYAxis (me : in out; A : Ax2d) is static;
--- Purpose : Modifies this ellipse, by redefining its local coordinate system so that
-- its origin and its "Y Direction" become those
-- of the axis A. The "X Direction" is then
-- recomputed. The orientation of the local coordinate
-- system is not modified.
Area (me) returns Real is static;
--- Purpose : Computes the area of the ellipse.
---C++: inline
Coefficients (me; A, B, C, D, E, F : out Real) is static;
--- Purpose :
-- Returns the coefficients of the implicit equation of the ellipse.
-- A * (X**2) + B * (Y**2) + 2*C*(X*Y) + 2*D*X + 2*E*Y + F = 0.
Directrix1 (me) returns Ax2d
---C++: inline
--- Purpose :
-- This directrix is the line normal to the XAxis of the ellipse
-- in the local plane (Z = 0) at a distance d = MajorRadius / e
-- from the center of the ellipse, where e is the eccentricity of
-- the ellipse.
-- This line is parallel to the "YAxis". The intersection point
-- between directrix1 and the "XAxis" is the location point of the
-- directrix1. This point is on the positive side of the "XAxis".
raises ConstructionError
--- Purpose :
-- Raised if Eccentricity = 0.0. (The ellipse degenerates into a
-- circle)
is static;
Directrix2 (me) returns Ax2d
---C++: inline
--- Purpose :
-- This line is obtained by the symmetrical transformation
-- of "Directrix1" with respect to the minor axis of the ellipse.
raises ConstructionError
--- Purpose :
-- Raised if Eccentricity = 0.0. (The ellipse degenerates into a
-- circle).
is static;
Eccentricity (me) returns Real is static;
---C++: inline
--- Purpose :
-- Returns the eccentricity of the ellipse between 0.0 and 1.0
-- If f is the distance between the center of the ellipse and
-- the Focus1 then the eccentricity e = f / MajorRadius.
-- Returns 0 if MajorRadius = 0.
Focal (me) returns Real is static;
---C++: inline
--- Purpose :
-- Returns the distance between the center of the ellipse
-- and focus1 or focus2.
Focus1 (me) returns Pnt2d is static;
---C++: inline
--- Purpose :
-- Returns the first focus of the ellipse. This focus is on the
-- positive side of the major axis of the ellipse.
Focus2 (me) returns Pnt2d is static;
---C++: inline
--- Purpose :
-- Returns the second focus of the ellipse. This focus is on the
-- negative side of the major axis of the ellipse.
Location (me) returns Pnt2d is static;
---C++:inline
--- Purpose : Returns the center of the ellipse.
---C++: return const&
MajorRadius (me) returns Real is static;
--- Purpose : Returns the major radius of the Ellipse.
---C++: inline
MinorRadius (me) returns Real is static;
--- Purpose : Returns the minor radius of the Ellipse.
---C++: inline
Parameter (me) returns Real is static;
---C++: inline
--- Purpose :
-- Returns p = (1 - e * e) * MajorRadius where e is the eccentricity
-- of the ellipse.
-- Returns 0 if MajorRadius = 0
Axis (me) returns Ax22d is static;
--- Purpose : Returns the major axis of the ellipse.
---C++: inline
---C++: return const&
XAxis (me) returns Ax2d is static;
---C++:inline
--- Purpose : Returns the major axis of the ellipse.
YAxis (me) returns Ax2d is static;
---C++:inline
--- Purpose : Returns the minor axis of the ellipse.
--- Purpose : Reverses the direction of the circle.
Reverse (me : in out) is static;
---C++:inline
Reversed (me) returns Elips2d is static;
---C++:inline
IsDirect (me) returns Boolean is static;
---C++:inline
--- Purpose : Returns true if the local coordinate system is direct
-- and false in the other case.
Mirror (me : in out; P : Pnt2d)
is static;
Mirrored (me; P : Pnt2d) returns Elips2d is static;
--- Purpose :
-- Performs the symmetrical transformation of a ellipse with respect
-- to the point P which is the center of the symmetry
Mirror (me : in out; A : Ax2d)
is static;
Mirrored (me; A : Ax2d) returns Elips2d is static;
--- Purpose :
-- Performs the symmetrical transformation of a ellipse with respect
-- to an axis placement which is the axis of the symmetry.
Rotate (me : in out; P : Pnt2d; Ang : Real)
is static;
Rotated (me; P : Pnt2d; Ang : Real) returns Elips2d is static;
Scale (me : in out; P : Pnt2d; S : Real) is static;
Scaled (me; P : Pnt2d; S : Real) returns Elips2d is static;
--- Purpose :
-- Scales a ellipse. S is the scaling value.
Transform (me : in out; T : Trsf2d)
is static;
Transformed (me; T : Trsf2d) returns Elips2d is static;
--- Purpose :
-- Transforms an ellipse with the transformation T from class Trsf2d.
Translate (me : in out; V : Vec2d) is static;
Translated (me; V : Vec2d) returns Elips2d is static;
--- Purpose :
-- Translates a ellipse in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt2d ) is static;
Translated (me; P1, P2 : Pnt2d) returns Elips2d is static;
--- Purpose :
-- Translates a ellipse from the point P1 to the point P2.
fields
pos : Ax22d;
majorRadius : Real;
minorRadius : Real;
end;

View File

@@ -14,7 +14,13 @@
//Modif JCV 10/01/91
#include <gp_Elips2d.ixx>
#include <gp_Ax2d.hxx>
#include <gp_Ax22d.hxx>
#include <gp_Elips2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <Standard_ConstructionError.hxx>
void gp_Elips2d::Coefficients (Standard_Real& A,
Standard_Real& B,

276
src/gp/gp_Elips2d.hxx Normal file
View File

@@ -0,0 +1,276 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Elips2d_HeaderFile
#define _gp_Elips2d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax22d.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <gp_Ax2d.hxx>
#include <gp_Pnt2d.hxx>
class Standard_ConstructionError;
class gp_Ax2d;
class gp_Ax22d;
class gp_Pnt2d;
class gp_Trsf2d;
class gp_Vec2d;
//! Describes an ellipse in the plane (2D space).
//! An ellipse is defined by its major and minor radii and
//! positioned in the plane with a coordinate system (a
//! gp_Ax22d object) as follows:
//! - the origin of the coordinate system is the center of the ellipse,
//! - its "X Direction" defines the major axis of the ellipse, and
//! - its "Y Direction" defines the minor axis of the ellipse.
//! This coordinate system is the "local coordinate system"
//! of the ellipse. Its orientation (direct or indirect) gives an
//! implicit orientation to the ellipse. In this coordinate
//! system, the equation of the ellipse is:
//! X*X / (MajorRadius**2) + Y*Y / (MinorRadius**2) = 1.0
//! See Also
//! gce_MakeElips2d which provides functions for more
//! complex ellipse constructions
//! Geom2d_Ellipse which provides additional functions for
//! constructing ellipses and works, in particular, with the
//! parametric equations of ellipses
class gp_Elips2d
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an indefinite ellipse.
gp_Elips2d();
//! Creates an ellipse with the major axis, the major and the
//! minor radius. The location of the MajorAxis is the center
//! of the ellipse.
//! The sense of parametrization is given by Sense.
//! Warnings :
//! It is possible to create an ellipse with
//! MajorRadius = MinorRadius.
//! Raises ConstructionError if MajorRadius < MinorRadius or MinorRadius < 0.0
gp_Elips2d(const gp_Ax2d& MajorAxis, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const Standard_Boolean Sense = Standard_True);
//! Creates an ellipse with radii MajorRadius and
//! MinorRadius, positioned in the plane by coordinate system A where:
//! - the origin of A is the center of the ellipse,
//! - the "X Direction" of A defines the major axis of
//! the ellipse, that is, the major radius MajorRadius
//! is measured along this axis, and
//! - the "Y Direction" of A defines the minor axis of
//! the ellipse, that is, the minor radius MinorRadius
//! is measured along this axis, and
//! - the orientation (direct or indirect sense) of A
//! gives the orientation of the ellipse.
//! Warnings :
//! It is possible to create an ellipse with
//! MajorRadius = MinorRadius.
//! Raises ConstructionError if MajorRadius < MinorRadius or MinorRadius < 0.0
Standard_EXPORT gp_Elips2d(const gp_Ax22d& A, const Standard_Real MajorRadius, const Standard_Real MinorRadius);
//! Modifies this ellipse, by redefining its local coordinate system so that
//! - its origin becomes P.
Standard_EXPORT void SetLocation (const gp_Pnt2d& P);
//! Changes the value of the major radius.
//! Raises ConstructionError if MajorRadius < MinorRadius.
Standard_EXPORT void SetMajorRadius (const Standard_Real MajorRadius);
//! Changes the value of the minor radius.
//! Raises ConstructionError if MajorRadius < MinorRadius or MinorRadius < 0.0
Standard_EXPORT void SetMinorRadius (const Standard_Real MinorRadius);
//! Modifies this ellipse, by redefining its local coordinate system so that
//! it becomes A.
Standard_EXPORT void SetAxis (const gp_Ax22d& A);
//! Modifies this ellipse, by redefining its local coordinate system so that
//! its origin and its "X Direction" become those
//! of the axis A. The "Y Direction" is then
//! recomputed. The orientation of the local coordinate
//! system is not modified.
Standard_EXPORT void SetXAxis (const gp_Ax2d& A);
//! Modifies this ellipse, by redefining its local coordinate system so that
//! its origin and its "Y Direction" become those
//! of the axis A. The "X Direction" is then
//! recomputed. The orientation of the local coordinate
//! system is not modified.
Standard_EXPORT void SetYAxis (const gp_Ax2d& A);
//! Computes the area of the ellipse.
Standard_Real Area() const;
//! Returns the coefficients of the implicit equation of the ellipse.
//! A * (X**2) + B * (Y**2) + 2*C*(X*Y) + 2*D*X + 2*E*Y + F = 0.
Standard_EXPORT void Coefficients (Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& D, Standard_Real& E, Standard_Real& F) const;
//! This directrix is the line normal to the XAxis of the ellipse
//! in the local plane (Z = 0) at a distance d = MajorRadius / e
//! from the center of the ellipse, where e is the eccentricity of
//! the ellipse.
//! This line is parallel to the "YAxis". The intersection point
//! between directrix1 and the "XAxis" is the location point of the
//! directrix1. This point is on the positive side of the "XAxis".
//!
//! Raised if Eccentricity = 0.0. (The ellipse degenerates into a
//! circle)
gp_Ax2d Directrix1() const;
//! This line is obtained by the symmetrical transformation
//! of "Directrix1" with respect to the minor axis of the ellipse.
//!
//! Raised if Eccentricity = 0.0. (The ellipse degenerates into a
//! circle).
gp_Ax2d Directrix2() const;
//! Returns the eccentricity of the ellipse between 0.0 and 1.0
//! If f is the distance between the center of the ellipse and
//! the Focus1 then the eccentricity e = f / MajorRadius.
//! Returns 0 if MajorRadius = 0.
Standard_Real Eccentricity() const;
//! Returns the distance between the center of the ellipse
//! and focus1 or focus2.
Standard_Real Focal() const;
//! Returns the first focus of the ellipse. This focus is on the
//! positive side of the major axis of the ellipse.
gp_Pnt2d Focus1() const;
//! Returns the second focus of the ellipse. This focus is on the
//! negative side of the major axis of the ellipse.
gp_Pnt2d Focus2() const;
//! Returns the center of the ellipse.
const gp_Pnt2d& Location() const;
//! Returns the major radius of the Ellipse.
Standard_Real MajorRadius() const;
//! Returns the minor radius of the Ellipse.
Standard_Real MinorRadius() const;
//! Returns p = (1 - e * e) * MajorRadius where e is the eccentricity
//! of the ellipse.
//! Returns 0 if MajorRadius = 0
Standard_Real Parameter() const;
//! Returns the major axis of the ellipse.
const gp_Ax22d& Axis() const;
//! Returns the major axis of the ellipse.
gp_Ax2d XAxis() const;
//! Returns the minor axis of the ellipse.
//! Reverses the direction of the circle.
gp_Ax2d YAxis() const;
void Reverse();
gp_Elips2d Reversed() const;
//! Returns true if the local coordinate system is direct
//! and false in the other case.
Standard_Boolean IsDirect() const;
Standard_EXPORT void Mirror (const gp_Pnt2d& P);
//! Performs the symmetrical transformation of a ellipse with respect
//! to the point P which is the center of the symmetry
Standard_EXPORT gp_Elips2d Mirrored (const gp_Pnt2d& P) const;
Standard_EXPORT void Mirror (const gp_Ax2d& A);
//! Performs the symmetrical transformation of a ellipse with respect
//! to an axis placement which is the axis of the symmetry.
Standard_EXPORT gp_Elips2d Mirrored (const gp_Ax2d& A) const;
Standard_EXPORT void Rotate (const gp_Pnt2d& P, const Standard_Real Ang);
Standard_EXPORT gp_Elips2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
Standard_EXPORT void Scale (const gp_Pnt2d& P, const Standard_Real S);
//! Scales a ellipse. S is the scaling value.
Standard_EXPORT gp_Elips2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
Standard_EXPORT void Transform (const gp_Trsf2d& T);
//! Transforms an ellipse with the transformation T from class Trsf2d.
Standard_EXPORT gp_Elips2d Transformed (const gp_Trsf2d& T) const;
Standard_EXPORT void Translate (const gp_Vec2d& V);
//! Translates a ellipse in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
Standard_EXPORT gp_Elips2d Translated (const gp_Vec2d& V) const;
Standard_EXPORT void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2);
//! Translates a ellipse from the point P1 to the point P2.
Standard_EXPORT gp_Elips2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
protected:
private:
gp_Ax22d pos;
Standard_Real majorRadius;
Standard_Real minorRadius;
};
#include <gp_Elips2d.lxx>
#endif // _gp_Elips2d_HeaderFile

View File

@@ -0,0 +1,51 @@
// Created on: 1993-04-13
// Created by: JCV
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_EulerSequence_HeaderFile
#define _gp_EulerSequence_HeaderFile
enum gp_EulerSequence
{
gp_EulerAngles,
gp_YawPitchRoll,
gp_Extrinsic_XYZ,
gp_Extrinsic_XZY,
gp_Extrinsic_YZX,
gp_Extrinsic_YXZ,
gp_Extrinsic_ZXY,
gp_Extrinsic_ZYX,
gp_Intrinsic_XYZ,
gp_Intrinsic_XZY,
gp_Intrinsic_YZX,
gp_Intrinsic_YXZ,
gp_Intrinsic_ZXY,
gp_Intrinsic_ZYX,
gp_Extrinsic_XYX,
gp_Extrinsic_XZX,
gp_Extrinsic_YZY,
gp_Extrinsic_YXY,
gp_Extrinsic_ZYZ,
gp_Extrinsic_ZXZ,
gp_Intrinsic_XYX,
gp_Intrinsic_XZX,
gp_Intrinsic_YZY,
gp_Intrinsic_YXY,
gp_Intrinsic_ZXZ,
gp_Intrinsic_ZYZ
};
#endif // _gp_EulerSequence_HeaderFile

View File

@@ -1,289 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class GTrsf from gp
--- Purpose :
-- Defines a non-persistent transformation in 3D space.
-- This transformation is a general transformation.
-- It can be a Trsf from gp, an affinity, or you can define
-- your own transformation giving the matrix of transformation.
--
-- With a Gtrsf you can transform only a triplet of coordinates
-- XYZ. It is not possible to transform other geometric objects
-- because these transformations can change the nature of non-
-- elementary geometric objects.
-- The transformation GTrsf can be represented as follow :
--
-- V1 V2 V3 T XYZ XYZ
-- | a11 a12 a13 a14 | | x | | x'|
-- | a21 a22 a23 a24 | | y | | y'|
-- | a31 a32 a33 a34 | | z | = | z'|
-- | 0 0 0 1 | | 1 | | 1 |
--
-- where {V1, V2, V3} define the vectorial part of the
-- transformation and T defines the translation part of the
-- transformation.
-- Warning
-- A GTrsf transformation is only applicable to
-- coordinates. Be careful if you apply such a
-- transformation to all points of a geometric object, as
-- this can change the nature of the object and thus
-- render it incoherent!
-- Typically, a circle is transformed into an ellipse by an
-- affinity transformation. To avoid modifying the nature of
-- an object, use a gp_Trsf transformation instead, as
-- objects of this class respect the nature of geometric objects.
uses Ax1 from gp,
Ax2 from gp,
Mat from gp,
Trsf from gp,
Vec from gp,
XYZ from gp,
TrsfForm from gp
raises ConstructionError from Standard,
OutOfRange from Standard
is
Create returns GTrsf;
---C++: inline
--- Purpose : Returns the Identity transformation.
Create (T : Trsf) returns GTrsf;
---C++: inline
--- Purpose :
-- Converts the gp_Trsf transformation T into a
-- general transformation, i.e. Returns a GTrsf with
-- the same matrix of coefficients as the Trsf T.
Create (M : Mat; V : XYZ) returns GTrsf;
---C++: inline
--- Purpose :
-- Creates a transformation based on the matrix M and the
-- vector V where M defines the vectorial part of
-- the transformation, and V the translation part, or
SetAffinity (me : in out; A1 : Ax1; Ratio : Real) is static;
---C++: inline
--- Purpose : Changes this transformation into an affinity of ratio Ratio
-- with respect to the axis A1.
-- Note: an affinity is a point-by-point transformation that
-- transforms any point P into a point P' such that if H is
-- the orthogonal projection of P on the axis A1 or the
-- plane A2, the vectors HP and HP' satisfy:
-- HP' = Ratio * HP.
SetAffinity (me : in out; A2 : Ax2; Ratio : Real) is static;
---C++: inline
--- Purpose : Changes this transformation into an affinity of ratio Ratio
-- with respect to the plane defined by the origin, the "X Direction" and
-- the "Y Direction" of coordinate system A2.
-- Note: an affinity is a point-by-point transformation that
-- transforms any point P into a point P' such that if H is
-- the orthogonal projection of P on the axis A1 or the
-- plane A2, the vectors HP and HP' satisfy:
-- HP' = Ratio * HP.
SetValue (me : in out; Row, Col : Integer; Value : Real)
---C++: inline
--- Purpose :
-- Replaces the coefficient (Row, Col) of the matrix representing
-- this transformation by Value. Raises OutOfRange
-- if Row < 1 or Row > 3 or Col < 1 or Col > 4
raises OutOfRange
is static;
SetVectorialPart (me : in out; Matrix : Mat) is static;
---C++: inline
--- Purpose : Replaces the vectorial part of this transformation by Matrix.
SetTranslationPart (me : in out; Coord : XYZ) is static;
--- Purpose : Replaces the translation part of
-- this transformation by the coordinates of the number triple Coord.
SetTrsf (me : in out; T : Trsf) is static;
---C++: inline
--- Purpose : Assigns the vectorial and translation parts of T to this transformation.
IsNegative (me) returns Boolean is static;
---C++: inline
--- Purpose :
-- Returns true if the determinant of the vectorial part of
-- this transformation is negative.
IsSingular (me) returns Boolean is static;
---C++: inline
--- Purpose :
-- Returns true if this transformation is singular (and
-- therefore, cannot be inverted).
-- Note: The Gauss LU decomposition is used to invert the
-- transformation matrix. Consequently, the transformation
-- is considered as singular if the largest pivot found is less
-- than or equal to gp::Resolution().
-- Warning
-- If this transformation is singular, it cannot be inverted.
Form (me) returns TrsfForm is static;
--- Purpose :
-- Returns the nature of the transformation. It can be an
-- identity transformation, a rotation, a translation, a mirror
-- transformation (relative to a point, an axis or a plane), a
-- scaling transformation, a compound transformation or
-- some other type of transformation.
SetForm (me:in out) is static;
--- Purpose :
-- verify and set the shape of the GTrsf Other or CompoundTrsf
-- Ex :
-- myGTrsf.SetValue(row1,col1,val1);
-- myGTrsf.SetValue(row2,col2,val2);
-- ...
-- myGTrsf.SetForm();
TranslationPart (me) returns XYZ is static;
--- Purpose : Returns the translation part of the GTrsf.
---C++: inline
---C++: return const&
VectorialPart (me) returns Mat is static;
--- Purpose :
-- Computes the vectorial part of the GTrsf. The returned Matrix
-- is a 3*3 matrix.
---C++: inline
---C++: return const&
Value (me; Row, Col : Integer) returns Real
--- Purpose :
-- Returns the coefficients of the global matrix of transformation.
-- Raises OutOfRange if Row < 1 or Row > 3 or Col < 1 or Col > 4
---C++: inline
---C++: alias operator()
raises OutOfRange
is static;
Invert (me : in out) raises ConstructionError is static;
Inverted (me) returns GTrsf raises ConstructionError is static;
---C++: inline
--- Purpose :
-- Computes the reverse transformation.
-- Raises an exception if the matrix of the transformation
-- is not inversible.
Multiplied (me; T : GTrsf) returns GTrsf is static;
--- Purpose :
-- Computes the transformation composed from T and <me>.
-- In a C++ implementation you can also write Tcomposed = <me> * T.
--- Example :
-- GTrsf T1, T2, Tcomp; ...............
-- //composition :
-- Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
-- // transformation of a point
-- XYZ P(10.,3.,4.);
-- XYZ P1(P);
-- Tcomp.Transforms(P1); //using Tcomp
-- XYZ P2(P);
-- T1.Transforms(P2); //using T1 then T2
-- T2.Transforms(P2); // P1 = P2 !!!
---C++: inline
-- C++: alias operator *
Multiply (me : in out; T : GTrsf) is static;
--- Purpose :
-- Computes the transformation composed with <me> and T.
-- <me> = <me> * T
-- C++: alias operator *=
PreMultiply (me : in out; T : GTrsf) is static;
---Purpose:
-- Computes the product of the transformation T and this
-- transformation and assigns the result to this transformation.
-- this = T * this
Power (me : in out; N : Integer) raises ConstructionError is static;
Powered (me; N : Integer) returns GTrsf raises ConstructionError is static;
---C++: inline
--- Purpose :
-- Computes:
-- - the product of this transformation multiplied by itself
-- N times, if N is positive, or
-- - the product of the inverse of this transformation
-- multiplied by itself |N| times, if N is negative.
-- If N equals zero, the result is equal to the Identity
-- transformation.
-- I.e.: <me> * <me> * .......* <me>, N time.
-- if N =0 <me> = Identity
-- if N < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().
--
-- Raises an exception if N < 0 and if the matrix of the
-- transformation not inversible.
Transforms (me; Coord : in out XYZ) is static;
---C++: inline
Transforms (me; X, Y, Z : in out Real) is static;
---C++: inline
--- Purpose : Transforms a triplet XYZ with a GTrsf.
Trsf (me) returns Trsf raises ConstructionError is static;
---C++: inline
fields
matrix : Mat;
loc : XYZ;
shape : TrsfForm;
scale : Real;
end;

View File

@@ -14,8 +14,15 @@
#define No_Standard_OutOfRange
#include <gp_GTrsf.ixx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_GTrsf.hxx>
#include <gp_Mat.hxx>
#include <gp_Trsf.hxx>
#include <gp_XYZ.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
void gp_GTrsf::SetTranslationPart (const gp_XYZ& Coord)
{

265
src/gp/gp_GTrsf.hxx Normal file
View File

@@ -0,0 +1,265 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_GTrsf_HeaderFile
#define _gp_GTrsf_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Mat.hxx>
#include <gp_XYZ.hxx>
#include <gp_TrsfForm.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <gp_Trsf.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class gp_Trsf;
class gp_Mat;
class gp_XYZ;
class gp_Ax1;
class gp_Ax2;
//! Defines a non-persistent transformation in 3D space.
//! This transformation is a general transformation.
//! It can be a Trsf from gp, an affinity, or you can define
//! your own transformation giving the matrix of transformation.
//!
//! With a Gtrsf you can transform only a triplet of coordinates
//! XYZ. It is not possible to transform other geometric objects
//! because these transformations can change the nature of non-
//! elementary geometric objects.
//! The transformation GTrsf can be represented as follow :
//!
//! V1 V2 V3 T XYZ XYZ
//! | a11 a12 a13 a14 | | x | | x'|
//! | a21 a22 a23 a24 | | y | | y'|
//! | a31 a32 a33 a34 | | z | = | z'|
//! | 0 0 0 1 | | 1 | | 1 |
//!
//! where {V1, V2, V3} define the vectorial part of the
//! transformation and T defines the translation part of the
//! transformation.
//! Warning
//! A GTrsf transformation is only applicable to
//! coordinates. Be careful if you apply such a
//! transformation to all points of a geometric object, as
//! this can change the nature of the object and thus
//! render it incoherent!
//! Typically, a circle is transformed into an ellipse by an
//! affinity transformation. To avoid modifying the nature of
//! an object, use a gp_Trsf transformation instead, as
//! objects of this class respect the nature of geometric objects.
class gp_GTrsf
{
public:
DEFINE_STANDARD_ALLOC
//! Returns the Identity transformation.
gp_GTrsf();
//! Converts the gp_Trsf transformation T into a
//! general transformation, i.e. Returns a GTrsf with
//! the same matrix of coefficients as the Trsf T.
gp_GTrsf(const gp_Trsf& T);
//! Creates a transformation based on the matrix M and the
//! vector V where M defines the vectorial part of
//! the transformation, and V the translation part, or
gp_GTrsf(const gp_Mat& M, const gp_XYZ& V);
//! Changes this transformation into an affinity of ratio Ratio
//! with respect to the axis A1.
//! Note: an affinity is a point-by-point transformation that
//! transforms any point P into a point P' such that if H is
//! the orthogonal projection of P on the axis A1 or the
//! plane A2, the vectors HP and HP' satisfy:
//! HP' = Ratio * HP.
void SetAffinity (const gp_Ax1& A1, const Standard_Real Ratio);
//! Changes this transformation into an affinity of ratio Ratio
//! with respect to the plane defined by the origin, the "X Direction" and
//! the "Y Direction" of coordinate system A2.
//! Note: an affinity is a point-by-point transformation that
//! transforms any point P into a point P' such that if H is
//! the orthogonal projection of P on the axis A1 or the
//! plane A2, the vectors HP and HP' satisfy:
//! HP' = Ratio * HP.
void SetAffinity (const gp_Ax2& A2, const Standard_Real Ratio);
//! Replaces the coefficient (Row, Col) of the matrix representing
//! this transformation by Value. Raises OutOfRange
//! if Row < 1 or Row > 3 or Col < 1 or Col > 4
void SetValue (const Standard_Integer Row, const Standard_Integer Col, const Standard_Real Value);
//! Replaces the vectorial part of this transformation by Matrix.
void SetVectorialPart (const gp_Mat& Matrix);
//! Replaces the translation part of
//! this transformation by the coordinates of the number triple Coord.
Standard_EXPORT void SetTranslationPart (const gp_XYZ& Coord);
//! Assigns the vectorial and translation parts of T to this transformation.
void SetTrsf (const gp_Trsf& T);
//! Returns true if the determinant of the vectorial part of
//! this transformation is negative.
Standard_Boolean IsNegative() const;
//! Returns true if this transformation is singular (and
//! therefore, cannot be inverted).
//! Note: The Gauss LU decomposition is used to invert the
//! transformation matrix. Consequently, the transformation
//! is considered as singular if the largest pivot found is less
//! than or equal to gp::Resolution().
//! Warning
//! If this transformation is singular, it cannot be inverted.
Standard_Boolean IsSingular() const;
//! Returns the nature of the transformation. It can be an
//! identity transformation, a rotation, a translation, a mirror
//! transformation (relative to a point, an axis or a plane), a
//! scaling transformation, a compound transformation or
//! some other type of transformation.
Standard_EXPORT gp_TrsfForm Form() const;
//! verify and set the shape of the GTrsf Other or CompoundTrsf
//! Ex :
//! myGTrsf.SetValue(row1,col1,val1);
//! myGTrsf.SetValue(row2,col2,val2);
//! ...
//! myGTrsf.SetForm();
Standard_EXPORT void SetForm();
//! Returns the translation part of the GTrsf.
const gp_XYZ& TranslationPart() const;
//! Computes the vectorial part of the GTrsf. The returned Matrix
//! is a 3*3 matrix.
const gp_Mat& VectorialPart() const;
//! Returns the coefficients of the global matrix of transformation.
//! Raises OutOfRange if Row < 1 or Row > 3 or Col < 1 or Col > 4
Standard_Real Value (const Standard_Integer Row, const Standard_Integer Col) const;
Standard_Real operator() (const Standard_Integer Row, const Standard_Integer Col) const
{
return Value(Row,Col);
}
Standard_EXPORT void Invert();
//! Computes the reverse transformation.
//! Raises an exception if the matrix of the transformation
//! is not inversible.
gp_GTrsf Inverted() const;
//! Computes the transformation composed from T and <me>.
//! In a C++ implementation you can also write Tcomposed = <me> * T.
//! Example :
//! GTrsf T1, T2, Tcomp; ...............
//! //composition :
//! Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
//! // transformation of a point
//! XYZ P(10.,3.,4.);
//! XYZ P1(P);
//! Tcomp.Transforms(P1); //using Tcomp
//! XYZ P2(P);
//! T1.Transforms(P2); //using T1 then T2
//! T2.Transforms(P2); // P1 = P2 !!!
gp_GTrsf Multiplied (const gp_GTrsf& T) const;
//! Computes the transformation composed with <me> and T.
//! <me> = <me> * T
//! C++: alias operator *=
Standard_EXPORT void Multiply (const gp_GTrsf& T);
//! Computes the product of the transformation T and this
//! transformation and assigns the result to this transformation.
//! this = T * this
Standard_EXPORT void PreMultiply (const gp_GTrsf& T);
Standard_EXPORT void Power (const Standard_Integer N);
//! Computes:
//! - the product of this transformation multiplied by itself
//! N times, if N is positive, or
//! - the product of the inverse of this transformation
//! multiplied by itself |N| times, if N is negative.
//! If N equals zero, the result is equal to the Identity
//! transformation.
//! I.e.: <me> * <me> * .......* <me>, N time.
//! if N =0 <me> = Identity
//! if N < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().
//!
//! Raises an exception if N < 0 and if the matrix of the
//! transformation not inversible.
gp_GTrsf Powered (const Standard_Integer N) const;
void Transforms (gp_XYZ& Coord) const;
//! Transforms a triplet XYZ with a GTrsf.
void Transforms (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
gp_Trsf Trsf() const;
protected:
private:
gp_Mat matrix;
gp_XYZ loc;
gp_TrsfForm shape;
Standard_Real scale;
};
#include <gp_GTrsf.lxx>
#endif // _gp_GTrsf_HeaderFile

View File

@@ -1,271 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class GTrsf2d from gp
--- Purpose :
-- Defines a non persistent transformation in 2D space.
-- This transformation is a general transformation.
-- It can be a Trsf2d from package gp, an affinity, or you can
-- define your own transformation giving the corresponding
-- matrix of transformation.
--
-- With a GTrsf2d you can transform only a doublet of coordinates
-- XY. It is not possible to transform other geometric objects
-- because these transformations can change the nature of non-
-- elementary geometric objects.
-- A GTrsf2d is represented with a 2 rows * 3 columns matrix :
--
-- V1 V2 T XY XY
-- | a11 a12 a14 | | x | | x'|
-- | a21 a22 a24 | | y | | y'|
-- | 0 0 1 | | 1 | | 1 |
--
-- where {V1, V2} defines the vectorial part of the
-- transformation and T defines the translation part of
-- the transformation.
-- Warning
-- A GTrsf2d transformation is only applicable on
-- coordinates. Be careful if you apply such a
-- transformation to all the points of a geometric object,
-- as this can change the nature of the object and thus
-- render it incoherent!
-- Typically, a circle is transformed into an ellipse by an
-- affinity transformation. To avoid modifying the nature of
-- an object, use a gp_Trsf2d transformation instead, as
-- objects of this class respect the nature of geometric objects.
uses Ax2d from gp,
Mat2d from gp,
Trsf2d from gp,
Vec2d from gp,
XY from gp,
TrsfForm from gp
raises ConstructionError from Standard,
OutOfRange from Standard
is
Create returns GTrsf2d;
---C++: inline
--- Purpose : returns identity transformation.
Create (T : Trsf2d) returns GTrsf2d;
---C++: inline
--- Purpose : Converts the gp_Trsf2d transformation T into a
-- general transformation.
Create (M : Mat2d; V : XY) returns GTrsf2d;
---C++: inline
--- Purpose : Creates a transformation based on the matrix M and the
-- vector V where M defines the vectorial part of the
-- transformation, and V the translation part.
SetAffinity (me : in out; A : Ax2d; Ratio : Real) is static;
--- Purpose :
-- Changes this transformation into an affinity of ratio Ratio
-- with respect to the axis A.
-- Note: An affinity is a point-by-point transformation that
-- transforms any point P into a point P' such that if H is
-- the orthogonal projection of P on the axis A, the vectors
-- HP and HP' satisfy: HP' = Ratio * HP.
SetValue (me : in out; Row, Col : Integer; Value : Real)
---C++: inline
--- Purpose :
-- Replaces the coefficient (Row, Col) of the matrix representing
-- this transformation by Value,
-- Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3
raises OutOfRange
is static;
SetTranslationPart (me : in out; Coord : XY) is static;
--- Purpose : Replacesthe translation part of this
-- transformation by the coordinates of the number pair Coord.
SetTrsf2d (me : in out; T : Trsf2d) is static;
---C++: inline
--- Purpose :
-- Assigns the vectorial and translation parts of T to this transformation.
SetVectorialPart (me : in out; Matrix : Mat2d) is static;
---C++: inline
--- Purpose :
-- Replaces the vectorial part of this transformation by Matrix.
IsNegative (me) returns Boolean is static;
---C++: inline
--- Purpose :
-- Returns true if the determinant of the vectorial part of
-- this transformation is negative.
IsSingular (me) returns Boolean is static;
---C++: inline
--- Purpose : Returns true if this transformation is singular (and
-- therefore, cannot be inverted).
-- Note: The Gauss LU decomposition is used to invert the
-- transformation matrix. Consequently, the transformation
-- is considered as singular if the largest pivot found is less
-- than or equal to gp::Resolution().
-- Warning
-- If this transformation is singular, it cannot be inverted.
Form (me) returns TrsfForm is static;
---C++: inline
--- Purpose :
-- Returns the nature of the transformation. It can be
-- an identity transformation, a rotation, a translation, a mirror
-- transformation (relative to a point or axis), a scaling
-- transformation, a compound transformation or some
-- other type of transformation.
TranslationPart (me) returns XY is static;
--- Purpose : Returns the translation part of the GTrsf2d.
---C++: inline
---C++: return const&
VectorialPart (me) returns Mat2d is static;
--- Purpose :
-- Computes the vectorial part of the GTrsf2d. The returned
-- Matrix is a 2*2 matrix.
---C++: inline
---C++: return const&
Value (me; Row, Col : Integer) returns Real
--- Purpose :
-- Returns the coefficients of the global matrix of transformation.
--- Raised OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3
---C++: inline
---C++: alias operator()
raises OutOfRange
is static;
Invert (me : in out) raises ConstructionError is static;
Inverted (me) returns GTrsf2d raises ConstructionError is static;
---C++: inline
--- Purpose :
-- Computes the reverse transformation.
-- Raised an exception if the matrix of the transformation
-- is not inversible.
Multiplied (me; T : GTrsf2d) returns GTrsf2d is static;
---C++: inline
---C++: alias operator *
--- Purpose :
-- Computes the transformation composed with T and <me>.
-- In a C++ implementation you can also write Tcomposed = <me> * T.
-- Example :
-- GTrsf2d T1, T2, Tcomp; ...............
-- //composition :
-- Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
-- // transformation of a point
-- XY P(10.,3.);
-- XY P1(P);
-- Tcomp.Transforms(P1); //using Tcomp
-- XY P2(P);
-- T1.Transforms(P2); //using T1 then T2
-- T2.Transforms(P2); // P1 = P2 !!!
Multiply (me : in out; T : GTrsf2d) is static;
---C++: alias operator *=
-- Computes the product of the transformation T and this
-- transformation, and assigns the result to this transformation:
-- this = this * T
PreMultiply (me : in out; T : GTrsf2d) is static;
--- Purpose :
-- Computes the product of the transformation T and this
-- transformation, and assigns the result to this transformation:
-- this = T * this
Power (me : in out; N : Integer) raises ConstructionError is static;
Powered (me; N : Integer) returns GTrsf2d raises ConstructionError is static;
---C++: inline
--- Purpose :
-- Computes the following composition of transformations
-- <me> * <me> * .......* <me>, N time.
-- if N = 0 <me> = Identity
-- if N < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().
--
-- Raises an exception if N < 0 and if the matrix of the
-- transformation is not inversible.
Transforms (me; Coord : in out XY) is static;
---C++: inline
Transformed(me; Coord : in XY from gp)
returns XY from gp
is static;
---C++: inline
Transforms (me; X, Y : in out Real) is static;
---C++: inline
---Purpose:
-- Applies this transformation to the coordinates:
-- - of the number pair Coord, or
-- - X and Y.
--
-- Note:
-- - Transforms modifies X, Y, or the coordinate pair Coord, while
-- - Transformed creates a new coordinate pair.
Trsf2d (me) returns Trsf2d raises ConstructionError is static;
---Purpose:
-- Converts this transformation into a gp_Trsf2d transformation.
-- Exceptions
-- Standard_ConstructionError if this transformation
-- cannot be converted, i.e. if its form is gp_Other.
fields
matrix : Mat2d;
loc : XY;
shape : TrsfForm;
scale : Real;
end;

View File

@@ -12,9 +12,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gp_GTrsf2d.ixx>
#include <Standard_ConstructionError.hxx>
#include <gp_Ax2d.hxx>
#include <gp_GTrsf2d.hxx>
#include <gp_Mat2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_XY.hxx>
#include <Precision.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
void gp_GTrsf2d::SetAffinity (const gp_Ax2d& A,
const Standard_Real Ratio)

254
src/gp/gp_GTrsf2d.hxx Normal file
View File

@@ -0,0 +1,254 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_GTrsf2d_HeaderFile
#define _gp_GTrsf2d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Mat2d.hxx>
#include <gp_XY.hxx>
#include <gp_TrsfForm.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class gp_Trsf2d;
class gp_Mat2d;
class gp_XY;
class gp_Ax2d;
//! Defines a non persistent transformation in 2D space.
//! This transformation is a general transformation.
//! It can be a Trsf2d from package gp, an affinity, or you can
//! define your own transformation giving the corresponding
//! matrix of transformation.
//!
//! With a GTrsf2d you can transform only a doublet of coordinates
//! XY. It is not possible to transform other geometric objects
//! because these transformations can change the nature of non-
//! elementary geometric objects.
//! A GTrsf2d is represented with a 2 rows * 3 columns matrix :
//!
//! V1 V2 T XY XY
//! | a11 a12 a14 | | x | | x'|
//! | a21 a22 a24 | | y | | y'|
//! | 0 0 1 | | 1 | | 1 |
//!
//! where {V1, V2} defines the vectorial part of the
//! transformation and T defines the translation part of
//! the transformation.
//! Warning
//! A GTrsf2d transformation is only applicable on
//! coordinates. Be careful if you apply such a
//! transformation to all the points of a geometric object,
//! as this can change the nature of the object and thus
//! render it incoherent!
//! Typically, a circle is transformed into an ellipse by an
//! affinity transformation. To avoid modifying the nature of
//! an object, use a gp_Trsf2d transformation instead, as
//! objects of this class respect the nature of geometric objects.
class gp_GTrsf2d
{
public:
DEFINE_STANDARD_ALLOC
//! returns identity transformation.
gp_GTrsf2d();
//! Converts the gp_Trsf2d transformation T into a
//! general transformation.
gp_GTrsf2d(const gp_Trsf2d& T);
//! Creates a transformation based on the matrix M and the
//! vector V where M defines the vectorial part of the
//! transformation, and V the translation part.
gp_GTrsf2d(const gp_Mat2d& M, const gp_XY& V);
//! Changes this transformation into an affinity of ratio Ratio
//! with respect to the axis A.
//! Note: An affinity is a point-by-point transformation that
//! transforms any point P into a point P' such that if H is
//! the orthogonal projection of P on the axis A, the vectors
//! HP and HP' satisfy: HP' = Ratio * HP.
Standard_EXPORT void SetAffinity (const gp_Ax2d& A, const Standard_Real Ratio);
//! Replaces the coefficient (Row, Col) of the matrix representing
//! this transformation by Value,
//! Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3
void SetValue (const Standard_Integer Row, const Standard_Integer Col, const Standard_Real Value);
//! Replacesthe translation part of this
//! transformation by the coordinates of the number pair Coord.
Standard_EXPORT void SetTranslationPart (const gp_XY& Coord);
//! Assigns the vectorial and translation parts of T to this transformation.
void SetTrsf2d (const gp_Trsf2d& T);
//! Replaces the vectorial part of this transformation by Matrix.
void SetVectorialPart (const gp_Mat2d& Matrix);
//! Returns true if the determinant of the vectorial part of
//! this transformation is negative.
Standard_Boolean IsNegative() const;
//! Returns true if this transformation is singular (and
//! therefore, cannot be inverted).
//! Note: The Gauss LU decomposition is used to invert the
//! transformation matrix. Consequently, the transformation
//! is considered as singular if the largest pivot found is less
//! than or equal to gp::Resolution().
//! Warning
//! If this transformation is singular, it cannot be inverted.
Standard_Boolean IsSingular() const;
//! Returns the nature of the transformation. It can be
//! an identity transformation, a rotation, a translation, a mirror
//! transformation (relative to a point or axis), a scaling
//! transformation, a compound transformation or some
//! other type of transformation.
gp_TrsfForm Form() const;
//! Returns the translation part of the GTrsf2d.
const gp_XY& TranslationPart() const;
//! Computes the vectorial part of the GTrsf2d. The returned
//! Matrix is a 2*2 matrix.
const gp_Mat2d& VectorialPart() const;
//! Returns the coefficients of the global matrix of transformation.
//! Raised OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3
Standard_Real Value (const Standard_Integer Row, const Standard_Integer Col) const;
Standard_Real operator() (const Standard_Integer Row, const Standard_Integer Col) const
{
return Value(Row,Col);
}
Standard_EXPORT void Invert();
//! Computes the reverse transformation.
//! Raised an exception if the matrix of the transformation
//! is not inversible.
gp_GTrsf2d Inverted() const;
//! Computes the transformation composed with T and <me>.
//! In a C++ implementation you can also write Tcomposed = <me> * T.
//! Example :
//! GTrsf2d T1, T2, Tcomp; ...............
//! //composition :
//! Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
//! // transformation of a point
//! XY P(10.,3.);
//! XY P1(P);
//! Tcomp.Transforms(P1); //using Tcomp
//! XY P2(P);
//! T1.Transforms(P2); //using T1 then T2
//! T2.Transforms(P2); // P1 = P2 !!!
gp_GTrsf2d Multiplied (const gp_GTrsf2d& T) const;
gp_GTrsf2d operator * (const gp_GTrsf2d& T) const
{
return Multiplied(T);
}
Standard_EXPORT void Multiply (const gp_GTrsf2d& T);
void operator *= (const gp_GTrsf2d& T)
{
Multiply(T);
}
//! Computes the product of the transformation T and this
//! transformation, and assigns the result to this transformation:
//! this = T * this
Standard_EXPORT void PreMultiply (const gp_GTrsf2d& T);
Standard_EXPORT void Power (const Standard_Integer N);
//! Computes the following composition of transformations
//! <me> * <me> * .......* <me>, N time.
//! if N = 0 <me> = Identity
//! if N < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().
//!
//! Raises an exception if N < 0 and if the matrix of the
//! transformation is not inversible.
gp_GTrsf2d Powered (const Standard_Integer N) const;
void Transforms (gp_XY& Coord) const;
gp_XY Transformed (const gp_XY& Coord) const;
//! Applies this transformation to the coordinates:
//! - of the number pair Coord, or
//! - X and Y.
//!
//! Note:
//! - Transforms modifies X, Y, or the coordinate pair Coord, while
//! - Transformed creates a new coordinate pair.
void Transforms (Standard_Real& X, Standard_Real& Y) const;
//! Converts this transformation into a gp_Trsf2d transformation.
//! Exceptions
//! Standard_ConstructionError if this transformation
//! cannot be converted, i.e. if its form is gp_Other.
Standard_EXPORT gp_Trsf2d Trsf2d() const;
protected:
private:
gp_Mat2d matrix;
gp_XY loc;
gp_TrsfForm shape;
Standard_Real scale;
};
#include <gp_GTrsf2d.lxx>
#endif // _gp_GTrsf2d_HeaderFile

View File

@@ -1,396 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Hypr from gp
--- Purpose : Describes a branch of a hyperbola in 3D space.
-- A hyperbola is defined by its major and minor radii and
-- positioned in space with a coordinate system (a gp_Ax2
-- object) of which:
-- - the origin is the center of the hyperbola,
-- - the "X Direction" defines the major axis of the
-- hyperbola, and
-- - the "Y Direction" defines the minor axis of the hyperbola.
-- The origin, "X Direction" and "Y Direction" of this
-- coordinate system together define the plane of the
-- hyperbola. This coordinate system is the "local
-- coordinate system" of the hyperbola. In this coordinate
-- system, the equation of the hyperbola is:
-- X*X/(MajorRadius**2)-Y*Y/(MinorRadius**2) = 1.0
-- The branch of the hyperbola described is the one located
-- on the positive side of the major axis.
-- The "main Direction" of the local coordinate system is a
-- normal vector to the plane of the hyperbola. This vector
-- gives an implicit orientation to the hyperbola. We refer to
-- the "main Axis" of the local coordinate system as the
-- "Axis" of the hyperbola.
-- The following schema shows the plane of the hyperbola,
-- and in it, the respective positions of the three branches of
-- hyperbolas constructed with the functions OtherBranch,
-- ConjugateBranch1, and ConjugateBranch2:
--
-- ^YAxis
-- |
-- FirstConjugateBranch
-- |
-- Other | Main
-- --------------------- C ------------------------------>XAxis
-- Branch | Branch
-- |
-- |
-- SecondConjugateBranch
-- | ^YAxis
-- Warning
-- The major radius can be less than the minor radius.
-- See Also
-- gce_MakeHypr which provides functions for more
-- complex hyperbola constructions
-- Geom_Hyperbola which provides additional functions for
-- constructing hyperbolas and works, in particular, with the
-- parametric equations of hyperbolas
uses Ax1 from gp,
Ax2 from gp,
Pln from gp,
Pnt from gp,
Trsf from gp,
Vec from gp
raises ConstructionError from Standard,
DomainError from Standard
is
Create returns Hypr;
---C++: inline
--- Purpose : Creates of an indefinite hyperbola.
Create (A2 : Ax2; MajorRadius, MinorRadius : Real) returns Hypr
---C++: inline
--- Purpose : Creates a hyperbola with radii MajorRadius and
-- MinorRadius, positioned in the space by the
-- coordinate system A2 such that:
-- - the origin of A2 is the center of the hyperbola,
-- - the "X Direction" of A2 defines the major axis of
-- the hyperbola, that is, the major radius
-- MajorRadius is measured along this axis, and
-- - the "Y Direction" of A2 defines the minor axis of
-- the hyperbola, that is, the minor radius
-- MinorRadius is measured along this axis.
-- Note: This class does not prevent the creation of a
-- hyperbola where:
-- - MajorAxis is equal to MinorAxis, or
-- - MajorAxis is less than MinorAxis.
-- Exceptions
-- Standard_ConstructionError if MajorAxis or MinorAxis is negative.
-- Raises ConstructionError if MajorRadius < 0.0 or MinorRadius < 0.0
raises ConstructionError;
--- Purpose : Raised if MajorRadius < 0.0 or MinorRadius < 0.0
SetAxis (me : in out; A1 : Ax1)
---C++: inline
--- Purpose : Modifies this hyperbola, by redefining its local coordinate
-- system so that:
-- - its origin and "main Direction" become those of the
-- axis A1 (the "X Direction" and "Y Direction" are then
-- recomputed in the same way as for any gp_Ax2).
-- Raises ConstructionError if the direction of A1 is parallel to the direction of
-- the "XAxis" of the hyperbola.
raises ConstructionError
is static;
SetLocation (me : in out; P : Pnt) is static;
---C++: inline
--- Purpose : Modifies this hyperbola, by redefining its local coordinate
-- system so that its origin becomes P.
SetMajorRadius (me : in out; MajorRadius : Real)
---C++: inline
--- Purpose:
-- Modifies the major radius of this hyperbola.
-- Exceptions
-- Standard_ConstructionError if MajorRadius is negative.
raises ConstructionError
is static;
SetMinorRadius (me : in out; MinorRadius : Real)
---C++: inline
--- Purpose:
-- Modifies the minor radius of this hyperbola.
-- Exceptions
-- Standard_ConstructionError if MinorRadius is negative.
raises ConstructionError
is static;
SetPosition (me : in out; A2 : Ax2) is static;
---C++: inline
--- Purpose : Modifies this hyperbola, by redefining its local coordinate
-- system so that it becomes A2.
Asymptote1 (me) returns Ax1
---C++: inline
--- Purpose :
-- In the local coordinate system of the hyperbola the equation of
-- the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 and the
-- equation of the first asymptote is Y = (B/A)*X
-- where A is the major radius and B is the minor radius. Raises ConstructionError if MajorRadius = 0.0
raises ConstructionError
is static;
Asymptote2 (me) returns Ax1
---C++: inline
--- Purpose :
-- In the local coordinate system of the hyperbola the equation of
-- the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 and the
-- equation of the first asymptote is Y = -(B/A)*X.
-- where A is the major radius and B is the minor radius. Raises ConstructionError if MajorRadius = 0.0
raises ConstructionError
is static;
Axis (me) returns Ax1 is static;
---C++: inline
--- Purpose : Returns the axis passing through the center,
-- and normal to the plane of this hyperbola.
---C++: return const&
ConjugateBranch1 (me) returns Hypr is static;
---C++: inline
--- Purpose :
-- Computes the branch of hyperbola which is on the positive side of the
-- "YAxis" of <me>.
ConjugateBranch2 (me) returns Hypr is static;
---C++: inline
--- Purpose :
-- Computes the branch of hyperbola which is on the negative side of the
-- "YAxis" of <me>.
Directrix1 (me) returns Ax1 is static;
---C++: inline
--- Purpose :
-- This directrix is the line normal to the XAxis of the hyperbola
-- in the local plane (Z = 0) at a distance d = MajorRadius / e
-- from the center of the hyperbola, where e is the eccentricity of
-- the hyperbola.
-- This line is parallel to the "YAxis". The intersection point
-- between the directrix1 and the "XAxis" is the "Location" point
-- of the directrix1. This point is on the positive side of the
-- "XAxis".
Directrix2 (me) returns Ax1 is static;
---C++: inline
--- Purpose :
-- This line is obtained by the symmetrical transformation
-- of "Directrix1" with respect to the "YAxis" of the hyperbola.
Eccentricity (me) returns Real
---C++: inline
--- Purpose :
-- Returns the excentricity of the hyperbola (e > 1).
-- If f is the distance between the location of the hyperbola
-- and the Focus1 then the eccentricity e = f / MajorRadius. Raises DomainError if MajorRadius = 0.0
raises DomainError
is static;
Focal (me) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the focal distance. It is the distance between the
-- the two focus of the hyperbola.
Focus1 (me) returns Pnt is static;
---C++: inline
--- Purpose :
-- Returns the first focus of the hyperbola. This focus is on the
-- positive side of the "XAxis" of the hyperbola.
Focus2 (me) returns Pnt is static;
---C++: inline
--- Purpose :
-- Returns the second focus of the hyperbola. This focus is on the
-- negative side of the "XAxis" of the hyperbola.
Location (me) returns Pnt is static;
---C++: inline
--- Purpose :
-- Returns the location point of the hyperbola. It is the
-- intersection point between the "XAxis" and the "YAxis".
---C++: return const&
MajorRadius (me) returns Real is static;
---C++: inline
--- Purpose :
-- Returns the major radius of the hyperbola. It is the radius
-- on the "XAxis" of the hyperbola.
MinorRadius (me) returns Real is static;
---C++: inline
--- Purpose :
-- Returns the minor radius of the hyperbola. It is the radius
-- on the "YAxis" of the hyperbola.
OtherBranch (me) returns Hypr is static;
---C++: inline
--- Purpose :
-- Returns the branch of hyperbola obtained by doing the
-- symmetrical transformation of <me> with respect to the
-- "YAxis" of <me>.
Parameter (me) returns Real
---C++: inline
--- Purpose :
-- Returns p = (e * e - 1) * MajorRadius where e is the
-- eccentricity of the hyperbola.
--- Raises DomainError if MajorRadius = 0.0
raises DomainError
is static;
Position (me) returns Ax2 is static;
--- Purpose : Returns the coordinate system of the hyperbola.
---C++: inline
---C++: return const&
XAxis (me) returns Ax1 is static;
---C++: inline
--- Purpose : Computes an axis, whose
-- - the origin is the center of this hyperbola, and
-- - the unit vector is the "X Direction"
-- of the local coordinate system of this hyperbola.
-- These axes are, the major axis (the "X
-- Axis") and of this hyperboReturns the "XAxis" of the hyperbola.
YAxis (me) returns Ax1 is static;
---C++: inline
--- Purpose : Computes an axis, whose
-- - the origin is the center of this hyperbola, and
-- - the unit vector is the "Y Direction"
-- of the local coordinate system of this hyperbola.
-- These axes are the minor axis (the "Y Axis") of this hyperbola
Mirror (me : in out; P : Pnt) is static;
Mirrored (me; P : Pnt) returns Hypr is static;
--- Purpose :
-- Performs the symmetrical transformation of an hyperbola with
-- respect to the point P which is the center of the symmetry.
Mirror (me : in out; A1 : Ax1) is static;
Mirrored (me; A1 : Ax1) returns Hypr is static;
--- Purpose :
-- Performs the symmetrical transformation of an hyperbola with
-- respect to an axis placement which is the axis of the symmetry.
Mirror (me : in out; A2 : Ax2) is static;
Mirrored (me; A2 : Ax2) returns Hypr is static;
--- Purpose :
-- Performs the symmetrical transformation of an hyperbola with
-- respect to a plane. The axis placement A2 locates the plane
-- of the symmetry (Location, XDirection, YDirection).
Rotate (me : in out; A1 : Ax1; Ang : Real) is static;
---C++: inline
Rotated (me; A1 : Ax1; Ang : Real) returns Hypr is static;
---C++: inline
--- Purpose :
-- Rotates an hyperbola. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt; S : Real) is static;
---C++: inline
Scaled (me; P : Pnt; S : Real) returns Hypr is static;
---C++: inline
--- Purpose :
-- Scales an hyperbola. S is the scaling value.
Transform (me : in out; T : Trsf) is static;
---C++: inline
Transformed (me; T : Trsf) returns Hypr is static;
---C++: inline
--- Purpose :
-- Transforms an hyperbola with the transformation T from
-- class Trsf.
Translate (me : in out; V : Vec) is static;
---C++: inline
Translated (me; V : Vec) returns Hypr is static;
---C++: inline
--- Purpose :
-- Translates an hyperbola in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate(me : in out; P1, P2 : Pnt) is static;
---C++: inline
Translated (me; P1, P2 : Pnt) returns Hypr is static;
---C++: inline
--- Purpose :
-- Translates an hyperbola from the point P1 to the point P2.
fields
pos : Ax2;
majorRadius : Real;
minorRadius : Real;
end;

View File

@@ -14,7 +14,14 @@
// Modif jcv 14/12/90 suite a la premiere revue de projet
#include <gp_Hypr.ixx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Hypr.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_DomainError.hxx>
void gp_Hypr::Mirror (const gp_Pnt& P)
{ pos.Mirror(P); }

331
src/gp/gp_Hypr.hxx Normal file
View File

@@ -0,0 +1,331 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Hypr_HeaderFile
#define _gp_Hypr_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax2.hxx>
#include <Standard_Real.hxx>
#include <gp_Ax1.hxx>
#include <gp_Pnt.hxx>
class Standard_ConstructionError;
class Standard_DomainError;
class gp_Ax2;
class gp_Ax1;
class gp_Pnt;
class gp_Trsf;
class gp_Vec;
//! Describes a branch of a hyperbola in 3D space.
//! A hyperbola is defined by its major and minor radii and
//! positioned in space with a coordinate system (a gp_Ax2
//! object) of which:
//! - the origin is the center of the hyperbola,
//! - the "X Direction" defines the major axis of the
//! hyperbola, and
//! - the "Y Direction" defines the minor axis of the hyperbola.
//! The origin, "X Direction" and "Y Direction" of this
//! coordinate system together define the plane of the
//! hyperbola. This coordinate system is the "local
//! coordinate system" of the hyperbola. In this coordinate
//! system, the equation of the hyperbola is:
//! X*X/(MajorRadius**2)-Y*Y/(MinorRadius**2) = 1.0
//! The branch of the hyperbola described is the one located
//! on the positive side of the major axis.
//! The "main Direction" of the local coordinate system is a
//! normal vector to the plane of the hyperbola. This vector
//! gives an implicit orientation to the hyperbola. We refer to
//! the "main Axis" of the local coordinate system as the
//! "Axis" of the hyperbola.
//! The following schema shows the plane of the hyperbola,
//! and in it, the respective positions of the three branches of
//! hyperbolas constructed with the functions OtherBranch,
//! ConjugateBranch1, and ConjugateBranch2:
//!
//! ^YAxis
//! |
//! FirstConjugateBranch
//! |
//! Other | Main
//! --------------------- C ------------------------------>XAxis
//! Branch | Branch
//! |
//! |
//! SecondConjugateBranch
//! | ^YAxis
//! Warning
//! The major radius can be less than the minor radius.
//! See Also
//! gce_MakeHypr which provides functions for more
//! complex hyperbola constructions
//! Geom_Hyperbola which provides additional functions for
//! constructing hyperbolas and works, in particular, with the
//! parametric equations of hyperbolas
class gp_Hypr
{
public:
DEFINE_STANDARD_ALLOC
//! Creates of an indefinite hyperbola.
gp_Hypr();
//! Creates a hyperbola with radii MajorRadius and
//! MinorRadius, positioned in the space by the
//! coordinate system A2 such that:
//! - the origin of A2 is the center of the hyperbola,
//! - the "X Direction" of A2 defines the major axis of
//! the hyperbola, that is, the major radius
//! MajorRadius is measured along this axis, and
//! - the "Y Direction" of A2 defines the minor axis of
//! the hyperbola, that is, the minor radius
//! MinorRadius is measured along this axis.
//! Note: This class does not prevent the creation of a
//! hyperbola where:
//! - MajorAxis is equal to MinorAxis, or
//! - MajorAxis is less than MinorAxis.
//! Exceptions
//! Standard_ConstructionError if MajorAxis or MinorAxis is negative.
//! Raises ConstructionError if MajorRadius < 0.0 or MinorRadius < 0.0
//! Raised if MajorRadius < 0.0 or MinorRadius < 0.0
gp_Hypr(const gp_Ax2& A2, const Standard_Real MajorRadius, const Standard_Real MinorRadius);
//! Modifies this hyperbola, by redefining its local coordinate
//! system so that:
//! - its origin and "main Direction" become those of the
//! axis A1 (the "X Direction" and "Y Direction" are then
//! recomputed in the same way as for any gp_Ax2).
//! Raises ConstructionError if the direction of A1 is parallel to the direction of
//! the "XAxis" of the hyperbola.
void SetAxis (const gp_Ax1& A1);
//! Modifies this hyperbola, by redefining its local coordinate
//! system so that its origin becomes P.
void SetLocation (const gp_Pnt& P);
//! Modifies the major radius of this hyperbola.
//! Exceptions
//! Standard_ConstructionError if MajorRadius is negative.
void SetMajorRadius (const Standard_Real MajorRadius);
//! Modifies the minor radius of this hyperbola.
//! Exceptions
//! Standard_ConstructionError if MinorRadius is negative.
void SetMinorRadius (const Standard_Real MinorRadius);
//! Modifies this hyperbola, by redefining its local coordinate
//! system so that it becomes A2.
void SetPosition (const gp_Ax2& A2);
//! In the local coordinate system of the hyperbola the equation of
//! the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 and the
//! equation of the first asymptote is Y = (B/A)*X
//! where A is the major radius and B is the minor radius. Raises ConstructionError if MajorRadius = 0.0
gp_Ax1 Asymptote1() const;
//! In the local coordinate system of the hyperbola the equation of
//! the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 and the
//! equation of the first asymptote is Y = -(B/A)*X.
//! where A is the major radius and B is the minor radius. Raises ConstructionError if MajorRadius = 0.0
gp_Ax1 Asymptote2() const;
//! Returns the axis passing through the center,
//! and normal to the plane of this hyperbola.
const gp_Ax1& Axis() const;
//! Computes the branch of hyperbola which is on the positive side of the
//! "YAxis" of <me>.
gp_Hypr ConjugateBranch1() const;
//! Computes the branch of hyperbola which is on the negative side of the
//! "YAxis" of <me>.
gp_Hypr ConjugateBranch2() const;
//! This directrix is the line normal to the XAxis of the hyperbola
//! in the local plane (Z = 0) at a distance d = MajorRadius / e
//! from the center of the hyperbola, where e is the eccentricity of
//! the hyperbola.
//! This line is parallel to the "YAxis". The intersection point
//! between the directrix1 and the "XAxis" is the "Location" point
//! of the directrix1. This point is on the positive side of the
//! "XAxis".
gp_Ax1 Directrix1() const;
//! This line is obtained by the symmetrical transformation
//! of "Directrix1" with respect to the "YAxis" of the hyperbola.
gp_Ax1 Directrix2() const;
//! Returns the excentricity of the hyperbola (e > 1).
//! If f is the distance between the location of the hyperbola
//! and the Focus1 then the eccentricity e = f / MajorRadius. Raises DomainError if MajorRadius = 0.0
Standard_Real Eccentricity() const;
//! Computes the focal distance. It is the distance between the
//! the two focus of the hyperbola.
Standard_Real Focal() const;
//! Returns the first focus of the hyperbola. This focus is on the
//! positive side of the "XAxis" of the hyperbola.
gp_Pnt Focus1() const;
//! Returns the second focus of the hyperbola. This focus is on the
//! negative side of the "XAxis" of the hyperbola.
gp_Pnt Focus2() const;
//! Returns the location point of the hyperbola. It is the
//! intersection point between the "XAxis" and the "YAxis".
const gp_Pnt& Location() const;
//! Returns the major radius of the hyperbola. It is the radius
//! on the "XAxis" of the hyperbola.
Standard_Real MajorRadius() const;
//! Returns the minor radius of the hyperbola. It is the radius
//! on the "YAxis" of the hyperbola.
Standard_Real MinorRadius() const;
//! Returns the branch of hyperbola obtained by doing the
//! symmetrical transformation of <me> with respect to the
//! "YAxis" of <me>.
gp_Hypr OtherBranch() const;
//! Returns p = (e * e - 1) * MajorRadius where e is the
//! eccentricity of the hyperbola.
//! Raises DomainError if MajorRadius = 0.0
Standard_Real Parameter() const;
//! Returns the coordinate system of the hyperbola.
const gp_Ax2& Position() const;
//! Computes an axis, whose
//! - the origin is the center of this hyperbola, and
//! - the unit vector is the "X Direction"
//! of the local coordinate system of this hyperbola.
//! These axes are, the major axis (the "X
//! Axis") and of this hyperboReturns the "XAxis" of the hyperbola.
gp_Ax1 XAxis() const;
//! Computes an axis, whose
//! - the origin is the center of this hyperbola, and
//! - the unit vector is the "Y Direction"
//! of the local coordinate system of this hyperbola.
//! These axes are the minor axis (the "Y Axis") of this hyperbola
gp_Ax1 YAxis() const;
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of an hyperbola with
//! respect to the point P which is the center of the symmetry.
Standard_EXPORT gp_Hypr Mirrored (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of an hyperbola with
//! respect to an axis placement which is the axis of the symmetry.
Standard_EXPORT gp_Hypr Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of an hyperbola with
//! respect to a plane. The axis placement A2 locates the plane
//! of the symmetry (Location, XDirection, YDirection).
Standard_EXPORT gp_Hypr Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates an hyperbola. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Hypr Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Scales an hyperbola. S is the scaling value.
gp_Hypr Scaled (const gp_Pnt& P, const Standard_Real S) const;
void Transform (const gp_Trsf& T);
//! Transforms an hyperbola with the transformation T from
//! class Trsf.
gp_Hypr Transformed (const gp_Trsf& T) const;
void Translate (const gp_Vec& V);
//! Translates an hyperbola in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Hypr Translated (const gp_Vec& V) const;
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates an hyperbola from the point P1 to the point P2.
gp_Hypr Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Ax2 pos;
Standard_Real majorRadius;
Standard_Real minorRadius;
};
#include <gp_Hypr.lxx>
#endif // _gp_Hypr_HeaderFile

View File

@@ -1,425 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Hypr2d from gp
---Purpose:
-- Describes a branch of a hyperbola in the plane (2D space).
-- A hyperbola is defined by its major and minor radii, and
-- positioned in the plane with a coordinate system (a
-- gp_Ax22d object) of which:
-- - the origin is the center of the hyperbola,
-- - the "X Direction" defines the major axis of the hyperbola, and
-- - the "Y Direction" defines the minor axis of the hyperbola.
-- This coordinate system is the "local coordinate system"
-- of the hyperbola. The orientation of this coordinate
-- system (direct or indirect) gives an implicit orientation to
-- the hyperbola. In this coordinate system, the equation of
-- the hyperbola is:
-- X*X/(MajorRadius**2)-Y*Y/(MinorRadius**2) = 1.0
-- The branch of the hyperbola described is the one located
-- on the positive side of the major axis.
-- The following schema shows the plane of the hyperbola,
-- and in it, the respective positions of the three branches of
-- hyperbolas constructed with the functions OtherBranch,
-- ConjugateBranch1, and ConjugateBranch2:
-- ^YAxis
-- |
-- FirstConjugateBranch
-- |
-- Other | Main
-- --------------------- C ------------------------------>XAxis
-- Branch | Branch
-- |
-- |
-- SecondConjugateBranch
-- |
--
-- Warning
-- The major radius can be less than the minor radius.
-- See Also
-- gce_MakeHypr2d which provides functions for more
-- complex hyperbola constructions
-- Geom2d_Hyperbola which provides additional functions
-- for constructing hyperbolas and works, in particular, with
-- the parametric equations of hyperbolas
uses Ax2d from gp,
Ax22d from gp,
Pnt2d from gp,
Trsf2d from gp,
Vec2d from gp
raises ConstructionError from Standard,
DomainError from Standard
is
Create returns Hypr2d;
---C++: inline
--- Purpose : Creates of an indefinite hyperbola.
Create (MajorAxis : Ax2d;
MajorRadius, MinorRadius : Real;
Sense : Boolean from Standard = Standard_True)
returns Hypr2d
--- Purpose :
-- Creates a hyperbola with radii MajorRadius and
-- MinorRadius, centered on the origin of MajorAxis
-- and where the unit vector of MajorAxis is the "X
-- Direction" of the local coordinate system of the
-- hyperbola. This coordinate system is direct if Sense
-- is true (the default value), and indirect if Sense is false.
-- Warnings :
-- It is yet possible to create an Hyperbola with
-- MajorRadius <= MinorRadius.
-- Raises ConstructionError if MajorRadius < 0.0 or MinorRadius < 0.0
raises ConstructionError;
Create (A : Ax22d; MajorRadius, MinorRadius : Real)
returns Hypr2d
---C++: inline
--- Purpose :
-- a hyperbola with radii MajorRadius and
-- MinorRadius, positioned in the plane by coordinate system A where:
-- - the origin of A is the center of the hyperbola,
-- - the "X Direction" of A defines the major axis of
-- the hyperbola, that is, the major radius
-- MajorRadius is measured along this axis, and
-- - the "Y Direction" of A defines the minor axis of
-- the hyperbola, that is, the minor radius
-- MinorRadius is measured along this axis, and
-- - the orientation (direct or indirect sense) of A
-- gives the implicit orientation of the hyperbola.
-- Warnings :
-- It is yet possible to create an Hyperbola with
-- MajorRadius <= MinorRadius.
-- Raises ConstructionError if MajorRadius < 0.0 or MinorRadius < 0.0
raises ConstructionError;
SetLocation (me : in out; P : Pnt2d) is static;
---C++: inline
--- Purpose : Modifies this hyperbola, by redefining its local
-- coordinate system so that its origin becomes P.
SetMajorRadius (me : in out; MajorRadius : Real)
raises ConstructionError
---C++: inline
---Purpose: Modifies the major or minor radius of this hyperbola.
-- Exceptions
-- Standard_ConstructionError if MajorRadius or
-- MinorRadius is negative.
is static;
SetMinorRadius (me : in out; MinorRadius : Real)
raises ConstructionError
---C++: inline
---Purpose: Modifies the major or minor radius of this hyperbola.
-- Exceptions
-- Standard_ConstructionError if MajorRadius or
-- MinorRadius is negative.
is static;
SetAxis (me : in out; A : Ax22d) is static;
---C++: inline
--- Purpose : Modifies this hyperbola, by redefining its local
-- coordinate system so that it becomes A.
SetXAxis (me : in out; A : Ax2d) is static;
---C++: inline
--- Purpose :
-- Changes the major axis of the hyperbola. The minor axis is
-- recomputed and the location of the hyperbola too.
SetYAxis (me : in out; A : Ax2d) is static;
---C++: inline
--- Purpose :
-- Changes the minor axis of the hyperbola.The minor axis is
-- recomputed and the location of the hyperbola too.
Asymptote1 (me) returns Ax2d
---C++: inline
--- Purpose :
-- In the local coordinate system of the hyperbola the equation of
-- the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 and the
-- equation of the first asymptote is Y = (B/A)*X
-- where A is the major radius of the hyperbola and B the minor
-- radius of the hyperbola.
-- Raises ConstructionError if MajorRadius = 0.0
raises ConstructionError
is static;
Asymptote2 (me) returns Ax2d
---C++: inline
--- Purpose :
-- In the local coordinate system of the hyperbola the equation of
-- the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 and the
-- equation of the first asymptote is Y = -(B/A)*X
-- where A is the major radius of the hyperbola and B the minor
-- radius of the hyperbola.
-- Raises ConstructionError if MajorRadius = 0.0
raises ConstructionError
is static;
Coefficients (me; A, B, C, D, E, F : out Real) is static;
--- Purpose :
-- Computes the coefficients of the implicit equation of
-- the hyperbola :
-- A * (X**2) + B * (Y**2) + 2*C*(X*Y) + 2*D*X + 2*E*Y + F = 0.
ConjugateBranch1 (me) returns Hypr2d is static;
---C++: inline
--- Purpose :
-- Computes the branch of hyperbola which is on the positive side of the
-- "YAxis" of <me>.
ConjugateBranch2 (me) returns Hypr2d is static;
---C++: inline
--- Purpose :
-- Computes the branch of hyperbola which is on the negative side of the
-- "YAxis" of <me>.
Directrix1 (me) returns Ax2d is static;
---C++: inline
--- Purpose :
-- Computes the directrix which is the line normal to the XAxis of the hyperbola
-- in the local plane (Z = 0) at a distance d = MajorRadius / e
-- from the center of the hyperbola, where e is the eccentricity of
-- the hyperbola.
-- This line is parallel to the "YAxis". The intersection point
-- between the "Directrix1" and the "XAxis" is the "Location" point
-- of the "Directrix1".
-- This point is on the positive side of the "XAxis".
Directrix2 (me) returns Ax2d is static;
---C++: inline
--- Purpose :
-- This line is obtained by the symmetrical transformation
-- of "Directrix1" with respect to the "YAxis" of the hyperbola.
Eccentricity (me) returns Real
---C++: inline
--- Purpose :
-- Returns the excentricity of the hyperbola (e > 1).
-- If f is the distance between the location of the hyperbola
-- and the Focus1 then the eccentricity e = f / MajorRadius. Raises DomainError if MajorRadius = 0.0.
raises DomainError
is static;
Focal (me) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the focal distance. It is the distance between the
-- "Location" of the hyperbola and "Focus1" or "Focus2".
Focus1 (me) returns Pnt2d is static;
---C++: inline
--- Purpose :
-- Returns the first focus of the hyperbola. This focus is on the
-- positive side of the "XAxis" of the hyperbola.
Focus2 (me) returns Pnt2d is static;
---C++: inline
--- Purpose :
-- Returns the second focus of the hyperbola. This focus is on the
-- negative side of the "XAxis" of the hyperbola.
Location (me) returns Pnt2d is static;
---C++: inline
--- Purpose :
-- Returns the location point of the hyperbola.
-- It is the intersection point between the "XAxis" and
-- the "YAxis".
---C++: return const&
MajorRadius (me) returns Real is static;
---C++: inline
--- Purpose :
-- Returns the major radius of the hyperbola (it is the radius
-- corresponding to the "XAxis" of the hyperbola).
MinorRadius (me) returns Real is static;
---C++: inline
--- Purpose :
-- Returns the minor radius of the hyperbola (it is the radius
-- corresponding to the "YAxis" of the hyperbola).
OtherBranch (me) returns Hypr2d is static;
---C++: inline
--- Purpose :
-- Returns the branch of hyperbola obtained by doing the
-- symmetrical transformation of <me> with respect to the
-- "YAxis" of <me>.
Parameter (me) returns Real
---C++: inline
--- Purpose :
-- Returns p = (e * e - 1) * MajorRadius where e is the
-- eccentricity of the hyperbola.
-- Raises DomainError if MajorRadius = 0.0
raises DomainError
is static;
Axis (me) returns Ax22d is static;
--- Purpose : Returns the axisplacement of the hyperbola.
---C++: inline
---C++: return const&
XAxis (me) returns Ax2d is static;
--- Purpose : Computes an axis whose
-- - the origin is the center of this hyperbola, and
-- - the unit vector is the "X Direction" or "Y Direction"
-- respectively of the local coordinate system of this hyperbola
-- Returns the major axis of the hyperbola.
YAxis (me) returns Ax2d is static;
---C++: inline
--- Purpose : Computes an axis whose
-- - the origin is the center of this hyperbola, and
-- - the unit vector is the "X Direction" or "Y Direction"
-- respectively of the local coordinate system of this hyperbola
-- Returns the minor axis of the hyperbola.
Reverse (me : in out) is static;
---C++: inline
Reversed (me) returns Hypr2d is static;
---C++: inline
---Purpose: Reverses the orientation of the local coordinate system
-- of this hyperbola (the "Y Axis" is reversed). Therefore,
-- the implicit orientation of this hyperbola is reversed.
-- Note:
-- - Reverse assigns the result to this hyperbola, while
-- - Reversed creates a new one.
IsDirect (me) returns Boolean is static;
---C++: inline
--- Purpose : Returns true if the local coordinate system is direct
-- and false in the other case.
Mirror (me : in out; P : Pnt2d) is static;
Mirrored (me; P : Pnt2d) returns Hypr2d is static;
--- Purpose :
-- Performs the symmetrical transformation of an hyperbola with
-- respect to the point P which is the center of the symmetry.
Mirror (me : in out; A : Ax2d) is static;
Mirrored (me; A : Ax2d) returns Hypr2d is static;
--- Purpose :
-- Performs the symmetrical transformation of an hyperbola with
-- respect to an axis placement which is the axis of the symmetry.
Rotate (me : in out; P : Pnt2d; Ang : Real) is static;
---C++: inline
Rotated (me; P : Pnt2d; Ang : Real) returns Hypr2d is static;
---C++: inline
--- Purpose :
-- Rotates an hyperbola. P is the center of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt2d; S : Real) is static;
---C++: inline
Scaled (me; P : Pnt2d; S : Real) returns Hypr2d is static;
---C++: inline
--- Purpose :
-- Scales an hyperbola. <S> is the scaling value.
-- If <S> is positive only the location point is
-- modified. But if <S> is negative the "XAxis" is
-- reversed and the "YAxis" too.
Transform (me : in out; T : Trsf2d) is static;
---C++: inline
Transformed (me; T : Trsf2d) returns Hypr2d is static;
---C++: inline
--- Purpose :
-- Transforms an hyperbola with the transformation T from
-- class Trsf2d.
Translate (me : in out; V : Vec2d) is static;
---C++: inline
Translated (me; V : Vec2d) returns Hypr2d is static;
---C++: inline
--- Purpose :
-- Translates an hyperbola in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt2d) is static;
---C++: inline
Translated (me; P1, P2 : Pnt2d) returns Hypr2d is static;
---C++: inline
--- Purpose :
-- Translates an hyperbola from the point P1 to the point P2.
fields
pos : Ax22d;
majorRadius : Real;
minorRadius : Real;
end;

View File

@@ -14,7 +14,15 @@
#define No_Standard_OutOfRange
#include <gp_Hypr2d.ixx>
#include <gp_Ax2d.hxx>
#include <gp_Ax22d.hxx>
#include <gp_Hypr2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_DomainError.hxx>
void gp_Hypr2d::Coefficients (Standard_Real& A,
Standard_Real& B,

354
src/gp/gp_Hypr2d.hxx Normal file
View File

@@ -0,0 +1,354 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Hypr2d_HeaderFile
#define _gp_Hypr2d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax22d.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <gp_Ax2d.hxx>
#include <gp_Pnt2d.hxx>
class Standard_ConstructionError;
class Standard_DomainError;
class gp_Ax2d;
class gp_Ax22d;
class gp_Pnt2d;
class gp_Trsf2d;
class gp_Vec2d;
//! Describes a branch of a hyperbola in the plane (2D space).
//! A hyperbola is defined by its major and minor radii, and
//! positioned in the plane with a coordinate system (a
//! gp_Ax22d object) of which:
//! - the origin is the center of the hyperbola,
//! - the "X Direction" defines the major axis of the hyperbola, and
//! - the "Y Direction" defines the minor axis of the hyperbola.
//! This coordinate system is the "local coordinate system"
//! of the hyperbola. The orientation of this coordinate
//! system (direct or indirect) gives an implicit orientation to
//! the hyperbola. In this coordinate system, the equation of
//! the hyperbola is:
//! X*X/(MajorRadius**2)-Y*Y/(MinorRadius**2) = 1.0
//! The branch of the hyperbola described is the one located
//! on the positive side of the major axis.
//! The following schema shows the plane of the hyperbola,
//! and in it, the respective positions of the three branches of
//! hyperbolas constructed with the functions OtherBranch,
//! ConjugateBranch1, and ConjugateBranch2:
//! ^YAxis
//! |
//! FirstConjugateBranch
//! |
//! Other | Main
//! --------------------- C ------------------------------>XAxis
//! Branch | Branch
//! |
//! |
//! SecondConjugateBranch
//! |
//!
//! Warning
//! The major radius can be less than the minor radius.
//! See Also
//! gce_MakeHypr2d which provides functions for more
//! complex hyperbola constructions
//! Geom2d_Hyperbola which provides additional functions
//! for constructing hyperbolas and works, in particular, with
//! the parametric equations of hyperbolas
class gp_Hypr2d
{
public:
DEFINE_STANDARD_ALLOC
//! Creates of an indefinite hyperbola.
gp_Hypr2d();
//! Creates a hyperbola with radii MajorRadius and
//! MinorRadius, centered on the origin of MajorAxis
//! and where the unit vector of MajorAxis is the "X
//! Direction" of the local coordinate system of the
//! hyperbola. This coordinate system is direct if Sense
//! is true (the default value), and indirect if Sense is false.
//! Warnings :
//! It is yet possible to create an Hyperbola with
//! MajorRadius <= MinorRadius.
//! Raises ConstructionError if MajorRadius < 0.0 or MinorRadius < 0.0
Standard_EXPORT gp_Hypr2d(const gp_Ax2d& MajorAxis, const Standard_Real MajorRadius, const Standard_Real MinorRadius, const Standard_Boolean Sense = Standard_True);
//! a hyperbola with radii MajorRadius and
//! MinorRadius, positioned in the plane by coordinate system A where:
//! - the origin of A is the center of the hyperbola,
//! - the "X Direction" of A defines the major axis of
//! the hyperbola, that is, the major radius
//! MajorRadius is measured along this axis, and
//! - the "Y Direction" of A defines the minor axis of
//! the hyperbola, that is, the minor radius
//! MinorRadius is measured along this axis, and
//! - the orientation (direct or indirect sense) of A
//! gives the implicit orientation of the hyperbola.
//! Warnings :
//! It is yet possible to create an Hyperbola with
//! MajorRadius <= MinorRadius.
//! Raises ConstructionError if MajorRadius < 0.0 or MinorRadius < 0.0
gp_Hypr2d(const gp_Ax22d& A, const Standard_Real MajorRadius, const Standard_Real MinorRadius);
//! Modifies this hyperbola, by redefining its local
//! coordinate system so that its origin becomes P.
void SetLocation (const gp_Pnt2d& P);
//! Modifies the major or minor radius of this hyperbola.
//! Exceptions
//! Standard_ConstructionError if MajorRadius or
//! MinorRadius is negative.
void SetMajorRadius (const Standard_Real MajorRadius);
//! Modifies the major or minor radius of this hyperbola.
//! Exceptions
//! Standard_ConstructionError if MajorRadius or
//! MinorRadius is negative.
void SetMinorRadius (const Standard_Real MinorRadius);
//! Modifies this hyperbola, by redefining its local
//! coordinate system so that it becomes A.
void SetAxis (const gp_Ax22d& A);
//! Changes the major axis of the hyperbola. The minor axis is
//! recomputed and the location of the hyperbola too.
void SetXAxis (const gp_Ax2d& A);
//! Changes the minor axis of the hyperbola.The minor axis is
//! recomputed and the location of the hyperbola too.
void SetYAxis (const gp_Ax2d& A);
//! In the local coordinate system of the hyperbola the equation of
//! the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 and the
//! equation of the first asymptote is Y = (B/A)*X
//! where A is the major radius of the hyperbola and B the minor
//! radius of the hyperbola.
//! Raises ConstructionError if MajorRadius = 0.0
gp_Ax2d Asymptote1() const;
//! In the local coordinate system of the hyperbola the equation of
//! the hyperbola is (X*X)/(A*A) - (Y*Y)/(B*B) = 1.0 and the
//! equation of the first asymptote is Y = -(B/A)*X
//! where A is the major radius of the hyperbola and B the minor
//! radius of the hyperbola.
//! Raises ConstructionError if MajorRadius = 0.0
gp_Ax2d Asymptote2() const;
//! Computes the coefficients of the implicit equation of
//! the hyperbola :
//! A * (X**2) + B * (Y**2) + 2*C*(X*Y) + 2*D*X + 2*E*Y + F = 0.
Standard_EXPORT void Coefficients (Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& D, Standard_Real& E, Standard_Real& F) const;
//! Computes the branch of hyperbola which is on the positive side of the
//! "YAxis" of <me>.
gp_Hypr2d ConjugateBranch1() const;
//! Computes the branch of hyperbola which is on the negative side of the
//! "YAxis" of <me>.
gp_Hypr2d ConjugateBranch2() const;
//! Computes the directrix which is the line normal to the XAxis of the hyperbola
//! in the local plane (Z = 0) at a distance d = MajorRadius / e
//! from the center of the hyperbola, where e is the eccentricity of
//! the hyperbola.
//! This line is parallel to the "YAxis". The intersection point
//! between the "Directrix1" and the "XAxis" is the "Location" point
//! of the "Directrix1".
//! This point is on the positive side of the "XAxis".
gp_Ax2d Directrix1() const;
//! This line is obtained by the symmetrical transformation
//! of "Directrix1" with respect to the "YAxis" of the hyperbola.
gp_Ax2d Directrix2() const;
//! Returns the excentricity of the hyperbola (e > 1).
//! If f is the distance between the location of the hyperbola
//! and the Focus1 then the eccentricity e = f / MajorRadius. Raises DomainError if MajorRadius = 0.0.
Standard_Real Eccentricity() const;
//! Computes the focal distance. It is the distance between the
//! "Location" of the hyperbola and "Focus1" or "Focus2".
Standard_Real Focal() const;
//! Returns the first focus of the hyperbola. This focus is on the
//! positive side of the "XAxis" of the hyperbola.
gp_Pnt2d Focus1() const;
//! Returns the second focus of the hyperbola. This focus is on the
//! negative side of the "XAxis" of the hyperbola.
gp_Pnt2d Focus2() const;
//! Returns the location point of the hyperbola.
//! It is the intersection point between the "XAxis" and
//! the "YAxis".
const gp_Pnt2d& Location() const;
//! Returns the major radius of the hyperbola (it is the radius
//! corresponding to the "XAxis" of the hyperbola).
Standard_Real MajorRadius() const;
//! Returns the minor radius of the hyperbola (it is the radius
//! corresponding to the "YAxis" of the hyperbola).
Standard_Real MinorRadius() const;
//! Returns the branch of hyperbola obtained by doing the
//! symmetrical transformation of <me> with respect to the
//! "YAxis" of <me>.
gp_Hypr2d OtherBranch() const;
//! Returns p = (e * e - 1) * MajorRadius where e is the
//! eccentricity of the hyperbola.
//! Raises DomainError if MajorRadius = 0.0
Standard_Real Parameter() const;
//! Returns the axisplacement of the hyperbola.
const gp_Ax22d& Axis() const;
//! Computes an axis whose
//! - the origin is the center of this hyperbola, and
//! - the unit vector is the "X Direction" or "Y Direction"
//! respectively of the local coordinate system of this hyperbola
//! Returns the major axis of the hyperbola.
Standard_EXPORT gp_Ax2d XAxis() const;
//! Computes an axis whose
//! - the origin is the center of this hyperbola, and
//! - the unit vector is the "X Direction" or "Y Direction"
//! respectively of the local coordinate system of this hyperbola
//! Returns the minor axis of the hyperbola.
gp_Ax2d YAxis() const;
void Reverse();
//! Reverses the orientation of the local coordinate system
//! of this hyperbola (the "Y Axis" is reversed). Therefore,
//! the implicit orientation of this hyperbola is reversed.
//! Note:
//! - Reverse assigns the result to this hyperbola, while
//! - Reversed creates a new one.
gp_Hypr2d Reversed() const;
//! Returns true if the local coordinate system is direct
//! and false in the other case.
Standard_Boolean IsDirect() const;
Standard_EXPORT void Mirror (const gp_Pnt2d& P);
//! Performs the symmetrical transformation of an hyperbola with
//! respect to the point P which is the center of the symmetry.
Standard_EXPORT gp_Hypr2d Mirrored (const gp_Pnt2d& P) const;
Standard_EXPORT void Mirror (const gp_Ax2d& A);
//! Performs the symmetrical transformation of an hyperbola with
//! respect to an axis placement which is the axis of the symmetry.
Standard_EXPORT gp_Hypr2d Mirrored (const gp_Ax2d& A) const;
void Rotate (const gp_Pnt2d& P, const Standard_Real Ang);
//! Rotates an hyperbola. P is the center of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Hypr2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
void Scale (const gp_Pnt2d& P, const Standard_Real S);
//! Scales an hyperbola. <S> is the scaling value.
//! If <S> is positive only the location point is
//! modified. But if <S> is negative the "XAxis" is
//! reversed and the "YAxis" too.
gp_Hypr2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
void Transform (const gp_Trsf2d& T);
//! Transforms an hyperbola with the transformation T from
//! class Trsf2d.
gp_Hypr2d Transformed (const gp_Trsf2d& T) const;
void Translate (const gp_Vec2d& V);
//! Translates an hyperbola in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Hypr2d Translated (const gp_Vec2d& V) const;
void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2);
//! Translates an hyperbola from the point P1 to the point P2.
gp_Hypr2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
protected:
private:
gp_Ax22d pos;
Standard_Real majorRadius;
Standard_Real minorRadius;
};
#include <gp_Hypr2d.lxx>
#endif // _gp_Hypr2d_HeaderFile

View File

@@ -1,251 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Lin from gp
---Purpose:
-- Describes a line in 3D space.
-- A line is positioned in space with an axis (a gp_Ax1
-- object) which gives it an origin and a unit vector.
-- A line and an axis are similar objects, thus, we can
-- convert one into the other. A line provides direct access
-- to the majority of the edit and query functions available
-- on its positioning axis. In addition, however, a line has
-- specific functions for computing distances and positions.
-- See Also
-- gce_MakeLin which provides functions for more complex
-- line constructions
-- Geom_Line which provides additional functions for
-- constructing lines and works, in particular, with the
-- parametric equations of lines
uses Ax1 from gp,
Ax2 from gp,
Dir from gp,
Trsf from gp,
Vec from gp,
Pnt from gp
raises ConstructionError from Standard
is
Create returns Lin;
---C++:inline
--- Purpose : Creates a Line corresponding to Z axis of the
-- reference coordinate system.
Create (A1 : Ax1) returns Lin;
---C++:inline
--- Purpose : Creates a line defined by axis A1.
Create (P : Pnt; V : Dir) returns Lin;
--- Purpose : Creates a line passing through point P and parallel to
-- vector V (P and V are, respectively, the origin and
-- the unit vector of the positioning axis of the line).
Reverse (me : in out)
---C++:inline
is static;
Reversed (me) returns Lin is static;
---C++:inline
--- Purpose : Reverses the direction of the line.
-- Note:
-- - Reverse assigns the result to this line, while
-- - Reversed creates a new one.
SetDirection (me : in out; V : Dir) is static;
---C++:inline
--- Purpose : Changes the direction of the line.
SetLocation (me : in out; P : Pnt) is static;
---C++:inline
--- Purpose : Changes the location point (origin) of the line.
SetPosition (me : in out; A1 : Ax1) is static;
---C++:inline
--- Purpose :
-- Complete redefinition of the line.
-- The "Location" point of <A1> is the origin of the line.
-- The "Direction" of <A1> is the direction of the line.
Direction (me) returns Dir is static;
---C++:inline
--- Purpose : Returns the direction of the line.
---C++: return const&
Location (me) returns Pnt is static;
---C++:inline
--- Purpose :
-- Returns the location point (origin) of the line.
---C++: return const&
Position (me) returns Ax1 is static;
--- Purpose :
-- Returns the axis placement one axis whith the same
-- location and direction as <me>.
---C++: inline
---C++: return const&
Angle (me; Other : Lin) returns Real is static;
---C++: inline
--- Purpose : Computes the angle between two lines in radians.
Contains (me; P : Pnt; LinearTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose : Returns true if this line contains the point P, that is, if the
-- distance between point P and this line is less than or
-- equal to LinearTolerance..
Distance (me; P : Pnt) returns Real is static;
---C++: inline
--- Purpose : Computes the distance between <me> and the point P.
Distance (me; Other : Lin) returns Real is static;
--- Purpose : Computes the distance between two lines.
SquareDistance (me; P : Pnt) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the square distance between <me> and the point P.
SquareDistance (me; Other : Lin) returns Real is static;
---C++: inline
--- Purpose : Computes the square distance between two lines.
Normal (me; P : Pnt) returns Lin
---C++: inline
--- Purpose :
-- Computes the line normal to the direction of <me>, passing
-- through the point P. Raises ConstructionError
-- if the distance between <me> and the point P is lower
-- or equal to Resolution from gp because there is an infinity of
-- solutions in 3D space.
raises ConstructionError
is static;
Mirror (me : in out; P : Pnt)
is static;
Mirrored (me; P : Pnt) returns Lin
is static;
--- Purpose :
-- Performs the symmetrical transformation of a line
-- with respect to the point P which is the center of
-- the symmetry.
Mirror (me : in out; A1 : Ax1)
is static;
Mirrored (me; A1 : Ax1) returns Lin is static;
--- Purpose :
-- Performs the symmetrical transformation of a line
-- with respect to an axis placement which is the axis
-- of the symmetry.
Mirror (me : in out; A2 : Ax2)
is static;
Mirrored (me; A2 : Ax2) returns Lin is static;
--- Purpose :
-- Performs the symmetrical transformation of a line
-- with respect to a plane. The axis placement <A2>
-- locates the plane of the symmetry :
-- (Location, XDirection, YDirection).
Rotate(me : in out; A1 : Ax1; Ang : Real)
---C++: inline
is static;
Rotated (me; A1 : Ax1; Ang : Real) returns Lin is static;
---C++: inline
--- Purpose :
-- Rotates a line. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt; S : Real)
---C++: inline
is static;
Scaled (me; P : Pnt; S : Real) returns Lin is static;
---C++: inline
--- Purpose :
-- Scales a line. S is the scaling value.
-- The "Location" point (origin) of the line is modified.
-- The "Direction" is reversed if the scale is negative.
Transform (me : in out; T : Trsf)
---C++: inline
is static;
Transformed (me; T : Trsf) returns Lin is static;
---C++: inline
--- Purpose :
-- Transforms a line with the transformation T from class Trsf.
Translate (me : in out; V : Vec)
---C++: inline
is static;
Translated (me; V : Vec) returns Lin is static;
---C++: inline
--- Purpose :
-- Translates a line in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt) is static;
---C++: inline
Translated (me; P1, P2 : Pnt) returns Lin is static;
---C++: inline
--- Purpose :
-- Translates a line from the point P1 to the point P2.
fields
pos : Ax1;
end;

View File

@@ -16,7 +16,14 @@
// JCV 1/10/90 Changement de nom du package vgeom -> gp
// JCV 12/12/90 modifs suite a la premiere revue de projet
#include <gp_Lin.ixx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Dir.hxx>
#include <gp_Lin.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
Standard_Real gp_Lin::Distance (const gp_Lin& Other) const
{

213
src/gp/gp_Lin.hxx Normal file
View File

@@ -0,0 +1,213 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Lin_HeaderFile
#define _gp_Lin_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax1.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
class Standard_ConstructionError;
class gp_Ax1;
class gp_Pnt;
class gp_Dir;
class gp_Ax2;
class gp_Trsf;
class gp_Vec;
//! Describes a line in 3D space.
//! A line is positioned in space with an axis (a gp_Ax1
//! object) which gives it an origin and a unit vector.
//! A line and an axis are similar objects, thus, we can
//! convert one into the other. A line provides direct access
//! to the majority of the edit and query functions available
//! on its positioning axis. In addition, however, a line has
//! specific functions for computing distances and positions.
//! See Also
//! gce_MakeLin which provides functions for more complex
//! line constructions
//! Geom_Line which provides additional functions for
//! constructing lines and works, in particular, with the
//! parametric equations of lines
class gp_Lin
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a Line corresponding to Z axis of the
//! reference coordinate system.
gp_Lin();
//! Creates a line defined by axis A1.
gp_Lin(const gp_Ax1& A1);
//! Creates a line passing through point P and parallel to
//! vector V (P and V are, respectively, the origin and
//! the unit vector of the positioning axis of the line).
Standard_EXPORT gp_Lin(const gp_Pnt& P, const gp_Dir& V);
void Reverse();
//! Reverses the direction of the line.
//! Note:
//! - Reverse assigns the result to this line, while
//! - Reversed creates a new one.
gp_Lin Reversed() const;
//! Changes the direction of the line.
void SetDirection (const gp_Dir& V);
//! Changes the location point (origin) of the line.
void SetLocation (const gp_Pnt& P);
//! Complete redefinition of the line.
//! The "Location" point of <A1> is the origin of the line.
//! The "Direction" of <A1> is the direction of the line.
void SetPosition (const gp_Ax1& A1);
//! Returns the direction of the line.
const gp_Dir& Direction() const;
//! Returns the location point (origin) of the line.
const gp_Pnt& Location() const;
//! Returns the axis placement one axis whith the same
//! location and direction as <me>.
const gp_Ax1& Position() const;
//! Computes the angle between two lines in radians.
Standard_Real Angle (const gp_Lin& Other) const;
//! Returns true if this line contains the point P, that is, if the
//! distance between point P and this line is less than or
//! equal to LinearTolerance..
Standard_Boolean Contains (const gp_Pnt& P, const Standard_Real LinearTolerance) const;
//! Computes the distance between <me> and the point P.
Standard_Real Distance (const gp_Pnt& P) const;
//! Computes the distance between two lines.
Standard_EXPORT Standard_Real Distance (const gp_Lin& Other) const;
//! Computes the square distance between <me> and the point P.
Standard_Real SquareDistance (const gp_Pnt& P) const;
//! Computes the square distance between two lines.
Standard_Real SquareDistance (const gp_Lin& Other) const;
//! Computes the line normal to the direction of <me>, passing
//! through the point P. Raises ConstructionError
//! if the distance between <me> and the point P is lower
//! or equal to Resolution from gp because there is an infinity of
//! solutions in 3D space.
gp_Lin Normal (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of a line
//! with respect to the point P which is the center of
//! the symmetry.
Standard_EXPORT gp_Lin Mirrored (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of a line
//! with respect to an axis placement which is the axis
//! of the symmetry.
Standard_EXPORT gp_Lin Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of a line
//! with respect to a plane. The axis placement <A2>
//! locates the plane of the symmetry :
//! (Location, XDirection, YDirection).
Standard_EXPORT gp_Lin Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates a line. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Lin Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Scales a line. S is the scaling value.
//! The "Location" point (origin) of the line is modified.
//! The "Direction" is reversed if the scale is negative.
gp_Lin Scaled (const gp_Pnt& P, const Standard_Real S) const;
void Transform (const gp_Trsf& T);
//! Transforms a line with the transformation T from class Trsf.
gp_Lin Transformed (const gp_Trsf& T) const;
void Translate (const gp_Vec& V);
//! Translates a line in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Lin Translated (const gp_Vec& V) const;
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates a line from the point P1 to the point P2.
gp_Lin Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Ax1 pos;
};
#include <gp_Lin.lxx>
#endif // _gp_Lin_HeaderFile

View File

@@ -1,253 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Lin2d from gp
---Purpose: Describes a line in 2D space.
-- A line is positioned in the plane with an axis (a gp_Ax2d
-- object) which gives the line its origin and unit vector. A
-- line and an axis are similar objects, thus, we can convert
-- one into the other.
-- A line provides direct access to the majority of the edit
-- and query functions available on its positioning axis. In
-- addition, however, a line has specific functions for
-- computing distances and positions.
-- See Also
-- GccAna and Geom2dGcc packages which provide
-- functions for constructing lines defined by geometric
-- constraints
-- gce_MakeLin2d which provides functions for more
-- complex line constructions
-- Geom2d_Line which provides additional functions for
-- constructing lines and works, in particular, with the
-- parametric equations of lines
uses Ax2d from gp,
Dir2d from gp,
Pnt2d from gp,
Trsf2d from gp,
Vec2d from gp
raises ConstructionError from Standard
is
Create returns Lin2d;
---C++:inline
--- Purpose : Creates a Line corresponding to X axis of the
-- reference coordinate system.
Create (A : Ax2d) returns Lin2d;
---C++:inline
--- Purpose : Creates a line located with A.
Create (P : Pnt2d; V : Dir2d) returns Lin2d;
---C++:inline
--- Purpose :
-- <P> is the location point (origin) of the line and
-- <V> is the direction of the line.
Create (A, B, C : Real) returns Lin2d
--- Purpose :
-- Creates the line from the equation A*X + B*Y + C = 0.0 Raises ConstructionError if Sqrt(A*A + B*B) <= Resolution from gp.
raises ConstructionError;
--- Purpose : Raised if Sqrt(A*A + B*B) <= Resolution from gp.
Reverse (me : in out)
---C++:inline
is static;
Reversed (me) returns Lin2d is static;
---C++:inline
---Purpose:
-- Reverses the positioning axis of this line.
-- Note:
-- - Reverse assigns the result to this line, while
-- - Reversed creates a new one.
SetDirection (me : in out; V : Dir2d)
---C++:inline
is static;
--- Purpose : Changes the direction of the line.
SetLocation(me : in out; P : Pnt2d)
---C++:inline
is static;
--- Purpose : Changes the origin of the line.
SetPosition (me : in out; A : Ax2d) is static;
---C++:inline
--- Purpose :
-- Complete redefinition of the line.
-- The "Location" point of <A> is the origin of the line.
-- The "Direction" of <A> is the direction of the line.
Coefficients (me; A, B, C : out Real) is static;
---C++:inline
--- Purpose :
-- Returns the normalized coefficients of the line :
-- A * X + B * Y + C = 0.
Direction (me) returns Dir2d is static;
---C++:inline
--- Purpose : Returns the direction of the line.
---C++: return const&
Location (me) returns Pnt2d is static;
---C++:inline
--- Purpose : Returns the location point (origin) of the line.
---C++: return const&
Position (me) returns Ax2d is static;
--- Purpose :
-- Returns the axis placement one axis whith the same
-- location and direction as <me>.
---C++: inline
---C++: return const&
Angle (me; Other : Lin2d) returns Real is static;
---C++: inline
--- Purpose : Computes the angle between two lines in radians.
Contains (me; P : Pnt2d; LinearTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose : Returns true if this line contains the point P, that is, if the
-- distance between point P and this line is less than or
-- equal to LinearTolerance.
Distance (me; P : Pnt2d) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the distance between <me> and the point <P>.
Distance (me; Other : Lin2d) returns Real is static;
---C++: inline
--- Purpose : Computes the distance between two lines.
SquareDistance (me; P : Pnt2d) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the square distance between <me> and the point
-- <P>.
SquareDistance (me; Other : Lin2d) returns Real is static;
---C++: inline
--- Purpose : Computes the square distance between two lines.
Normal (me; P : Pnt2d) returns Lin2d is static;
---C++: inline
--- Purpose :
-- Computes the line normal to the direction of <me>,
-- passing through the point <P>.
Mirror (me : in out; P : Pnt2d)
is static;
Mirrored (me; P : Pnt2d) returns Lin2d is static;
--- Purpose :
-- Performs the symmetrical transformation of a line
-- with respect to the point <P> which is the center
-- of the symmetry
Mirror (me : in out; A : Ax2d)
is static;
Mirrored (me; A : Ax2d) returns Lin2d is static;
--- Purpose :
-- Performs the symmetrical transformation of a line
-- with respect to an axis placement which is the axis
-- of the symmetry.
Rotate(me : in out; P : Pnt2d; Ang : Real)
---C++:inline
is static;
Rotated (me; P : Pnt2d; Ang : Real) returns Lin2d is static;
---C++:inline
--- Purpose :
-- Rotates a line. P is the center of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt2d; S : Real)
is static;
Scaled (me; P : Pnt2d; S : Real) returns Lin2d is static;
---C++:inline
--- Purpose :
-- Scales a line. S is the scaling value. Only the
-- origin of the line is modified.
Transform (me : in out; T : Trsf2d)
---C++:inline
is static;
Transformed (me; T : Trsf2d) returns Lin2d is static;
---C++:inline
--- Purpose :
-- Transforms a line with the transformation T from class Trsf2d.
Translate (me : in out; V : Vec2d)
---C++:inline
is static;
Translated (me; V : Vec2d) returns Lin2d is static;
---C++:inline
--- Purpose :
-- Translates a line in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt2d) is static;
---C++:inline
Translated (me; P1, P2 : Pnt2d) returns Lin2d is static;
---C++:inline
--- Purpose :
-- Translates a line from the point P1 to the point P2.
fields
pos : Ax2d;
end;

View File

@@ -17,14 +17,20 @@
#define No_Standard_OutOfRange
#include <gp_Lin2d.ixx>
#include <gp.hxx>
#include <gp_Ax2d.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <Standard_ConstructionError.hxx>
//=======================================================================
//function : gp_Lin2d
//purpose :
//=======================================================================
gp_Lin2d::gp_Lin2d (const Standard_Real A,
const Standard_Real B,
const Standard_Real C)

214
src/gp/gp_Lin2d.hxx Normal file
View File

@@ -0,0 +1,214 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Lin2d_HeaderFile
#define _gp_Lin2d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax2d.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
class Standard_ConstructionError;
class gp_Ax2d;
class gp_Pnt2d;
class gp_Dir2d;
class gp_Trsf2d;
class gp_Vec2d;
//! Describes a line in 2D space.
//! A line is positioned in the plane with an axis (a gp_Ax2d
//! object) which gives the line its origin and unit vector. A
//! line and an axis are similar objects, thus, we can convert
//! one into the other.
//! A line provides direct access to the majority of the edit
//! and query functions available on its positioning axis. In
//! addition, however, a line has specific functions for
//! computing distances and positions.
//! See Also
//! GccAna and Geom2dGcc packages which provide
//! functions for constructing lines defined by geometric
//! constraints
//! gce_MakeLin2d which provides functions for more
//! complex line constructions
//! Geom2d_Line which provides additional functions for
//! constructing lines and works, in particular, with the
//! parametric equations of lines
class gp_Lin2d
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a Line corresponding to X axis of the
//! reference coordinate system.
gp_Lin2d();
//! Creates a line located with A.
gp_Lin2d(const gp_Ax2d& A);
//! <P> is the location point (origin) of the line and
//! <V> is the direction of the line.
gp_Lin2d(const gp_Pnt2d& P, const gp_Dir2d& V);
//! Creates the line from the equation A*X + B*Y + C = 0.0 Raises ConstructionError if Sqrt(A*A + B*B) <= Resolution from gp.
//! Raised if Sqrt(A*A + B*B) <= Resolution from gp.
Standard_EXPORT gp_Lin2d(const Standard_Real A, const Standard_Real B, const Standard_Real C);
void Reverse();
//! Reverses the positioning axis of this line.
//! Note:
//! - Reverse assigns the result to this line, while
//! - Reversed creates a new one.
gp_Lin2d Reversed() const;
//! Changes the direction of the line.
void SetDirection (const gp_Dir2d& V);
//! Changes the origin of the line.
void SetLocation (const gp_Pnt2d& P);
//! Complete redefinition of the line.
//! The "Location" point of <A> is the origin of the line.
//! The "Direction" of <A> is the direction of the line.
void SetPosition (const gp_Ax2d& A);
//! Returns the normalized coefficients of the line :
//! A * X + B * Y + C = 0.
void Coefficients (Standard_Real& A, Standard_Real& B, Standard_Real& C) const;
//! Returns the direction of the line.
const gp_Dir2d& Direction() const;
//! Returns the location point (origin) of the line.
const gp_Pnt2d& Location() const;
//! Returns the axis placement one axis whith the same
//! location and direction as <me>.
const gp_Ax2d& Position() const;
//! Computes the angle between two lines in radians.
Standard_Real Angle (const gp_Lin2d& Other) const;
//! Returns true if this line contains the point P, that is, if the
//! distance between point P and this line is less than or
//! equal to LinearTolerance.
Standard_Boolean Contains (const gp_Pnt2d& P, const Standard_Real LinearTolerance) const;
//! Computes the distance between <me> and the point <P>.
Standard_Real Distance (const gp_Pnt2d& P) const;
//! Computes the distance between two lines.
Standard_Real Distance (const gp_Lin2d& Other) const;
//! Computes the square distance between <me> and the point
//! <P>.
Standard_Real SquareDistance (const gp_Pnt2d& P) const;
//! Computes the square distance between two lines.
Standard_Real SquareDistance (const gp_Lin2d& Other) const;
//! Computes the line normal to the direction of <me>,
//! passing through the point <P>.
gp_Lin2d Normal (const gp_Pnt2d& P) const;
Standard_EXPORT void Mirror (const gp_Pnt2d& P);
//! Performs the symmetrical transformation of a line
//! with respect to the point <P> which is the center
//! of the symmetry
Standard_EXPORT gp_Lin2d Mirrored (const gp_Pnt2d& P) const;
Standard_EXPORT void Mirror (const gp_Ax2d& A);
//! Performs the symmetrical transformation of a line
//! with respect to an axis placement which is the axis
//! of the symmetry.
Standard_EXPORT gp_Lin2d Mirrored (const gp_Ax2d& A) const;
void Rotate (const gp_Pnt2d& P, const Standard_Real Ang);
//! Rotates a line. P is the center of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Lin2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
Standard_EXPORT void Scale (const gp_Pnt2d& P, const Standard_Real S);
//! Scales a line. S is the scaling value. Only the
//! origin of the line is modified.
gp_Lin2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
void Transform (const gp_Trsf2d& T);
//! Transforms a line with the transformation T from class Trsf2d.
gp_Lin2d Transformed (const gp_Trsf2d& T) const;
void Translate (const gp_Vec2d& V);
//! Translates a line in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Lin2d Translated (const gp_Vec2d& V) const;
void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2);
//! Translates a line from the point P1 to the point P2.
gp_Lin2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
protected:
private:
gp_Ax2d pos;
};
#include <gp_Lin2d.lxx>
#endif // _gp_Lin2d_HeaderFile

View File

@@ -1,300 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Mat from gp
---Purpose:
-- Describes a three column, three row matrix. This sort of
-- object is used in various vectorial or matrix computations.
uses XYZ from gp,
Address from Standard
raises ConstructionError from Standard,
OutOfRange from Standard
is
Create returns Mat;
--- Purpose : creates a matrix with null coefficients.
---C++: inline
Create(a11,a12,a13,a21,a22,a23,a31,a32,a33: Real from Standard);
---C++: inline
Create (Col1, Col2, Col3 : XYZ) returns Mat;
--- Purpose : Creates a matrix.
-- Col1, Col2, Col3 are the 3 columns of the matrix.
SetCol (me : in out; Col : Integer; Value : XYZ)
--- Purpose : Assigns the three coordinates of Value to the column of index
-- Col of this matrix.
-- Raises OutOfRange if Col < 1 or Col > 3.
raises OutOfRange
is static;
SetCols (me : in out; Col1, Col2, Col3 : XYZ) is static;
--- Purpose : Assigns the number triples Col1, Col2, Col3 to the three
-- columns of this matrix.
SetCross (me : in out; Ref : XYZ) is static;
--- Purpose :
-- Modifies the matrix M so that applying it to any number
-- triple (X, Y, Z) produces the same result as the cross
-- product of Ref and the number triple (X, Y, Z):
-- i.e.: M * {X,Y,Z}t = Ref.Cross({X, Y ,Z})
-- this matrix is anti symmetric. To apply this matrix to the
-- triplet {XYZ} is the same as to do the cross product between the
-- triplet Ref and the triplet {XYZ}.
-- Note: this matrix is anti-symmetric.
SetDiagonal (me : in out; X1, X2, X3 : Real) is static;
---C++: inline
--- Purpose :
-- Modifies the main diagonal of the matrix.
-- <me>.Value (1, 1) = X1
-- <me>.Value (2, 2) = X2
-- <me>.Value (3, 3) = X3
-- The other coefficients of the matrix are not modified.
SetDot (me : in out; Ref : XYZ) is static;
--- Purpose :
-- Modifies this matrix so that applying it to any number
-- triple (X, Y, Z) produces the same result as the scalar
-- product of Ref and the number triple (X, Y, Z):
-- this * (X,Y,Z) = Ref.(X,Y,Z)
-- Note: this matrix is symmetric.
SetIdentity (me : in out) is static;
---C++: inline
--- Purpose : Modifies this matrix so that it represents the Identity matrix.
SetRotation (me : in out; Axis : XYZ; Ang : Real)
--- Purpose :
-- Modifies this matrix so that it represents a rotation. Ang is the angular value in
-- radians and the XYZ axis gives the direction of the
-- rotation.
-- Raises ConstructionError if XYZ.Modulus() <= Resolution()
raises ConstructionError
is static;
SetRow (me : in out; Row : Integer; Value : XYZ)
--- Purpose : Assigns the three coordinates of Value to the row of index
-- Row of this matrix. Raises OutOfRange if Row < 1 or Row > 3.
raises OutOfRange
is static;
SetRows (me : in out; Row1, Row2, Row3 : XYZ) is static;
--- Purpose : Assigns the number triples Row1, Row2, Row3 to the three
-- rows of this matrix.
SetScale (me : in out; S : Real) is static;
---C++: inline
--- Purpose :
-- Modifies the the matrix so that it represents
-- a scaling transformation, where S is the scale factor. :
-- | S 0.0 0.0 |
-- <me> = | 0.0 S 0.0 |
-- | 0.0 0.0 S |
SetValue (me : in out; Row, Col : Integer; Value : Real)
---C++: inline
--- Purpose : Assigns <Value> to the coefficient of row Row, column Col of this matrix.
-- Raises OutOfRange if Row < 1 or Row > 3 or Col < 1 or Col > 3
raises OutOfRange
is static;
Column (me; Col : Integer) returns XYZ
--- Purpose : Returns the column of Col index.
-- Raises OutOfRange if Col < 1 or Col > 3
raises OutOfRange
is static;
Determinant (me) returns Real is static;
---C++: inline
--- Purpose : Computes the determinant of the matrix.
Diagonal (me) returns XYZ is static;
--- Purpose : Returns the main diagonal of the matrix.
Row (me; Row : Integer) returns XYZ
--- Purpose : returns the row of Row index.
-- Raises OutOfRange if Row < 1 or Row > 3
raises OutOfRange
is static;
Value (me; Row, Col : Integer) returns Real
---C++: inline
---C++: return const &
---C++: alias operator()
--- Purpose : Returns the coefficient of range (Row, Col)
-- Raises OutOfRange if Row < 1 or Row > 3 or Col < 1 or Col > 3
raises OutOfRange
--
is static;
ChangeValue (me : in out; Row, Col : Integer) returns Real
---C++: inline
---C++: return &
---C++: alias operator()
--- Purpose : Returns the coefficient of range (Row, Col)
-- Raises OutOfRange if Row < 1 or Row > 3 or Col < 1 or Col > 3
raises OutOfRange
--
is static;
IsSingular (me) returns Boolean is static;
---C++: inline
--- Purpose :
-- The Gauss LU decomposition is used to invert the matrix
-- (see Math package) so the matrix is considered as singular if
-- the largest pivot found is lower or equal to Resolution from gp.
Add (me : in out; Other : Mat) is static;
---C++: inline
---C++: alias operator +=
Added (me; Other : Mat) returns Mat is static;
---C++: inline
---C++: alias operator +
--- Purpose : Computes the sum of this matrix and
-- the matrix Other for each coefficient of the matrix :
-- <me>.Coef(i,j) + <Other>.Coef(i,j)
Divide (me : in out; Scalar : Real) is static;
---C++: inline
---C++: alias operator /=
Divided (me; Scalar : Real) returns Mat is static;
---C++: inline
---C++: alias operator /
--- Purpose : Divides all the coefficients of the matrix by Scalar
Invert (me : in out) raises ConstructionError is static;
Inverted (me) returns Mat raises ConstructionError is static;
--- Purpose :
-- Inverses the matrix and raises if the matrix is singular.
-- - Invert assigns the result to this matrix, while
-- - Inverted creates a new one.
-- Warning
-- The Gauss LU decomposition is used to invert the matrix.
-- Consequently, the matrix is considered as singular if the
-- largest pivot found is less than or equal to gp::Resolution().
-- Exceptions
-- Standard_ConstructionError if this matrix is singular,
-- and therefore cannot be inverted.
Multiplied (me; Other : Mat) returns Mat is static;
---C++: inline
---C++: alias operator *
--- Purpose :
-- Computes the product of two matrices <me> * <Other>
Multiply (me : in out; Other : Mat) is static;
---C++: inline
---C++: alias operator *=
---Purpose: Computes the product of two matrices <me> = <Other> * <me>.
PreMultiply (me : in out; Other : Mat) is static;
---C++: inline
--Purpose :
-- Modifies this matrix by premultiplying it by the matrix
-- Other:
-- this = Other * this
-- Computes the product of two matrices <me> = <Other> * <me>.
Multiplied (me; Scalar : Real) returns Mat is static;
---C++: inline
---C++: alias operator *
Multiply (me : in out; Scalar : Real) is static;
---C++: inline
---C++: alias operator *=
--- Purpose :
-- Multiplies all the coefficients of the matrix by Scalar
Power (me : in out; N : Integer) raises ConstructionError is static;
Powered (me; N : Integer) returns Mat raises ConstructionError is static;
---C++: inline
--- Purpose :
-- Computes <me> = <me> * <me> * .......* <me>, N time.
-- if N = 0 <me> = Identity
-- if N < 0 <me> = <me>.Invert() *...........* <me>.Invert().
-- If N < 0 an exception will be raised if the matrix is not
-- inversible
Subtract (me : in out; Other : Mat) is static;
---C++: inline
---C++: alias operator -=
Subtracted (me; Other : Mat) returns Mat is static;
---C++: inline
---C++: alias operator -
--- Purpose :
-- cOmputes for each coefficient of the matrix :
-- <me>.Coef(i,j) - <Other>.Coef(i,j)
Transpose (me : in out) is static;
---C++: inline
Transposed (me) returns Mat
---C++: inline
--- Purpose :
-- Transposes the matrix. A(j, i) -> A (i, j)
is static;
fields
matrix : Real[3, 3];
friends
class XYZ from gp,
class Trsf from gp,
class GTrsf from gp
end;

View File

@@ -19,7 +19,13 @@
#define No_Standard_ConstructionError
#endif
#include <gp_Mat.ixx>
#include <gp_GTrsf.hxx>
#include <gp_Mat.hxx>
#include <gp_Trsf.hxx>
#include <gp_XYZ.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
#define M00 ((Standard_Real*)M)[0]
#define M01 ((Standard_Real*)M)[1]

286
src/gp/gp_Mat.hxx Normal file
View File

@@ -0,0 +1,286 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Mat_HeaderFile
#define _gp_Mat_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class gp_XYZ;
class gp_Trsf;
class gp_GTrsf;
//! Describes a three column, three row matrix. This sort of
//! object is used in various vectorial or matrix computations.
class gp_Mat
{
public:
DEFINE_STANDARD_ALLOC
//! creates a matrix with null coefficients.
gp_Mat();
gp_Mat(const Standard_Real a11, const Standard_Real a12, const Standard_Real a13, const Standard_Real a21, const Standard_Real a22, const Standard_Real a23, const Standard_Real a31, const Standard_Real a32, const Standard_Real a33);
//! Creates a matrix.
//! Col1, Col2, Col3 are the 3 columns of the matrix.
Standard_EXPORT gp_Mat(const gp_XYZ& Col1, const gp_XYZ& Col2, const gp_XYZ& Col3);
//! Assigns the three coordinates of Value to the column of index
//! Col of this matrix.
//! Raises OutOfRange if Col < 1 or Col > 3.
Standard_EXPORT void SetCol (const Standard_Integer Col, const gp_XYZ& Value);
//! Assigns the number triples Col1, Col2, Col3 to the three
//! columns of this matrix.
Standard_EXPORT void SetCols (const gp_XYZ& Col1, const gp_XYZ& Col2, const gp_XYZ& Col3);
//! Modifies the matrix M so that applying it to any number
//! triple (X, Y, Z) produces the same result as the cross
//! product of Ref and the number triple (X, Y, Z):
//! i.e.: M * {X,Y,Z}t = Ref.Cross({X, Y ,Z})
//! this matrix is anti symmetric. To apply this matrix to the
//! triplet {XYZ} is the same as to do the cross product between the
//! triplet Ref and the triplet {XYZ}.
//! Note: this matrix is anti-symmetric.
Standard_EXPORT void SetCross (const gp_XYZ& Ref);
//! Modifies the main diagonal of the matrix.
//! <me>.Value (1, 1) = X1
//! <me>.Value (2, 2) = X2
//! <me>.Value (3, 3) = X3
//! The other coefficients of the matrix are not modified.
void SetDiagonal (const Standard_Real X1, const Standard_Real X2, const Standard_Real X3);
//! Modifies this matrix so that applying it to any number
//! triple (X, Y, Z) produces the same result as the scalar
//! product of Ref and the number triple (X, Y, Z):
//! this * (X,Y,Z) = Ref.(X,Y,Z)
//! Note: this matrix is symmetric.
Standard_EXPORT void SetDot (const gp_XYZ& Ref);
//! Modifies this matrix so that it represents the Identity matrix.
void SetIdentity();
//! Modifies this matrix so that it represents a rotation. Ang is the angular value in
//! radians and the XYZ axis gives the direction of the
//! rotation.
//! Raises ConstructionError if XYZ.Modulus() <= Resolution()
Standard_EXPORT void SetRotation (const gp_XYZ& Axis, const Standard_Real Ang);
//! Assigns the three coordinates of Value to the row of index
//! Row of this matrix. Raises OutOfRange if Row < 1 or Row > 3.
Standard_EXPORT void SetRow (const Standard_Integer Row, const gp_XYZ& Value);
//! Assigns the number triples Row1, Row2, Row3 to the three
//! rows of this matrix.
Standard_EXPORT void SetRows (const gp_XYZ& Row1, const gp_XYZ& Row2, const gp_XYZ& Row3);
//! Modifies the the matrix so that it represents
//! a scaling transformation, where S is the scale factor. :
//! | S 0.0 0.0 |
//! <me> = | 0.0 S 0.0 |
//! | 0.0 0.0 S |
void SetScale (const Standard_Real S);
//! Assigns <Value> to the coefficient of row Row, column Col of this matrix.
//! Raises OutOfRange if Row < 1 or Row > 3 or Col < 1 or Col > 3
void SetValue (const Standard_Integer Row, const Standard_Integer Col, const Standard_Real Value);
//! Returns the column of Col index.
//! Raises OutOfRange if Col < 1 or Col > 3
Standard_EXPORT gp_XYZ Column (const Standard_Integer Col) const;
//! Computes the determinant of the matrix.
Standard_Real Determinant() const;
//! Returns the main diagonal of the matrix.
Standard_EXPORT gp_XYZ Diagonal() const;
//! returns the row of Row index.
//! Raises OutOfRange if Row < 1 or Row > 3
Standard_EXPORT gp_XYZ Row (const Standard_Integer Row) const;
//! Returns the coefficient of range (Row, Col)
//! Raises OutOfRange if Row < 1 or Row > 3 or Col < 1 or Col > 3
const Standard_Real& Value (const Standard_Integer Row, const Standard_Integer Col) const;
const Standard_Real& operator() (const Standard_Integer Row, const Standard_Integer Col) const
{
return Value(Row,Col);
}
//! Returns the coefficient of range (Row, Col)
//! Raises OutOfRange if Row < 1 or Row > 3 or Col < 1 or Col > 3
Standard_Real& ChangeValue (const Standard_Integer Row, const Standard_Integer Col);
Standard_Real& operator() (const Standard_Integer Row, const Standard_Integer Col)
{
return ChangeValue(Row,Col);
}
//! The Gauss LU decomposition is used to invert the matrix
//! (see Math package) so the matrix is considered as singular if
//! the largest pivot found is lower or equal to Resolution from gp.
Standard_Boolean IsSingular() const;
void Add (const gp_Mat& Other);
void operator += (const gp_Mat& Other)
{
Add(Other);
}
//! Computes the sum of this matrix and
//! the matrix Other for each coefficient of the matrix :
//! <me>.Coef(i,j) + <Other>.Coef(i,j)
gp_Mat Added (const gp_Mat& Other) const;
gp_Mat operator + (const gp_Mat& Other) const
{
return Added(Other);
}
void Divide (const Standard_Real Scalar);
void operator /= (const Standard_Real Scalar)
{
Divide(Scalar);
}
//! Divides all the coefficients of the matrix by Scalar
gp_Mat Divided (const Standard_Real Scalar) const;
gp_Mat operator / (const Standard_Real Scalar) const
{
return Divided(Scalar);
}
Standard_EXPORT void Invert();
//! Inverses the matrix and raises if the matrix is singular.
//! - Invert assigns the result to this matrix, while
//! - Inverted creates a new one.
//! Warning
//! The Gauss LU decomposition is used to invert the matrix.
//! Consequently, the matrix is considered as singular if the
//! largest pivot found is less than or equal to gp::Resolution().
//! Exceptions
//! Standard_ConstructionError if this matrix is singular,
//! and therefore cannot be inverted.
Standard_EXPORT gp_Mat Inverted() const;
//! Computes the product of two matrices <me> * <Other>
gp_Mat Multiplied (const gp_Mat& Other) const;
gp_Mat operator * (const gp_Mat& Other) const
{
return Multiplied(Other);
}
//! Computes the product of two matrices <me> = <Other> * <me>.
void Multiply (const gp_Mat& Other);
void operator *= (const gp_Mat& Other)
{
Multiply(Other);
}
void PreMultiply (const gp_Mat& Other);
gp_Mat Multiplied (const Standard_Real Scalar) const;
gp_Mat operator * (const Standard_Real Scalar) const
{
return Multiplied(Scalar);
}
//! Multiplies all the coefficients of the matrix by Scalar
void Multiply (const Standard_Real Scalar);
void operator *= (const Standard_Real Scalar)
{
Multiply(Scalar);
}
Standard_EXPORT void Power (const Standard_Integer N);
//! Computes <me> = <me> * <me> * .......* <me>, N time.
//! if N = 0 <me> = Identity
//! if N < 0 <me> = <me>.Invert() *...........* <me>.Invert().
//! If N < 0 an exception will be raised if the matrix is not
//! inversible
gp_Mat Powered (const Standard_Integer N) const;
void Subtract (const gp_Mat& Other);
void operator -= (const gp_Mat& Other)
{
Subtract(Other);
}
//! cOmputes for each coefficient of the matrix :
//! <me>.Coef(i,j) - <Other>.Coef(i,j)
gp_Mat Subtracted (const gp_Mat& Other) const;
gp_Mat operator - (const gp_Mat& Other) const
{
return Subtracted(Other);
}
void Transpose();
//! Transposes the matrix. A(j, i) -> A (i, j)
gp_Mat Transposed() const;
friend class gp_XYZ;
friend class gp_Trsf;
friend class gp_GTrsf;
protected:
private:
Standard_Real matrix[3][3];
};
#include <gp_Mat.lxx>
#endif // _gp_Mat_HeaderFile

View File

@@ -1,270 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Mat2d from gp
---Purpose:
-- Describes a two column, two row matrix. This sort of
-- object is used in various vectorial or matrix computations.
uses XY from gp,
XYZ from gp
raises ConstructionError from Standard,
OutOfRange from Standard
is
Create returns Mat2d;
---C++: inline
--- Purpose : Creates a matrix with null coefficients.
Create (Col1, Col2 : XY) returns Mat2d;
--- Purpose :
-- Col1, Col2 are the 2 columns of the matrix.
SetCol (me : in out; Col : Integer; Value : XY)
--- Purpose : Assigns the two coordinates of Value to the column of range
-- Col of this matrix
-- Raises OutOfRange if Col < 1 or Col > 2.
raises OutOfRange
is static;
SetCols (me : in out; Col1, Col2 : XY)
--- Purpose : Assigns the number pairs Col1, Col2 to the two columns of this matrix
is static;
SetDiagonal (me : in out; X1, X2 : Real) is static;
---C++: inline
--- Purpose :
-- Modifies the main diagonal of the matrix.
-- <me>.Value (1, 1) = X1
-- <me>.Value (2, 2) = X2
-- The other coefficients of the matrix are not modified.
SetIdentity (me : in out) is static;
---C++: inline
--- Purpose : Modifies this matrix, so that it represents the Identity matrix.
SetRotation (me : in out; Ang : Real) is static;
--- Purpose :
-- Modifies this matrix, so that it representso a rotation. Ang is the angular
-- value in radian of the rotation.
---C++: inline
SetRow (me : in out; Row : Integer; Value : XY)
--- Purpose : Assigns the two coordinates of Value to the row of index Row of this matrix.
-- Raises OutOfRange if Row < 1 or Row > 2.
raises OutOfRange
is static;
SetRows (me : in out; Row1, Row2 : XY) is static;
--- Purpose : Assigns the number pairs Row1, Row2 to the two rows of this matrix.
SetScale (me : in out; S : Real) is static;
---C++: inline
--- Purpose :
-- Modifies the matrix such that it
-- represents a scaling transformation, where S is the scale factor :
-- | S 0.0 |
-- <me> = | 0.0 S |
SetValue (me : in out; Row, Col : Integer; Value : Real)
--- Purpose : Assigns <Value> to the coefficient of row Row, column Col of this matrix.
-- Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 2
---C++: inline
raises OutOfRange
is static;
Column (me; Col : Integer) returns XY
--- Purpose : Returns the column of Col index.
-- Raises OutOfRange if Col < 1 or Col > 2
raises OutOfRange
is static;
Determinant (me) returns Real is static;
---C++: inline
--- Purpose : Computes the determinant of the matrix.
Diagonal (me) returns XY is static;
--- Purpose : Returns the main diagonal of the matrix.
Row (me; Row : Integer) returns XY
--- Purpose : Returns the row of index Row.
raises OutOfRange
--- Purpose : Raised if Row < 1 or Row > 2
is static;
Value (me; Row, Col : Integer) returns Real
--- Purpose : Returns the coefficient of range (Row, Col)
-- Raises OutOfRange
-- if Row < 1 or Row > 2 or Col < 1 or Col > 2
---C++: inline
---C++: return const &
---C++: alias operator()
raises OutOfRange
is static;
ChangeValue (me : in out; Row, Col : Integer) returns Real
--- Purpose : Returns the coefficient of range (Row, Col)
-- Raises OutOfRange
-- if Row < 1 or Row > 2 or Col < 1 or Col > 2
---C++: inline
---C++: return &
---C++: alias operator()
raises OutOfRange
is static;
IsSingular (me) returns Boolean is static;
--- Purpose :
-- Returns true if this matrix is singular (and therefore, cannot be inverted).
-- The Gauss LU decomposition is used to invert the matrix
-- so the matrix is considered as singular if the largest
-- pivot found is lower or equal to Resolution from gp.
---C++: inline
Add (me : in out; Other : Mat2d) is static;
---C++: inline
---C++: alias operator +=
Added (me; Other : Mat2d) returns Mat2d is static;
---C++: inline
---C++: alias operator +
--- Purpose :
-- Computes the sum of this matrix and the matrix
-- Other.for each coefficient of the matrix :
-- <me>.Coef(i,j) + <Other>.Coef(i,j)
-- Note:
-- - operator += assigns the result to this matrix, while
-- - operator + creates a new one.
Divide (me : in out; Scalar : Real) is static;
---C++: inline
---C++: alias operator /=
Divided (me; Scalar : Real) returns Mat2d is static;
---C++: inline
---C++: alias operator /
--- Purpose :
-- Divides all the coefficients of the matrix by a scalar.
Invert (me : in out) raises ConstructionError is static;
Inverted (me) returns Mat2d raises ConstructionError is static;
--- Purpose :
-- Inverses the matrix and raises exception if the matrix
-- is singular.
---C++: inline
Multiplied (me; Other : Mat2d) returns Mat2d is static;
---C++: inline
---C++: alias operator *
Multiply (me : in out; Other : Mat2d) is static;
--- Purpose :
-- Computes the product of two matrices <me> * <Other>
---C++: inline
-- C++: alias operator *=
PreMultiply(me : in out; Other : Mat2d) is static;
--- Purpose : Modifies this matrix by premultiplying it by the matrix Other
-- <me> = Other * <me>.
---C++: inline
Multiplied (me; Scalar : Real) returns Mat2d is static;
---C++: inline
---C++: alias operator *
Multiply (me : in out; Scalar : Real) is static;
--- Purpose :
-- Multiplies all the coefficients of the matrix by a scalar.
---C++: inline
---C++: alias operator *=
Power (me : in out; N : Integer) raises ConstructionError is static;
Powered (me; N : Integer) returns Mat2d raises ConstructionError is static;
--- Purpose :
-- computes <me> = <me> * <me> * .......* <me>, N time.
-- if N = 0 <me> = Identity
-- if N < 0 <me> = <me>.Invert() *...........* <me>.Invert().
-- If N < 0 an exception can be raised if the matrix is not
-- inversible
---C++: inline
Subtract (me : in out; Other : Mat2d) is static;
---C++: inline
---C++: alias operator -=
Subtracted (me; Other : Mat2d) returns Mat2d is static;
---C++: inline
---C++: alias operator -
--- Purpose :
-- Computes for each coefficient of the matrix :
-- <me>.Coef(i,j) - <Other>.Coef(i,j)
Transpose (me : in out) is static;
---C++: inline
Transposed (me) returns Mat2d is static;
--- Purpose :
-- Transposes the matrix. A(j, i) -> A (i, j)
---C++: inline
fields
matrix : Real[2, 2];
friends
class Trsf2d from gp,
class GTrsf2d from gp,
class XY from gp
end;

View File

@@ -19,8 +19,13 @@
#define No_Standard_ConstructionError
#endif
#include <gp_Mat2d.ixx>
#include <gp_GTrsf2d.hxx>
#include <gp_Mat2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_XY.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
#define M00 ((Standard_Real*)M)[0]
#define M01 ((Standard_Real*)M)[1]

256
src/gp/gp_Mat2d.hxx Normal file
View File

@@ -0,0 +1,256 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Mat2d_HeaderFile
#define _gp_Mat2d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class gp_Trsf2d;
class gp_GTrsf2d;
class gp_XY;
//! Describes a two column, two row matrix. This sort of
//! object is used in various vectorial or matrix computations.
class gp_Mat2d
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a matrix with null coefficients.
gp_Mat2d();
//! Col1, Col2 are the 2 columns of the matrix.
Standard_EXPORT gp_Mat2d(const gp_XY& Col1, const gp_XY& Col2);
//! Assigns the two coordinates of Value to the column of range
//! Col of this matrix
//! Raises OutOfRange if Col < 1 or Col > 2.
Standard_EXPORT void SetCol (const Standard_Integer Col, const gp_XY& Value);
//! Assigns the number pairs Col1, Col2 to the two columns of this matrix
Standard_EXPORT void SetCols (const gp_XY& Col1, const gp_XY& Col2);
//! Modifies the main diagonal of the matrix.
//! <me>.Value (1, 1) = X1
//! <me>.Value (2, 2) = X2
//! The other coefficients of the matrix are not modified.
void SetDiagonal (const Standard_Real X1, const Standard_Real X2);
//! Modifies this matrix, so that it represents the Identity matrix.
void SetIdentity();
//! Modifies this matrix, so that it representso a rotation. Ang is the angular
//! value in radian of the rotation.
void SetRotation (const Standard_Real Ang);
//! Assigns the two coordinates of Value to the row of index Row of this matrix.
//! Raises OutOfRange if Row < 1 or Row > 2.
Standard_EXPORT void SetRow (const Standard_Integer Row, const gp_XY& Value);
//! Assigns the number pairs Row1, Row2 to the two rows of this matrix.
Standard_EXPORT void SetRows (const gp_XY& Row1, const gp_XY& Row2);
//! Modifies the matrix such that it
//! represents a scaling transformation, where S is the scale factor :
//! | S 0.0 |
//! <me> = | 0.0 S |
void SetScale (const Standard_Real S);
//! Assigns <Value> to the coefficient of row Row, column Col of this matrix.
//! Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 2
void SetValue (const Standard_Integer Row, const Standard_Integer Col, const Standard_Real Value);
//! Returns the column of Col index.
//! Raises OutOfRange if Col < 1 or Col > 2
Standard_EXPORT gp_XY Column (const Standard_Integer Col) const;
//! Computes the determinant of the matrix.
Standard_Real Determinant() const;
//! Returns the main diagonal of the matrix.
Standard_EXPORT gp_XY Diagonal() const;
//! Returns the row of index Row.
//! Raised if Row < 1 or Row > 2
Standard_EXPORT gp_XY Row (const Standard_Integer Row) const;
//! Returns the coefficient of range (Row, Col)
//! Raises OutOfRange
//! if Row < 1 or Row > 2 or Col < 1 or Col > 2
const Standard_Real& Value (const Standard_Integer Row, const Standard_Integer Col) const;
const Standard_Real& operator() (const Standard_Integer Row, const Standard_Integer Col) const
{
return Value(Row,Col);
}
//! Returns the coefficient of range (Row, Col)
//! Raises OutOfRange
//! if Row < 1 or Row > 2 or Col < 1 or Col > 2
Standard_Real& ChangeValue (const Standard_Integer Row, const Standard_Integer Col);
Standard_Real& operator() (const Standard_Integer Row, const Standard_Integer Col)
{
return ChangeValue(Row,Col);
}
//! Returns true if this matrix is singular (and therefore, cannot be inverted).
//! The Gauss LU decomposition is used to invert the matrix
//! so the matrix is considered as singular if the largest
//! pivot found is lower or equal to Resolution from gp.
Standard_Boolean IsSingular() const;
void Add (const gp_Mat2d& Other);
void operator += (const gp_Mat2d& Other)
{
Add(Other);
}
//! Computes the sum of this matrix and the matrix
//! Other.for each coefficient of the matrix :
//! <me>.Coef(i,j) + <Other>.Coef(i,j)
//! Note:
//! - operator += assigns the result to this matrix, while
//! - operator + creates a new one.
gp_Mat2d Added (const gp_Mat2d& Other) const;
gp_Mat2d operator + (const gp_Mat2d& Other) const
{
return Added(Other);
}
void Divide (const Standard_Real Scalar);
void operator /= (const Standard_Real Scalar)
{
Divide(Scalar);
}
//! Divides all the coefficients of the matrix by a scalar.
gp_Mat2d Divided (const Standard_Real Scalar) const;
gp_Mat2d operator / (const Standard_Real Scalar) const
{
return Divided(Scalar);
}
Standard_EXPORT void Invert();
//! Inverses the matrix and raises exception if the matrix
//! is singular.
gp_Mat2d Inverted() const;
gp_Mat2d Multiplied (const gp_Mat2d& Other) const;
gp_Mat2d operator * (const gp_Mat2d& Other) const
{
return Multiplied(Other);
}
//! Computes the product of two matrices <me> * <Other>
void Multiply (const gp_Mat2d& Other);
//! Modifies this matrix by premultiplying it by the matrix Other
//! <me> = Other * <me>.
void PreMultiply (const gp_Mat2d& Other);
gp_Mat2d Multiplied (const Standard_Real Scalar) const;
gp_Mat2d operator * (const Standard_Real Scalar) const
{
return Multiplied(Scalar);
}
//! Multiplies all the coefficients of the matrix by a scalar.
void Multiply (const Standard_Real Scalar);
void operator *= (const Standard_Real Scalar)
{
Multiply(Scalar);
}
Standard_EXPORT void Power (const Standard_Integer N);
//! computes <me> = <me> * <me> * .......* <me>, N time.
//! if N = 0 <me> = Identity
//! if N < 0 <me> = <me>.Invert() *...........* <me>.Invert().
//! If N < 0 an exception can be raised if the matrix is not
//! inversible
gp_Mat2d Powered (const Standard_Integer N) const;
void Subtract (const gp_Mat2d& Other);
void operator -= (const gp_Mat2d& Other)
{
Subtract(Other);
}
//! Computes for each coefficient of the matrix :
//! <me>.Coef(i,j) - <Other>.Coef(i,j)
gp_Mat2d Subtracted (const gp_Mat2d& Other) const;
gp_Mat2d operator - (const gp_Mat2d& Other) const
{
return Subtracted(Other);
}
void Transpose();
//! Transposes the matrix. A(j, i) -> A (i, j)
gp_Mat2d Transposed() const;
friend class gp_Trsf2d;
friend class gp_GTrsf2d;
friend class gp_XY;
protected:
private:
Standard_Real matrix[2][2];
};
#include <gp_Mat2d.lxx>
#endif // _gp_Mat2d_HeaderFile

View File

@@ -1,279 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Parab from gp
---Purpose:
-- Describes a parabola in 3D space.
-- A parabola is defined by its focal length (that is, the
-- distance between its focus and apex) and positioned in
-- space with a coordinate system (a gp_Ax2 object)
-- where:
-- - the origin of the coordinate system is on the apex of
-- the parabola,
-- - the "X Axis" of the coordinate system is the axis of
-- symmetry; the parabola is on the positive side of this axis, and
-- - the origin, "X Direction" and "Y Direction" of the
-- coordinate system define the plane of the parabola.
-- The equation of the parabola in this coordinate system,
-- which is the "local coordinate system" of the parabola, is:
-- Y**2 = (2*P) * X.
-- where P, referred to as the parameter of the parabola, is
-- the distance between the focus and the directrix (P is
-- twice the focal length).
-- The "main Direction" of the local coordinate system gives
-- the normal vector to the plane of the parabola.
-- See Also
-- gce_MakeParab which provides functions for more
-- complex parabola constructions
-- Geom_Parabola which provides additional functions for
-- constructing parabolas and works, in particular, with the
-- parametric equations of parabolas
uses Ax1, Ax2, Pnt, Trsf, Vec
raises ConstructionError from Standard
is
Create returns Parab;
---C++: inline
--- Purpose : Creates an indefinite Parabola.
Create (A2 : Ax2; Focal : Real) returns Parab
---C++: inline
--- Purpose :
-- Creates a parabola with its local coordinate system "A2"
-- and it's focal length "Focal".
-- The XDirection of A2 defines the axis of symmetry of the
-- parabola. The YDirection of A2 is parallel to the directrix
-- of the parabola. The Location point of A2 is the vertex of
-- the parabola
-- Raises ConstructionError if Focal < 0.0
raises ConstructionError;
--- Purpose : Raised if Focal < 0.0
Create (D : Ax1; F : Pnt) returns Parab;
---C++: inline
--- Purpose :
-- D is the directrix of the parabola and F the focus point.
-- The symmetry axis (XAxis) of the parabola is normal to the
-- directrix and pass through the focus point F, but its
-- location point is the vertex of the parabola.
-- The YAxis of the parabola is parallel to D and its location
-- point is the vertex of the parabola. The normal to the plane
-- of the parabola is the cross product between the XAxis and the
-- YAxis.
SetAxis (me : in out; A1 : Ax1)
---C++: inline
--- Purpose : Modifies this parabola by redefining its local coordinate system so that
-- - its origin and "main Direction" become those of the
-- axis A1 (the "X Direction" and "Y Direction" are then
-- recomputed in the same way as for any gp_Ax2)
-- Raises ConstructionError if the direction of A1 is parallel to the previous
-- XAxis of the parabola.
raises ConstructionError
is static;
SetFocal (me : in out; Focal : Real)
---C++: inline
--- Purpose : Changes the focal distance of the parabola.
-- Raises ConstructionError if Focal < 0.0
raises ConstructionError
is static;
SetLocation (me : in out; P : Pnt) is static;
---C++: inline
--- Purpose :
-- Changes the location of the parabola. It is the vertex of
-- the parabola.
SetPosition (me : in out; A2 : Ax2) is static;
--- Purpose : Changes the local coordinate system of the parabola.
Axis (me) returns Ax1 is static;
---C++: inline
--- Purpose :
-- Returns the main axis of the parabola.
-- It is the axis normal to the plane of the parabola passing
-- through the vertex of the parabola.
---C++: return const&
Directrix (me) returns Ax1 is static;
---C++: inline
--- Purpose : Computes the directrix of this parabola.
-- The directrix is:
-- - a line parallel to the "Y Direction" of the local
-- coordinate system of this parabola, and
-- - located on the negative side of the axis of symmetry,
-- at a distance from the apex which is equal to the focal
-- length of this parabola.
-- The directrix is returned as an axis (a gp_Ax1 object),
-- the origin of which is situated on the "X Axis" of this parabola.
Focal (me) returns Real is static;
---C++: inline
--- Purpose :
-- Returns the distance between the vertex and the focus
-- of the parabola.
Focus (me) returns Pnt is static;
---C++: inline
---Purpose: - Computes the focus of the parabola.
Location (me) returns Pnt is static;
---C++: inline
--- Purpose :
-- Returns the vertex of the parabola. It is the "Location"
-- point of the coordinate system of the parabola.
---C++: return const&
Parameter (me) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the parameter of the parabola.
-- It is the distance between the focus and the directrix of
-- the parabola. This distance is twice the focal length.
Position (me) returns Ax2 is static;
--- Purpose :
-- Returns the local coordinate system of the parabola.
---C++: inline
---C++: return const&
XAxis (me) returns Ax1 is static;
---C++: inline
--- Purpose :
-- Returns the symmetry axis of the parabola. The location point
-- of the axis is the vertex of the parabola.
YAxis (me) returns Ax1 is static;
---C++: inline
--- Purpose :
-- It is an axis parallel to the directrix of the parabola.
-- The location point of this axis is the vertex of the parabola.
Mirror (me : in out; P : Pnt) is static;
Mirrored (me; P : Pnt) returns Parab is static;
--- Purpose :
-- Performs the symmetrical transformation of a parabola
-- with respect to the point P which is the center of the
-- symmetry.
Mirror (me : in out; A1 : Ax1) is static;
Mirrored (me; A1 : Ax1) returns Parab is static;
--- Purpose :
-- Performs the symmetrical transformation of a parabola
-- with respect to an axis placement which is the axis of
-- the symmetry.
Mirror (me : in out; A2 : Ax2) is static;
Mirrored (me; A2 : Ax2) returns Parab is static;
--- Purpose :
-- Performs the symmetrical transformation of a parabola
-- with respect to a plane. The axis placement A2 locates
-- the plane of the symmetry (Location, XDirection, YDirection).
Rotate (me : in out; A1 : Ax1; Ang : Real) is static;
---C++: inline
Rotated (me; A1 : Ax1; Ang : Real) returns Parab is static;
---C++: inline
--- Purpose :
-- Rotates a parabola. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt; S : Real) is static;
---C++: inline
Scaled (me; P : Pnt; S : Real) returns Parab is static;
---C++: inline
--- Purpose :
-- Scales a parabola. S is the scaling value.
-- If S is negative the direction of the symmetry axis
-- XAxis is reversed and the direction of the YAxis too.
Transform (me : in out; T : Trsf) is static;
---C++: inline
Transformed (me; T : Trsf) returns Parab is static;
---C++: inline
--- Purpose :
-- Transforms a parabola with the transformation T from class Trsf.
Translate (me : in out; V : Vec) is static;
---C++: inline
Translated (me; V : Vec) returns Parab is static;
---C++: inline
--- Purpose :
-- Translates a parabola in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt) is static;
---C++: inline
Translated (me; P1, P2 : Pnt) returns Parab is static;
---C++: inline
--- Purpose :
-- Translates a parabola from the point P1 to the point P2.
fields
pos : Ax2;
focalLength : Real;
end;

View File

@@ -14,7 +14,13 @@
// Modif jcv 14/12/90 suite a la premiere revue de projet
#include <gp_Parab.ixx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Parab.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
void gp_Parab::Mirror (const gp_Pnt& P)
{ pos.Mirror (P); }

246
src/gp/gp_Parab.hxx Normal file
View File

@@ -0,0 +1,246 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Parab_HeaderFile
#define _gp_Parab_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax2.hxx>
#include <Standard_Real.hxx>
#include <gp_Ax1.hxx>
#include <gp_Pnt.hxx>
class Standard_ConstructionError;
class gp_Ax2;
class gp_Ax1;
class gp_Pnt;
class gp_Trsf;
class gp_Vec;
//! Describes a parabola in 3D space.
//! A parabola is defined by its focal length (that is, the
//! distance between its focus and apex) and positioned in
//! space with a coordinate system (a gp_Ax2 object)
//! where:
//! - the origin of the coordinate system is on the apex of
//! the parabola,
//! - the "X Axis" of the coordinate system is the axis of
//! symmetry; the parabola is on the positive side of this axis, and
//! - the origin, "X Direction" and "Y Direction" of the
//! coordinate system define the plane of the parabola.
//! The equation of the parabola in this coordinate system,
//! which is the "local coordinate system" of the parabola, is:
//! Y**2 = (2*P) * X.
//! where P, referred to as the parameter of the parabola, is
//! the distance between the focus and the directrix (P is
//! twice the focal length).
//! The "main Direction" of the local coordinate system gives
//! the normal vector to the plane of the parabola.
//! See Also
//! gce_MakeParab which provides functions for more
//! complex parabola constructions
//! Geom_Parabola which provides additional functions for
//! constructing parabolas and works, in particular, with the
//! parametric equations of parabolas
class gp_Parab
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an indefinite Parabola.
gp_Parab();
//! Creates a parabola with its local coordinate system "A2"
//! and it's focal length "Focal".
//! The XDirection of A2 defines the axis of symmetry of the
//! parabola. The YDirection of A2 is parallel to the directrix
//! of the parabola. The Location point of A2 is the vertex of
//! the parabola
//! Raises ConstructionError if Focal < 0.0
//! Raised if Focal < 0.0
gp_Parab(const gp_Ax2& A2, const Standard_Real Focal);
//! D is the directrix of the parabola and F the focus point.
//! The symmetry axis (XAxis) of the parabola is normal to the
//! directrix and pass through the focus point F, but its
//! location point is the vertex of the parabola.
//! The YAxis of the parabola is parallel to D and its location
//! point is the vertex of the parabola. The normal to the plane
//! of the parabola is the cross product between the XAxis and the
//! YAxis.
gp_Parab(const gp_Ax1& D, const gp_Pnt& F);
//! Modifies this parabola by redefining its local coordinate system so that
//! - its origin and "main Direction" become those of the
//! axis A1 (the "X Direction" and "Y Direction" are then
//! recomputed in the same way as for any gp_Ax2)
//! Raises ConstructionError if the direction of A1 is parallel to the previous
//! XAxis of the parabola.
void SetAxis (const gp_Ax1& A1);
//! Changes the focal distance of the parabola.
//! Raises ConstructionError if Focal < 0.0
void SetFocal (const Standard_Real Focal);
//! Changes the location of the parabola. It is the vertex of
//! the parabola.
void SetLocation (const gp_Pnt& P);
//! Changes the local coordinate system of the parabola.
Standard_EXPORT void SetPosition (const gp_Ax2& A2);
//! Returns the main axis of the parabola.
//! It is the axis normal to the plane of the parabola passing
//! through the vertex of the parabola.
const gp_Ax1& Axis() const;
//! Computes the directrix of this parabola.
//! The directrix is:
//! - a line parallel to the "Y Direction" of the local
//! coordinate system of this parabola, and
//! - located on the negative side of the axis of symmetry,
//! at a distance from the apex which is equal to the focal
//! length of this parabola.
//! The directrix is returned as an axis (a gp_Ax1 object),
//! the origin of which is situated on the "X Axis" of this parabola.
gp_Ax1 Directrix() const;
//! Returns the distance between the vertex and the focus
//! of the parabola.
Standard_Real Focal() const;
//! - Computes the focus of the parabola.
gp_Pnt Focus() const;
//! Returns the vertex of the parabola. It is the "Location"
//! point of the coordinate system of the parabola.
const gp_Pnt& Location() const;
//! Computes the parameter of the parabola.
//! It is the distance between the focus and the directrix of
//! the parabola. This distance is twice the focal length.
Standard_Real Parameter() const;
//! Returns the local coordinate system of the parabola.
const gp_Ax2& Position() const;
//! Returns the symmetry axis of the parabola. The location point
//! of the axis is the vertex of the parabola.
gp_Ax1 XAxis() const;
//! It is an axis parallel to the directrix of the parabola.
//! The location point of this axis is the vertex of the parabola.
gp_Ax1 YAxis() const;
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of a parabola
//! with respect to the point P which is the center of the
//! symmetry.
Standard_EXPORT gp_Parab Mirrored (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of a parabola
//! with respect to an axis placement which is the axis of
//! the symmetry.
Standard_EXPORT gp_Parab Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of a parabola
//! with respect to a plane. The axis placement A2 locates
//! the plane of the symmetry (Location, XDirection, YDirection).
Standard_EXPORT gp_Parab Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates a parabola. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Parab Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Scales a parabola. S is the scaling value.
//! If S is negative the direction of the symmetry axis
//! XAxis is reversed and the direction of the YAxis too.
gp_Parab Scaled (const gp_Pnt& P, const Standard_Real S) const;
void Transform (const gp_Trsf& T);
//! Transforms a parabola with the transformation T from class Trsf.
gp_Parab Transformed (const gp_Trsf& T) const;
void Translate (const gp_Vec& V);
//! Translates a parabola in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Parab Translated (const gp_Vec& V) const;
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates a parabola from the point P1 to the point P2.
gp_Parab Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Ax2 pos;
Standard_Real focalLength;
};
#include <gp_Parab.lxx>
#endif // _gp_Parab_HeaderFile

View File

@@ -1,289 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Parab2d from gp
---Purpose: Describes a parabola in the plane (2D space).
-- A parabola is defined by its focal length (that is, the
-- distance between its focus and apex) and positioned in
-- the plane with a coordinate system (a gp_Ax22d object) where:
-- - the origin of the coordinate system is on the apex of
-- the parabola, and
-- - the "X Axis" of the coordinate system is the axis of
-- symmetry; the parabola is on the positive side of this axis.
-- This coordinate system is the "local coordinate system"
-- of the parabola. Its orientation (direct or indirect sense)
-- gives an implicit orientation to the parabola.
-- In this coordinate system, the equation for the parabola is:
-- Y**2 = (2*P) * X.
-- where P, referred to as the parameter of the parabola, is
-- the distance between the focus and the directrix (P is
-- twice the focal length).
-- See Also
-- GCE2d_MakeParab2d which provides functions for
-- more complex parabola constructions
-- Geom2d_Parabola which provides additional functions
-- for constructing parabolas and works, in particular, with
-- the parametric equations of parabolas
uses Ax2d from gp,
Ax22d from gp,
Pnt2d from gp,
Trsf2d from gp,
Vec2d from gp
raises ConstructionError from Standard
is
Create returns Parab2d;
---C++: inline
--- Purpose : Creates an indefinite parabola.
Create (MirrorAxis : Ax2d;
Focal : Real;
Sense : Boolean from Standard = Standard_True) returns Parab2d
---C++: inline
--- Purpose :
-- Creates a parabola with its vertex point, its axis of symmetry
-- ("XAxis") and its focal length.
-- The sense of parametrization is given by Sense.
-- Warnings : It is possible to have Focal = 0.
-- Raises ConstructionError if Focal < 0.0
raises ConstructionError;
Create (A : Ax22d;
Focal : Real) returns Parab2d
---C++: inline
--- Purpose :
-- Creates a parabola with its vertex point, its axis of symmetry
-- ("XAxis") and its focal length.
-- The sense of parametrization is given by A.
-- Warnings : It is possible to have Focal = 0.
-- Raises ConstructionError if Focal < 0.0
raises ConstructionError;
Create (D : Ax2d;
F : Pnt2d;
Sense : Boolean from Standard = Standard_True) returns Parab2d;
--- Purpose :
-- Creates a parabola with the directrix and the focus point.
-- The sense of parametrization is given by Sense.
Create (D : Ax22d; F : Pnt2d) returns Parab2d;
--- Purpose :
-- Creates a parabola with the directrix and the focus point.
-- The Sense of parametrization is given by D.
SetFocal (me : in out; Focal : Real)
---C++: inline
--- Purpose :
-- Changes the focal distance of the parabola
-- Warnings : It is possible to have Focal = 0.
-- Raises ConstructionError if Focal < 0.0
raises ConstructionError
is static;
SetLocation (me : in out; P : Pnt2d) is static;
---C++: inline
--- Purpose :
-- Changes the "Location" point of the parabola. It is the
-- vertex of the parabola.
SetMirrorAxis (me : in out; A : Ax2d) is static;
---C++: inline
--- Purpose : Modifies this parabola, by redefining its local coordinate system so that
-- its origin and "X Direction" become those of the axis
-- MA. The "Y Direction" of the local coordinate system is
-- then recomputed. The orientation of the local
-- coordinate system is not modified.
SetAxis (me : in out; A : Ax22d) is static;
---C++: inline
--- Purpose :
-- Changes the local coordinate system of the parabola.
-- The "Location" point of A becomes the vertex of the parabola.
Coefficients (me; A, B, C, D, E, F : out Real) is static;
--- Purpose :
-- Computes the coefficients of the implicit equation of the parabola.
-- A * (X**2) + B * (Y**2) + 2*C*(X*Y) + 2*D*X + 2*E*Y + F = 0.
Directrix (me) returns Ax2d is static;
---C++: inline
--- Purpose :
-- Computes the directrix of the parabola.
-- The directrix is:
-- - a line parallel to the "Y Direction" of the local
-- coordinate system of this parabola, and
-- - located on the negative side of the axis of symmetry,
-- at a distance from the apex which is equal to the focal length of this parabola.
-- The directrix is returned as an axis (a gp_Ax2d object),
-- the origin of which is situated on the "X Axis" of this parabola.
Focal (me) returns Real is static;
---C++: inline
--- Purpose :
-- Returns the distance between the vertex and the focus
-- of the parabola.
Focus (me) returns Pnt2d is static;
---C++: inline
--- Purpose : Returns the focus of the parabola.
Location (me) returns Pnt2d is static;
---C++: inline
--- Purpose : Returns the vertex of the parabola.
MirrorAxis (me) returns Ax2d is static;
---C++: inline
--- Purpose :
-- Returns the symmetry axis of the parabola.
-- The "Location" point of this axis is the vertex of the parabola.
Axis (me) returns Ax22d is static;
---C++: inline
--- Purpose :
-- Returns the local coordinate system of the parabola.
-- The "Location" point of this axis is the vertex of the parabola.
Parameter (me) returns Real is static;
---C++: inline
--- Purpose :
-- Returns the distance between the focus and the
-- directrix of the parabola.
Reverse (me : in out) is static;
---C++: inline
Reversed (me) returns Parab2d is static;
---C++: inline
---Purpose:
-- Reverses the orientation of the local coordinate system
-- of this parabola (the "Y Direction" is reversed).
-- Therefore, the implicit orientation of this parabola is reversed.
-- Note:
-- - Reverse assigns the result to this parabola, while
-- - Reversed creates a new one.
IsDirect (me) returns Boolean is static;
---C++: inline
--- Purpose : Returns true if the local coordinate system is direct
-- and false in the other case.
Mirror (me : in out; P : Pnt2d) is static;
Mirrored (me; P : Pnt2d) returns Parab2d is static;
--- Purpose :
-- Performs the symmetrical transformation of a parabola with respect
-- to the point P which is the center of the symmetry
Mirror (me : in out; A : Ax2d) is static;
Mirrored (me; A : Ax2d) returns Parab2d is static;
--- Purpose :
-- Performs the symmetrical transformation of a parabola with respect
-- to an axis placement which is the axis of the symmetry.
Rotate (me : in out; P : Pnt2d; Ang : Real) is static;
---C++: inline
Rotated (me; P : Pnt2d; Ang : Real) returns Parab2d is static;
---C++: inline
--- Purpose :
-- Rotates a parabola. P is the center of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt2d; S : Real) is static;
---C++: inline
Scaled (me; P : Pnt2d; S : Real) returns Parab2d is static;
---C++: inline
--- Purpose :
-- Scales a parabola. S is the scaling value.
-- If S is negative the direction of the symmetry axis
-- "XAxis" is reversed and the direction of the "YAxis" too.
Transform (me : in out; T : Trsf2d) is static;
---C++: inline
Transformed (me; T : Trsf2d) returns Parab2d is static;
---C++: inline
--- Purpose :
-- Transforms an parabola with the transformation T from class Trsf2d.
Translate (me : in out; V : Vec2d) is static;
---C++: inline
Translated (me; V : Vec2d) returns Parab2d is static;
---C++: inline
--- Purpose :
-- Translates a parabola in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt2d ) is static;
---C++: inline
Translated (me; P1, P2 : Pnt2d) returns Parab2d is static;
---C++: inline
--- Purpose :
-- Translates a parabola from the point P1 to the point P2.
fields
pos : Ax22d;
focalLength : Real;
end;

View File

@@ -14,7 +14,14 @@
#define No_Standard_OutOfRange
#include <gp_Parab2d.ixx>
#include <gp_Ax2d.hxx>
#include <gp_Ax22d.hxx>
#include <gp_Parab2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <Standard_ConstructionError.hxx>
gp_Parab2d::gp_Parab2d (const gp_Ax22d& D,
const gp_Pnt2d& F)

247
src/gp/gp_Parab2d.hxx Normal file
View File

@@ -0,0 +1,247 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Parab2d_HeaderFile
#define _gp_Parab2d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax22d.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <gp_Ax2d.hxx>
#include <gp_Pnt2d.hxx>
class Standard_ConstructionError;
class gp_Ax2d;
class gp_Ax22d;
class gp_Pnt2d;
class gp_Trsf2d;
class gp_Vec2d;
//! Describes a parabola in the plane (2D space).
//! A parabola is defined by its focal length (that is, the
//! distance between its focus and apex) and positioned in
//! the plane with a coordinate system (a gp_Ax22d object) where:
//! - the origin of the coordinate system is on the apex of
//! the parabola, and
//! - the "X Axis" of the coordinate system is the axis of
//! symmetry; the parabola is on the positive side of this axis.
//! This coordinate system is the "local coordinate system"
//! of the parabola. Its orientation (direct or indirect sense)
//! gives an implicit orientation to the parabola.
//! In this coordinate system, the equation for the parabola is:
//! Y**2 = (2*P) * X.
//! where P, referred to as the parameter of the parabola, is
//! the distance between the focus and the directrix (P is
//! twice the focal length).
//! See Also
//! GCE2d_MakeParab2d which provides functions for
//! more complex parabola constructions
//! Geom2d_Parabola which provides additional functions
//! for constructing parabolas and works, in particular, with
//! the parametric equations of parabolas
class gp_Parab2d
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an indefinite parabola.
gp_Parab2d();
//! Creates a parabola with its vertex point, its axis of symmetry
//! ("XAxis") and its focal length.
//! The sense of parametrization is given by Sense.
//! Warnings : It is possible to have Focal = 0.
//! Raises ConstructionError if Focal < 0.0
gp_Parab2d(const gp_Ax2d& MirrorAxis, const Standard_Real Focal, const Standard_Boolean Sense = Standard_True);
//! Creates a parabola with its vertex point, its axis of symmetry
//! ("XAxis") and its focal length.
//! The sense of parametrization is given by A.
//! Warnings : It is possible to have Focal = 0.
//! Raises ConstructionError if Focal < 0.0
gp_Parab2d(const gp_Ax22d& A, const Standard_Real Focal);
//! Creates a parabola with the directrix and the focus point.
//! The sense of parametrization is given by Sense.
Standard_EXPORT gp_Parab2d(const gp_Ax2d& D, const gp_Pnt2d& F, const Standard_Boolean Sense = Standard_True);
//! Creates a parabola with the directrix and the focus point.
//! The Sense of parametrization is given by D.
Standard_EXPORT gp_Parab2d(const gp_Ax22d& D, const gp_Pnt2d& F);
//! Changes the focal distance of the parabola
//! Warnings : It is possible to have Focal = 0.
//! Raises ConstructionError if Focal < 0.0
void SetFocal (const Standard_Real Focal);
//! Changes the "Location" point of the parabola. It is the
//! vertex of the parabola.
void SetLocation (const gp_Pnt2d& P);
//! Modifies this parabola, by redefining its local coordinate system so that
//! its origin and "X Direction" become those of the axis
//! MA. The "Y Direction" of the local coordinate system is
//! then recomputed. The orientation of the local
//! coordinate system is not modified.
void SetMirrorAxis (const gp_Ax2d& A);
//! Changes the local coordinate system of the parabola.
//! The "Location" point of A becomes the vertex of the parabola.
void SetAxis (const gp_Ax22d& A);
//! Computes the coefficients of the implicit equation of the parabola.
//! A * (X**2) + B * (Y**2) + 2*C*(X*Y) + 2*D*X + 2*E*Y + F = 0.
Standard_EXPORT void Coefficients (Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& D, Standard_Real& E, Standard_Real& F) const;
//! Computes the directrix of the parabola.
//! The directrix is:
//! - a line parallel to the "Y Direction" of the local
//! coordinate system of this parabola, and
//! - located on the negative side of the axis of symmetry,
//! at a distance from the apex which is equal to the focal length of this parabola.
//! The directrix is returned as an axis (a gp_Ax2d object),
//! the origin of which is situated on the "X Axis" of this parabola.
gp_Ax2d Directrix() const;
//! Returns the distance between the vertex and the focus
//! of the parabola.
Standard_Real Focal() const;
//! Returns the focus of the parabola.
gp_Pnt2d Focus() const;
//! Returns the vertex of the parabola.
gp_Pnt2d Location() const;
//! Returns the symmetry axis of the parabola.
//! The "Location" point of this axis is the vertex of the parabola.
gp_Ax2d MirrorAxis() const;
//! Returns the local coordinate system of the parabola.
//! The "Location" point of this axis is the vertex of the parabola.
gp_Ax22d Axis() const;
//! Returns the distance between the focus and the
//! directrix of the parabola.
Standard_Real Parameter() const;
void Reverse();
//! Reverses the orientation of the local coordinate system
//! of this parabola (the "Y Direction" is reversed).
//! Therefore, the implicit orientation of this parabola is reversed.
//! Note:
//! - Reverse assigns the result to this parabola, while
//! - Reversed creates a new one.
gp_Parab2d Reversed() const;
//! Returns true if the local coordinate system is direct
//! and false in the other case.
Standard_Boolean IsDirect() const;
Standard_EXPORT void Mirror (const gp_Pnt2d& P);
//! Performs the symmetrical transformation of a parabola with respect
//! to the point P which is the center of the symmetry
Standard_EXPORT gp_Parab2d Mirrored (const gp_Pnt2d& P) const;
Standard_EXPORT void Mirror (const gp_Ax2d& A);
//! Performs the symmetrical transformation of a parabola with respect
//! to an axis placement which is the axis of the symmetry.
Standard_EXPORT gp_Parab2d Mirrored (const gp_Ax2d& A) const;
void Rotate (const gp_Pnt2d& P, const Standard_Real Ang);
//! Rotates a parabola. P is the center of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Parab2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
void Scale (const gp_Pnt2d& P, const Standard_Real S);
//! Scales a parabola. S is the scaling value.
//! If S is negative the direction of the symmetry axis
//! "XAxis" is reversed and the direction of the "YAxis" too.
gp_Parab2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
void Transform (const gp_Trsf2d& T);
//! Transforms an parabola with the transformation T from class Trsf2d.
gp_Parab2d Transformed (const gp_Trsf2d& T) const;
void Translate (const gp_Vec2d& V);
//! Translates a parabola in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Parab2d Translated (const gp_Vec2d& V) const;
void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2);
//! Translates a parabola from the point P1 to the point P2.
gp_Parab2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
protected:
private:
gp_Ax22d pos;
Standard_Real focalLength;
};
#include <gp_Parab2d.lxx>
#endif // _gp_Parab2d_HeaderFile

View File

@@ -1,313 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Pln from gp
--- Purpose :Describes a plane.
-- A plane is positioned in space with a coordinate system
-- (a gp_Ax3 object), such that the plane is defined by the
-- origin, "X Direction" and "Y Direction" of this coordinate
-- system, which is the "local coordinate system" of the
-- plane. The "main Direction" of the coordinate system is a
-- vector normal to the plane. It gives the plane an implicit
-- orientation such that the plane is said to be "direct", if the
-- coordinate system is right-handed, or "indirect" in the other case.
-- Note: when a gp_Pln plane is converted into a
-- Geom_Plane plane, some implicit properties of its local
-- coordinate system are used explicitly:
-- - its origin defines the origin of the two parameters of
-- the planar surface,
-- - its implicit orientation is also that of the Geom_Plane.
-- See Also
-- gce_MakePln which provides functions for more complex
-- plane constructions
-- Geom_Plane which provides additional functions for
-- constructing planes and works, in particular, with the
-- parametric equations of planes
uses Ax1 from gp,
Ax2 from gp,
Ax3 from gp,
Dir from gp,
Lin from gp,
Pnt from gp,
Trsf from gp,
Vec from gp
raises ConstructionError from Standard
is
Create returns Pln;
---C++:inline
--- Purpose : Creates a plane coincident with OXY plane of the
-- reference coordinate system.
Create (A3 : Ax3) returns Pln;
---C++:inline
--- Purpose :
-- The coordinate system of the plane is defined with the axis
-- placement A3.
-- The "Direction" of A3 defines the normal to the plane.
-- The "Location" of A3 defines the location (origin) of the plane.
-- The "XDirection" and "YDirection" of A3 define the "XAxis" and
-- the "YAxis" of the plane used to parametrize the plane.
Create (P : Pnt; V : Dir) returns Pln;
--- Purpose :
-- Creates a plane with the "Location" point <P>
-- and the normal direction <V>.
Create (A, B, C, D : Real) returns Pln
--- Purpose :
-- Creates a plane from its cartesian equation :
-- A * X + B * Y + C * Z + D = 0.0
-- Raises ConstructionError if Sqrt (A*A + B*B + C*C) <= Resolution from gp.
raises ConstructionError;
Coefficients (me; A, B ,C ,D : out Real) is static;
---C++:inline
--- Purpose :
-- Returns the coefficients of the plane's cartesian equation :
-- A * X + B * Y + C * Z + D = 0.
SetAxis (me : in out; A1 : Ax1)
---C++: inline
--- Purpose : Modifies this plane, by redefining its local coordinate system so that
-- - its origin and "main Direction" become those of the
-- axis A1 (the "X Direction" and "Y Direction" are then recomputed).
-- Raises ConstructionError if the A1 is parallel to the "XAxis" of the plane.
raises ConstructionError
is static;
SetLocation (me : in out; Loc : Pnt) is static;
---C++:inline
--- Purpose : Changes the origin of the plane.
SetPosition (me : in out; A3 : Ax3) is static;
---C++:inline
--- Purpose : Changes the local coordinate system of the plane.
UReverse (me : in out)
---C++:inline
---Purpose: Reverses the U parametrization of the plane
-- reversing the XAxis.
is static;
VReverse (me : in out)
---C++:inline
---Purpose: Reverses the V parametrization of the plane
-- reversing the YAxis.
is static;
Direct (me) returns Boolean from Standard
---C++:inline
---Purpose: returns true if the Ax3 is right handed.
is static;
Axis (me) returns Ax1 is static;
---C++:inline
--- Purpose : Returns the plane's normal Axis.
---C++: return const&
Location (me) returns Pnt is static;
--- Purpose : Returns the plane's location (origin).
---C++: inline
---C++: return const&
Position (me) returns Ax3 is static;
--- Purpose : Returns the local coordinate system of the plane .
---C++: inline
---C++: return const&
Distance (me; P : Pnt) returns Real is static;
---C++: inline
--- Purpose : Computes the distance between <me> and the point <P>.
Distance (me; L : Lin) returns Real is static;
---C++: inline
--- Purpose : Computes the distance between <me> and the line <L>.
Distance (me; Other : Pln) returns Real is static;
---C++: inline
--- Purpose : Computes the distance between two planes.
SquareDistance (me; P : Pnt) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the square distance between <me> and the point <P>.
SquareDistance (me; L : Lin) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the square distance between <me> and the line <L>.
SquareDistance (me; Other : Pln) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the square distance between two planes.
XAxis (me) returns Ax1 is static;
---C++:inline
--- Purpose : Returns the X axis of the plane.
YAxis (me) returns Ax1 is static;
---C++:inline
--- Purpose : Returns the Y axis of the plane.
Contains (me; P : Pnt; LinearTolerance : Real) returns Boolean
is static;
---C++: inline
---Purpose: Returns true if this plane contains the point P. This means that
-- - the distance between point P and this plane is less
-- than or equal to LinearTolerance, or
-- - line L is normal to the "main Axis" of the local
-- coordinate system of this plane, within the tolerance
-- AngularTolerance, and the distance between the origin
-- of line L and this plane is less than or equal to
-- LinearTolerance.
Contains (me; L : Lin; LinearTolerance, AngularTolerance : Real)
returns Boolean
is static;
---C++: inline
---Purpose: Returns true if this plane contains the line L. This means that
-- - the distance between point P and this plane is less
-- than or equal to LinearTolerance, or
-- - line L is normal to the "main Axis" of the local
-- coordinate system of this plane, within the tolerance
-- AngularTolerance, and the distance between the origin
-- of line L and this plane is less than or equal to
-- LinearTolerance.
Mirror (me : in out; P : Pnt) is static;
Mirrored (me; P : Pnt) returns Pln is static;
--- Purpose :
-- Performs the symmetrical transformation of a plane with respect
-- to the point <P> which is the center of the symmetry
-- Warnings :
-- The normal direction to the plane is not changed.
-- The "XAxis" and the "YAxis" are reversed.
Mirror (me : in out; A1 : Ax1)
is static;
Mirrored (me; A1 : Ax1) returns Pln is static;
--- Purpose : Performs the symmetrical transformation of a
-- plane with respect to an axis placement which is the axis
-- of the symmetry. The transformation is performed on the
-- "Location" point, on the "XAxis" and the "YAxis". The
-- resulting normal direction is the cross product between
-- the "XDirection" and the "YDirection" after transformation
-- if the initial plane was right handed, else it is the
-- opposite.
Mirror (me : in out; A2 : Ax2)
is static;
Mirrored (me; A2 : Ax2) returns Pln is static;
--- Purpose : Performs the symmetrical transformation of a
-- plane with respect to an axis placement. The axis
-- placement <A2> locates the plane of the symmetry. The
-- transformation is performed on the "Location" point, on
-- the "XAxis" and the "YAxis". The resulting normal
-- direction is the cross product between the "XDirection"
-- and the "YDirection" after transformation if the initial
-- plane was right handed, else it is the opposite.
Rotate (me : in out; A1 : Ax1; Ang : Real)
---C++:inline
is static;
Rotated (me; A1 : Ax1; Ang : Real) returns Pln is static;
---C++: inline
--- Purpose :
-- rotates a plane. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt; S : Real)
---C++: inline
is static;
Scaled (me; P : Pnt; S : Real) returns Pln is static;
---C++: inline
--- Purpose :
-- Scales a plane. S is the scaling value.
Transform (me : in out; T : Trsf)
---C++: inline
is static;
Transformed (me; T : Trsf) returns Pln is static;
---C++: inline
--- Purpose :
-- Transforms a plane with the transformation T from class Trsf.
-- The transformation is performed on the "Location"
-- point, on the "XAxis" and the "YAxis".
-- The resulting normal direction is the cross product between
-- the "XDirection" and the "YDirection" after transformation.
Translate (me : in out; V : Vec)
---C++: inline
is static;
Translated (me; V : Vec) returns Pln is static;
---C++: inline
--- Purpose :
-- Translates a plane in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt)
---C++: inline
is static;
Translated (me; P1, P2 : Pnt) returns Pln is static;
---C++: inline
--- Purpose :
-- Translates a plane from the point P1 to the point P2.
fields
pos : Ax3;
end;

View File

@@ -19,8 +19,17 @@
// JCV 07/92 Introduction de la method Dump
// LBO 08/93 Passage aux Ax3
#include <gp_Pln.ixx>
#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>
#include <gp_Dir.hxx>
#include <gp_Lin.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
gp_Pln::gp_Pln (const gp_Pnt& P,
const gp_Dir& V)

268
src/gp/gp_Pln.hxx Normal file
View File

@@ -0,0 +1,268 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Pln_HeaderFile
#define _gp_Pln_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax3.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <gp_Ax1.hxx>
class Standard_ConstructionError;
class gp_Ax3;
class gp_Pnt;
class gp_Dir;
class gp_Ax1;
class gp_Lin;
class gp_Ax2;
class gp_Trsf;
class gp_Vec;
//! Describes a plane.
//! A plane is positioned in space with a coordinate system
//! (a gp_Ax3 object), such that the plane is defined by the
//! origin, "X Direction" and "Y Direction" of this coordinate
//! system, which is the "local coordinate system" of the
//! plane. The "main Direction" of the coordinate system is a
//! vector normal to the plane. It gives the plane an implicit
//! orientation such that the plane is said to be "direct", if the
//! coordinate system is right-handed, or "indirect" in the other case.
//! Note: when a gp_Pln plane is converted into a
//! Geom_Plane plane, some implicit properties of its local
//! coordinate system are used explicitly:
//! - its origin defines the origin of the two parameters of
//! the planar surface,
//! - its implicit orientation is also that of the Geom_Plane.
//! See Also
//! gce_MakePln which provides functions for more complex
//! plane constructions
//! Geom_Plane which provides additional functions for
//! constructing planes and works, in particular, with the
//! parametric equations of planes
class gp_Pln
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a plane coincident with OXY plane of the
//! reference coordinate system.
gp_Pln();
//! The coordinate system of the plane is defined with the axis
//! placement A3.
//! The "Direction" of A3 defines the normal to the plane.
//! The "Location" of A3 defines the location (origin) of the plane.
//! The "XDirection" and "YDirection" of A3 define the "XAxis" and
//! the "YAxis" of the plane used to parametrize the plane.
gp_Pln(const gp_Ax3& A3);
//! Creates a plane with the "Location" point <P>
//! and the normal direction <V>.
Standard_EXPORT gp_Pln(const gp_Pnt& P, const gp_Dir& V);
//! Creates a plane from its cartesian equation :
//! A * X + B * Y + C * Z + D = 0.0
//! Raises ConstructionError if Sqrt (A*A + B*B + C*C) <= Resolution from gp.
Standard_EXPORT gp_Pln(const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D);
//! Returns the coefficients of the plane's cartesian equation :
//! A * X + B * Y + C * Z + D = 0.
void Coefficients (Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& D) const;
//! Modifies this plane, by redefining its local coordinate system so that
//! - its origin and "main Direction" become those of the
//! axis A1 (the "X Direction" and "Y Direction" are then recomputed).
//! Raises ConstructionError if the A1 is parallel to the "XAxis" of the plane.
void SetAxis (const gp_Ax1& A1);
//! Changes the origin of the plane.
void SetLocation (const gp_Pnt& Loc);
//! Changes the local coordinate system of the plane.
void SetPosition (const gp_Ax3& A3);
//! Reverses the U parametrization of the plane
//! reversing the XAxis.
void UReverse();
//! Reverses the V parametrization of the plane
//! reversing the YAxis.
void VReverse();
//! returns true if the Ax3 is right handed.
Standard_Boolean Direct() const;
//! Returns the plane's normal Axis.
const gp_Ax1& Axis() const;
//! Returns the plane's location (origin).
const gp_Pnt& Location() const;
//! Returns the local coordinate system of the plane .
const gp_Ax3& Position() const;
//! Computes the distance between <me> and the point <P>.
Standard_Real Distance (const gp_Pnt& P) const;
//! Computes the distance between <me> and the line <L>.
Standard_Real Distance (const gp_Lin& L) const;
//! Computes the distance between two planes.
Standard_Real Distance (const gp_Pln& Other) const;
//! Computes the square distance between <me> and the point <P>.
Standard_Real SquareDistance (const gp_Pnt& P) const;
//! Computes the square distance between <me> and the line <L>.
Standard_Real SquareDistance (const gp_Lin& L) const;
//! Computes the square distance between two planes.
Standard_Real SquareDistance (const gp_Pln& Other) const;
//! Returns the X axis of the plane.
gp_Ax1 XAxis() const;
//! Returns the Y axis of the plane.
gp_Ax1 YAxis() const;
//! Returns true if this plane contains the point P. This means that
//! - the distance between point P and this plane is less
//! than or equal to LinearTolerance, or
//! - line L is normal to the "main Axis" of the local
//! coordinate system of this plane, within the tolerance
//! AngularTolerance, and the distance between the origin
//! of line L and this plane is less than or equal to
//! LinearTolerance.
Standard_Boolean Contains (const gp_Pnt& P, const Standard_Real LinearTolerance) const;
//! Returns true if this plane contains the line L. This means that
//! - the distance between point P and this plane is less
//! than or equal to LinearTolerance, or
//! - line L is normal to the "main Axis" of the local
//! coordinate system of this plane, within the tolerance
//! AngularTolerance, and the distance between the origin
//! of line L and this plane is less than or equal to
//! LinearTolerance.
Standard_Boolean Contains (const gp_Lin& L, const Standard_Real LinearTolerance, const Standard_Real AngularTolerance) const;
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of a plane with respect
//! to the point <P> which is the center of the symmetry
//! Warnings :
//! The normal direction to the plane is not changed.
//! The "XAxis" and the "YAxis" are reversed.
Standard_EXPORT gp_Pln Mirrored (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of a
//! plane with respect to an axis placement which is the axis
//! of the symmetry. The transformation is performed on the
//! "Location" point, on the "XAxis" and the "YAxis". The
//! resulting normal direction is the cross product between
//! the "XDirection" and the "YDirection" after transformation
//! if the initial plane was right handed, else it is the
//! opposite.
Standard_EXPORT gp_Pln Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of a
//! plane with respect to an axis placement. The axis
//! placement <A2> locates the plane of the symmetry. The
//! transformation is performed on the "Location" point, on
//! the "XAxis" and the "YAxis". The resulting normal
//! direction is the cross product between the "XDirection"
//! and the "YDirection" after transformation if the initial
//! plane was right handed, else it is the opposite.
Standard_EXPORT gp_Pln Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! rotates a plane. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Pln Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Scales a plane. S is the scaling value.
gp_Pln Scaled (const gp_Pnt& P, const Standard_Real S) const;
void Transform (const gp_Trsf& T);
//! Transforms a plane with the transformation T from class Trsf.
//! The transformation is performed on the "Location"
//! point, on the "XAxis" and the "YAxis".
//! The resulting normal direction is the cross product between
//! the "XDirection" and the "YDirection" after transformation.
gp_Pln Transformed (const gp_Trsf& T) const;
void Translate (const gp_Vec& V);
//! Translates a plane in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Pln Translated (const gp_Vec& V) const;
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates a plane from the point P1 to the point P2.
gp_Pln Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Ax3 pos;
};
#include <gp_Pln.lxx>
#endif // _gp_Pln_HeaderFile

View File

@@ -1,215 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Pnt from gp
--- Purpose : Defines a 3D cartesian point.
uses Ax1 from gp,
Ax2 from gp,
Trsf from gp,
Vec from gp,
XYZ from gp
raises OutOfRange from Standard
is
Create returns Pnt;
---C++: inline
---Purpose : Creates a point with zero coordinates.
Create (Coord : XYZ) returns Pnt;
---C++: inline
--- Purpose : Creates a point from a XYZ object.
Create (Xp, Yp, Zp : Real) returns Pnt;
---C++:inline
--- Purpose :
-- Creates a point with its 3 cartesian's coordinates : Xp, Yp, Zp.
SetCoord (me : in out; Index : Integer; Xi : Real)
---C++:inline
--- Purpose :
-- Changes the coordinate of range Index :
-- Index = 1 => X is modified
-- Index = 2 => Y is modified
-- Index = 3 => Z is modified
raises OutOfRange
--- Purpose : Raised if Index != {1, 2, 3}.
is static;
SetCoord (me : in out; Xp, Yp, Zp : Real)
---C++: inline
---Purpose: For this point, assigns the values Xp, Yp and Zp to its three coordinates.
is static;
SetX (me : in out; X : Real)
---C++: inline
---Purpose: Assigns the given value to the X coordinate of this point.
is static;
SetY (me : in out; Y : Real)
---C++: inline
---Purpose: Assigns the given value to the Y coordinate of this point.
is static;
SetZ (me : in out; Z : Real)
---C++: inline
---Purpose: Assigns the given value to the Z coordinate of this point.
is static;
SetXYZ (me : in out; Coord : XYZ)
---C++: inline
---Purpose: Assigns the three coordinates of Coord to this point.
is static;
Coord (me; Index : Integer) returns Real
--- Purpose :
-- Returns the coordinate of corresponding to the value of Index :
-- Index = 1 => X is returned
-- Index = 2 => Y is returned
-- Index = 3 => Z is returned
-- Raises OutOfRange if Index != {1, 2, 3}.
raises OutOfRange
---C++: inline
--- Purpose : Raised if Index != {1, 2, 3}.
is static;
Coord (me; Xp, Yp, Zp : out Real)
---C++: inline
---Purpose: For this point gives its three coordinates Xp, Yp and Zp.
is static;
X (me) returns Real
---C++: inline
---Purpose: For this point, returns its X coordinate.
is static;
Y (me) returns Real
---C++: inline
---Purpose: For this point, returns its Y coordinate.
is static;
Z (me) returns Real
---C++: inline
---Purpose: For this point, returns its Z coordinate.
is static;
XYZ (me) returns XYZ is static;
---C++: inline
---C++: return const &
---Purpose: For this point, returns its three coordinates as a XYZ object.
Coord (me) returns XYZ is static;
---C++: inline
---C++: return const &
---Purpose: For this point, returns its three coordinates as a XYZ object.
ChangeCoord (me : in out) returns XYZ is static;
---C++: inline
---C++: return &
--- Purpose:
-- Returns the coordinates of this point.
-- Note: This syntax allows direct modification of the returned value.
BaryCenter(me : in out; Alpha : Real; P : Pnt from gp; Beta : Real);
---C++: inline
---Purpose: Assigns the result of the following expression to this point
-- (Alpha*this + Beta*P) / (Alpha + Beta)
IsEqual (me; Other : Pnt; LinearTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose : Comparison
-- Returns True if the distance between the two points is
-- lower or equal to LinearTolerance.
Distance (me; Other : Pnt) returns Real is static;
---C++: inline
--- Purpose : Computes the distance between two points.
SquareDistance (me; Other : Pnt) returns Real is static;
---C++: inline
--- Purpose : Computes the square distance between two points.
Mirror (me : in out; P : Pnt) is static;
--- Purpose :
-- Performs the symmetrical transformation of a point
-- with respect to the point P which is the center of
-- the symmetry.
Mirrored (me; P : Pnt) returns Pnt is static;
--- Purpose :
-- Performs the symmetrical transformation of a point
-- with respect to an axis placement which is the axis
-- of the symmetry.
Mirror (me : in out; A1 : Ax1) is static;
Mirrored (me; A1 : Ax1) returns Pnt is static;
--- Purpose :
-- Performs the symmetrical transformation of a point
-- with respect to a plane. The axis placement A2 locates
-- the plane of the symmetry : (Location, XDirection, YDirection).
Mirror (me : in out; A2 : Ax2) is static;
Mirrored (me; A2 : Ax2) returns Pnt is static;
--- Purpose :
-- Rotates a point. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Rotate (me : in out; A1 : Ax1; Ang : Real) is static;
---C++: inline
Rotated (me; A1 : Ax1; Ang : Real) returns Pnt is static;
---C++: inline
--- Purpose : Scales a point. S is the scaling value.
Scale (me : in out; P : Pnt; S : Real) is static;
---C++: inline
Scaled (me; P : Pnt; S : Real) returns Pnt is static;
---C++: inline
--- Purpose : Transforms a point with the transformation T.
Transform (me : in out; T : Trsf) is static;
Transformed (me; T : Trsf) returns Pnt is static;
---C++: inline
--- Purpose :
-- Translates a point in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; V : Vec) is static;
---C++: inline
Translated (me; V : Vec) returns Pnt is static;
---C++: inline
--- Purpose :
-- Translates a point from the point P1 to the point P2.
Translate (me : in out; P1, P2 : Pnt) is static;
---C++: inline
Translated (me; P1, P2 : Pnt) returns Pnt is static;
---C++: inline
fields
coord : XYZ;
end;

View File

@@ -18,7 +18,14 @@
#define No_Standard_OutOfRange
#include <gp_Pnt.ixx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <gp_XYZ.hxx>
#include <Standard_OutOfRange.hxx>
void gp_Pnt::Transform (const gp_Trsf& T)
{

201
src/gp/gp_Pnt.hxx Normal file
View File

@@ -0,0 +1,201 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Pnt_HeaderFile
#define _gp_Pnt_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_XYZ.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class Standard_OutOfRange;
class gp_XYZ;
class gp_Ax1;
class gp_Ax2;
class gp_Trsf;
class gp_Vec;
//! Defines a 3D cartesian point.
class gp_Pnt
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a point with zero coordinates.
gp_Pnt();
//! Creates a point from a XYZ object.
gp_Pnt(const gp_XYZ& Coord);
//! Creates a point with its 3 cartesian's coordinates : Xp, Yp, Zp.
gp_Pnt(const Standard_Real Xp, const Standard_Real Yp, const Standard_Real Zp);
//! Changes the coordinate of range Index :
//! Index = 1 => X is modified
//! Index = 2 => Y is modified
//! Index = 3 => Z is modified
//! Raised if Index != {1, 2, 3}.
void SetCoord (const Standard_Integer Index, const Standard_Real Xi);
//! For this point, assigns the values Xp, Yp and Zp to its three coordinates.
void SetCoord (const Standard_Real Xp, const Standard_Real Yp, const Standard_Real Zp);
//! Assigns the given value to the X coordinate of this point.
void SetX (const Standard_Real X);
//! Assigns the given value to the Y coordinate of this point.
void SetY (const Standard_Real Y);
//! Assigns the given value to the Z coordinate of this point.
void SetZ (const Standard_Real Z);
//! Assigns the three coordinates of Coord to this point.
void SetXYZ (const gp_XYZ& Coord);
//! Returns the coordinate of corresponding to the value of Index :
//! Index = 1 => X is returned
//! Index = 2 => Y is returned
//! Index = 3 => Z is returned
//! Raises OutOfRange if Index != {1, 2, 3}.
//! Raised if Index != {1, 2, 3}.
Standard_Real Coord (const Standard_Integer Index) const;
//! For this point gives its three coordinates Xp, Yp and Zp.
void Coord (Standard_Real& Xp, Standard_Real& Yp, Standard_Real& Zp) const;
//! For this point, returns its X coordinate.
Standard_Real X() const;
//! For this point, returns its Y coordinate.
Standard_Real Y() const;
//! For this point, returns its Z coordinate.
Standard_Real Z() const;
//! For this point, returns its three coordinates as a XYZ object.
const gp_XYZ& XYZ() const;
//! For this point, returns its three coordinates as a XYZ object.
const gp_XYZ& Coord() const;
//! Returns the coordinates of this point.
//! Note: This syntax allows direct modification of the returned value.
gp_XYZ& ChangeCoord();
//! Assigns the result of the following expression to this point
//! (Alpha*this + Beta*P) / (Alpha + Beta)
void BaryCenter (const Standard_Real Alpha, const gp_Pnt& P, const Standard_Real Beta);
//! Comparison
//! Returns True if the distance between the two points is
//! lower or equal to LinearTolerance.
Standard_Boolean IsEqual (const gp_Pnt& Other, const Standard_Real LinearTolerance) const;
//! Computes the distance between two points.
Standard_Real Distance (const gp_Pnt& Other) const;
//! Computes the square distance between two points.
Standard_Real SquareDistance (const gp_Pnt& Other) const;
//! Performs the symmetrical transformation of a point
//! with respect to the point P which is the center of
//! the symmetry.
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of a point
//! with respect to an axis placement which is the axis
//! of the symmetry.
Standard_EXPORT gp_Pnt Mirrored (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of a point
//! with respect to a plane. The axis placement A2 locates
//! the plane of the symmetry : (Location, XDirection, YDirection).
Standard_EXPORT gp_Pnt Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Rotates a point. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
Standard_EXPORT gp_Pnt Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Scales a point. S is the scaling value.
gp_Pnt Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Transforms a point with the transformation T.
gp_Pnt Scaled (const gp_Pnt& P, const Standard_Real S) const;
Standard_EXPORT void Transform (const gp_Trsf& T);
//! Translates a point in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Pnt Transformed (const gp_Trsf& T) const;
void Translate (const gp_Vec& V);
//! Translates a point from the point P1 to the point P2.
gp_Pnt Translated (const gp_Vec& V) const;
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
gp_Pnt Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_XYZ coord;
};
#include <gp_Pnt.lxx>
#endif // _gp_Pnt_HeaderFile

View File

@@ -1,189 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Pnt2d from gp
--- Purpose : Defines a non-persistent 2D cartesian point.
uses Ax2d from gp,
Trsf2d from gp,
Vec2d from gp,
XY from gp
raises OutOfRange from Standard
is
Create returns Pnt2d;
---C++: inline
---Purpose : Creates a point with zero coordinates.
Create (Coord : XY) returns Pnt2d;
---C++: inline
--- Purpose : Creates a point with a doublet of coordinates.
Create (Xp, Yp : Real) returns Pnt2d;
---C++: inline
--- Purpose :
-- Creates a point with its 2 cartesian's coordinates : Xp, Yp.
SetCoord (me : in out; Index : Integer; Xi : Real)
---C++:inline
--- Purpose :
-- Assigns the value Xi to the coordinate that corresponds to Index:
-- Index = 1 => X is modified
-- Index = 2 => Y is modified
-- Raises OutOfRange if Index != {1, 2}.
raises OutOfRange
is static;
SetCoord (me : in out; Xp, Yp : Real)
---C++: inline
---Purpose: For this point, assigns the values Xp and Yp to its two coordinates
is static;
SetX (me : in out; X : Real)
---C++: inline
---Purpose: Assigns the given value to the X coordinate of this point.
is static;
SetY (me : in out; Y : Real)
---C++: inline
---Purpose: Assigns the given value to the Y coordinate of this point.
is static;
SetXY (me : in out; Coord : XY)
---C++: inline
---Purpose: Assigns the two coordinates of Coord to this point.
is static;
Coord (me; Index : Integer) returns Real
--- Purpose :
-- Returns the coordinate of range Index :
-- Index = 1 => X is returned
-- Index = 2 => Y is returned
-- Raises OutOfRange if Index != {1, 2}.
raises OutOfRange
is static;
Coord (me; Xp, Yp : out Real)
---C++:inline
---Purpose: For this point returns its two coordinates as a number pair.
is static;
X (me) returns Real
---C++:inline
---Purpose: For this point, returns its X coordinate.
is static;
Y (me) returns Real
---C++:inline
---Purpose: For this point, returns its Y coordinate.
is static;
XY (me) returns XY
---C++: inline
---C++: return const&
---Purpose: For this point, returns its two coordinates as a number pair.
is static;
Coord (me) returns XY
---C++: inline
---C++: return const&
---Purpose: For this point, returns its two coordinates as a number pair.
is static;
ChangeCoord (me: in out) returns XY
---C++: inline
---C++: return &
---Purpose:
-- Returns the coordinates of this point.
-- Note: This syntax allows direct modification of the returned value.
is static;
IsEqual (me; Other : Pnt2d; LinearTolerance : Real) returns Boolean
is static;
---C++: inline
--- Purpose : Comparison
-- Returns True if the distance between the two
-- points is lower or equal to LinearTolerance.
Distance (me; Other : Pnt2d) returns Real is static;
---C++: inline
--- Purpose : Computes the distance between two points.
SquareDistance (me; Other : Pnt2d) returns Real is static;
---C++: inline
--- Purpose : Computes the square distance between two points.
Mirror (me : in out; P : Pnt2d) is static;
--- Purpose :
-- Performs the symmetrical transformation of a point
-- with respect to the point P which is the center of
-- the symmetry.
Mirrored (me; P : Pnt2d) returns Pnt2d is static;
--- Purpose :
-- Performs the symmetrical transformation of a point
-- with respect to an axis placement which is the axis
Mirror (me : in out; A : Ax2d) is static;
Mirrored (me; A : Ax2d) returns Pnt2d is static;
--- Purpose :
-- Rotates a point. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Rotate (me : in out; P : Pnt2d; Ang : Real) is static;
---C++: inline
Rotated (me; P : Pnt2d; Ang : Real) returns Pnt2d is static;
---C++: inline
--- Purpose : Scales a point. S is the scaling value.
Scale (me : in out; P : Pnt2d; S : Real) is static;
---C++: inline
Scaled (me; P : Pnt2d; S : Real) returns Pnt2d is static;
---C++: inline
--- Purpose : Transforms a point with the transformation T.
Transform (me : in out; T : Trsf2d) is static;
Transformed (me; T : Trsf2d) returns Pnt2d is static;
---C++: inline
--- Purpose :
-- Translates a point in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; V : Vec2d) is static;
---C++: inline
Translated (me; V : Vec2d) returns Pnt2d is static;
---C++: inline
--- Purpose :
-- Translates a point from the point P1 to the point P2.
Translate (me : in out; P1, P2 : Pnt2d) is static;
---C++: inline
Translated (me; P1, P2 : Pnt2d) returns Pnt2d is static;
---C++: inline
fields
coord : XY;
end;

View File

@@ -16,7 +16,13 @@
#define No_Standard_OutOfRange
#include <gp_Pnt2d.ixx>
#include <gp_Ax2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <gp_XY.hxx>
#include <Standard_OutOfRange.hxx>
void gp_Pnt2d::Transform (const gp_Trsf2d& T)
{

178
src/gp/gp_Pnt2d.hxx Normal file
View File

@@ -0,0 +1,178 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Pnt2d_HeaderFile
#define _gp_Pnt2d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_XY.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class Standard_OutOfRange;
class gp_XY;
class gp_Ax2d;
class gp_Trsf2d;
class gp_Vec2d;
//! Defines a non-persistent 2D cartesian point.
class gp_Pnt2d
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a point with zero coordinates.
gp_Pnt2d();
//! Creates a point with a doublet of coordinates.
gp_Pnt2d(const gp_XY& Coord);
//! Creates a point with its 2 cartesian's coordinates : Xp, Yp.
gp_Pnt2d(const Standard_Real Xp, const Standard_Real Yp);
//! Assigns the value Xi to the coordinate that corresponds to Index:
//! Index = 1 => X is modified
//! Index = 2 => Y is modified
//! Raises OutOfRange if Index != {1, 2}.
void SetCoord (const Standard_Integer Index, const Standard_Real Xi);
//! For this point, assigns the values Xp and Yp to its two coordinates
void SetCoord (const Standard_Real Xp, const Standard_Real Yp);
//! Assigns the given value to the X coordinate of this point.
void SetX (const Standard_Real X);
//! Assigns the given value to the Y coordinate of this point.
void SetY (const Standard_Real Y);
//! Assigns the two coordinates of Coord to this point.
void SetXY (const gp_XY& Coord);
//! Returns the coordinate of range Index :
//! Index = 1 => X is returned
//! Index = 2 => Y is returned
//! Raises OutOfRange if Index != {1, 2}.
Standard_EXPORT Standard_Real Coord (const Standard_Integer Index) const;
//! For this point returns its two coordinates as a number pair.
void Coord (Standard_Real& Xp, Standard_Real& Yp) const;
//! For this point, returns its X coordinate.
Standard_Real X() const;
//! For this point, returns its Y coordinate.
Standard_Real Y() const;
//! For this point, returns its two coordinates as a number pair.
const gp_XY& XY() const;
//! For this point, returns its two coordinates as a number pair.
const gp_XY& Coord() const;
//! Returns the coordinates of this point.
//! Note: This syntax allows direct modification of the returned value.
gp_XY& ChangeCoord();
//! Comparison
//! Returns True if the distance between the two
//! points is lower or equal to LinearTolerance.
Standard_Boolean IsEqual (const gp_Pnt2d& Other, const Standard_Real LinearTolerance) const;
//! Computes the distance between two points.
Standard_Real Distance (const gp_Pnt2d& Other) const;
//! Computes the square distance between two points.
Standard_Real SquareDistance (const gp_Pnt2d& Other) const;
//! Performs the symmetrical transformation of a point
//! with respect to the point P which is the center of
//! the symmetry.
Standard_EXPORT void Mirror (const gp_Pnt2d& P);
//! Performs the symmetrical transformation of a point
//! with respect to an axis placement which is the axis
Standard_EXPORT gp_Pnt2d Mirrored (const gp_Pnt2d& P) const;
Standard_EXPORT void Mirror (const gp_Ax2d& A);
//! Rotates a point. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
Standard_EXPORT gp_Pnt2d Mirrored (const gp_Ax2d& A) const;
void Rotate (const gp_Pnt2d& P, const Standard_Real Ang);
//! Scales a point. S is the scaling value.
gp_Pnt2d Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
void Scale (const gp_Pnt2d& P, const Standard_Real S);
//! Transforms a point with the transformation T.
gp_Pnt2d Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
Standard_EXPORT void Transform (const gp_Trsf2d& T);
//! Translates a point in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Pnt2d Transformed (const gp_Trsf2d& T) const;
void Translate (const gp_Vec2d& V);
//! Translates a point from the point P1 to the point P2.
gp_Pnt2d Translated (const gp_Vec2d& V) const;
void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2);
gp_Pnt2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
protected:
private:
gp_XY coord;
};
#include <gp_Pnt2d.lxx>
#endif // _gp_Pnt2d_HeaderFile

View File

@@ -1,216 +0,0 @@
-- Created on: 2010-05-11
-- Created by: Kirill GAVRILOV
-- Copyright (c) 2010-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Quaternion from gp
---Purpose: Represents operation of rotation in 3d space as queternion
-- and implements operations with rotations basing on
-- quaternion mathematics.
--
-- In addition, provides methods for conversion to and from other
-- representatons of rotation (3*3 matrix, vector and
-- angle, Euler angles)
uses
Vec from gp,
Mat from gp,
EulerSequence from gp
is
Create returns Quaternion from gp;
---Purpose: Creates an identity quaternion
---C++: inline
Create (x, y, z, w: Real)
returns Quaternion from gp;
---Purpose: Creates quaternion directly from component values
Create (theToCopy: Quaternion from gp)
returns Quaternion from gp;
---Purpose: Creates copy of another quaternion
Create (theVecFrom, theVecTo: Vec from gp)
returns Quaternion from gp;
---Purpose: Creates quaternion representing shortest-arc rotation
-- operator producing vector theVecTo from vector theVecFrom.
Create (theVecFrom, theVecTo, theHelpCrossVec: Vec from gp)
returns Quaternion from gp;
---Purpose: Creates quaternion representing shortest-arc rotation
-- operator producing vector theVecTo from vector theVecFrom.
-- Additional vector theHelpCrossVec defines preferred direction for
-- rotation and is used when theVecTo and theVecFrom are directed
-- oppositely.
Create (theAxis: Vec from gp; theAngle: Real)
returns Quaternion from gp;
---Purpose: Creates quaternion representing rotation on angle
-- theAngle around vector theAxis
Create (theMat: Mat from gp)
returns Quaternion from gp;
---Purpose: Creates quaternion from rotation matrix 3*3
-- (which should be orthonormal skew-symmetric matrix)
IsEqual (me; theOther: Quaternion from gp) returns Boolean;
---Purpose: Simple equal test without precision
SetRotation (me: in out; theVecFrom, theVecTo: Vec from gp);
---Purpose: Sets quaternion to shortest-arc rotation producing
-- vector theVecTo from vector theVecFrom.
-- If vectors theVecFrom and theVecTo are opposite then rotation
-- axis is computed as theVecFrom ^ (1,0,0) or theVecFrom ^ (0,0,1).
SetRotation (me: in out; theVecFrom, theVecTo, theHelpCrossVec: Vec from gp);
---Purpose: Sets quaternion to shortest-arc rotation producing
-- vector theVecTo from vector theVecFrom.
-- If vectors theVecFrom and theVecTo are opposite then rotation
-- axis is computed as theVecFrom ^ theHelpCrossVec.
SetVectorAndAngle (me: in out; theAxis: Vec from gp; theAngle: Real);
---Purpose: Create a unit quaternion from Axis+Angle representation
GetVectorAndAngle (me; theAxis: out Vec from gp; theAngle: out Real);
---Purpose: Convert a quaternion to Axis+Angle representation,
-- preserve the axis direction and angle from -PI to +PI
SetMatrix (me: in out; theMat: Mat from gp);
---Purpose: Create a unit quaternion by rotation matrix
-- matrix must contain only rotation (not scale or shear)
--
-- For numerical stability we find first the greatest component of quaternion
-- and than search others from this one
GetMatrix (me) returns Mat from gp;
---Purpose: Returns rotation operation as 3*3 matrix
SetEulerAngles (me: in out; theOrder: EulerSequence from gp;
theAlpha, theBeta, theGamma: Real);
---Purpose: Create a unit quaternion representing rotation defined
-- by generalized Euler angles
GetEulerAngles (me; theOrder: EulerSequence from gp;
theAlpha, theBeta, theGamma: out Real);
---Purpose: Returns Euler angles describing current rotation
Set (me: in out; x, y, z, w: Real);
Set (me: in out; theQuaternion: Quaternion from gp);
X (me) returns Real;
Y (me) returns Real;
Z (me) returns Real;
W (me) returns Real;
SetIdent (me: in out);
---Purpose: Make identity quaternion (zero-rotation)
Reverse (me: in out);
---Purpose: Reverse direction of rotation (conjugate quaternion)
Reversed (me) returns Quaternion from gp;
---Purpose: Return rotation with reversed direction (conjugated quaternion)
Invert (me: in out);
---Purpose: Inverts quaternion (both rotation direction and norm)
Inverted (me) returns Quaternion from gp;
---Purpose: Return inversed quaternion q^-1
SquareNorm (me) returns Real;
---Purpose: Returns square norm of quaternion
Norm (me) returns Real;
---Purpose: Returns norm of quaternion
Scale (me: in out; theScale: Real);
---Purpose: Scale all components by quaternion by theScale; note that
-- rotation is not changed by this operation (except 0-scaling)
---C++: alias operator *=
Scaled (me; theScale: Real) returns Quaternion from gp;
---Purpose: Returns scaled quaternion
---C++: alias operator *
StabilizeLength (me: in out);
---Purpose: Stabilize quaternion length within 1 - 1/4.
-- This operation is a lot faster than normalization
-- and preserve length goes to 0 or infinity
Normalize (me: in out);
---Purpose: Scale quaternion that its norm goes to 1.
-- The appearing of 0 magnitude or near is a error,
-- so we can be sure that can divide by magnitude
Normalized (me) returns Quaternion from gp;
---Purpose: Returns quaternion scaled so that its norm goes to 1.
Negated (me) returns Quaternion from gp;
---Purpose: Returns quaternion with all components negated.
-- Note that this operation does not affect neither
-- rotation operator defined by quaternion nor its norm.
---C++: alias operator -
Added (me; theOther: Quaternion from gp) returns Quaternion from gp;
---Purpose: Makes sum of quaternion components; result is "rotations mix"
---C++: alias operator +
Subtracted (me; theOther: Quaternion from gp) returns Quaternion from gp;
---Purpose: Makes difference of quaternion components; result is "rotations mix"
---C++: alias operator -
Multiplied (me; theOther: Quaternion from gp) returns Quaternion from gp;
---Purpose: Multiply function - work the same as Matrices multiplying.
-- qq' = (cross(v,v') + wv' + w'v, ww' - dot(v,v'))
-- Result is rotation combination: q' than q (here q=this, q'=theQ).
-- Notices than:
-- qq' != q'q;
-- qq^-1 = q;
---C++: alias operator *
Add (me: in out; theOther: Quaternion from gp);
---Purpose: Adds componnets of other quaternion; result is "rotations mix"
---C++: alias operator +=
Subtract (me: in out; theOther: Quaternion from gp);
---Purpose: Subtracts componnets of other quaternion; result is "rotations mix"
---C++: alias operator -=
Multiply (me: in out; theOther: Quaternion from gp);
---Purpose: Adds rotation by multiplication
---C++: alias operator *=
Dot (me; theOther: Quaternion from gp) returns Real;
---Purpose: Computes inner product / scalar product / Dot
GetRotationAngle (me) returns Real;
---Purpose: Return rotation angle from -PI to PI
Multiply (me; theVec: Vec from gp) returns Vec from gp;
---Purpose: Rotates vector by quaternion as rotation operator
---C++: alias operator *
fields
x: Real;
y: Real;
z: Real;
w: Real;
end;

270
src/gp/gp_Quaternion.hxx Normal file
View File

@@ -0,0 +1,270 @@
// Created on: 2010-05-11
// Created by: Kirill GAVRILOV
// Copyright (c) 2010-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Quaternion_HeaderFile
#define _gp_Quaternion_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <gp_EulerSequence.hxx>
#include <gp_Vec.hxx>
class gp_Vec;
class gp_Mat;
//! Represents operation of rotation in 3d space as queternion
//! and implements operations with rotations basing on
//! quaternion mathematics.
//!
//! In addition, provides methods for conversion to and from other
//! representatons of rotation (3*3 matrix, vector and
//! angle, Euler angles)
class gp_Quaternion
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an identity quaternion
gp_Quaternion();
//! Creates quaternion directly from component values
Standard_EXPORT gp_Quaternion(const Standard_Real x, const Standard_Real y, const Standard_Real z, const Standard_Real w);
//! Creates copy of another quaternion
Standard_EXPORT gp_Quaternion(const gp_Quaternion& theToCopy);
//! Creates quaternion representing shortest-arc rotation
//! operator producing vector theVecTo from vector theVecFrom.
Standard_EXPORT gp_Quaternion(const gp_Vec& theVecFrom, const gp_Vec& theVecTo);
//! Creates quaternion representing shortest-arc rotation
//! operator producing vector theVecTo from vector theVecFrom.
//! Additional vector theHelpCrossVec defines preferred direction for
//! rotation and is used when theVecTo and theVecFrom are directed
//! oppositely.
Standard_EXPORT gp_Quaternion(const gp_Vec& theVecFrom, const gp_Vec& theVecTo, const gp_Vec& theHelpCrossVec);
//! Creates quaternion representing rotation on angle
//! theAngle around vector theAxis
Standard_EXPORT gp_Quaternion(const gp_Vec& theAxis, const Standard_Real theAngle);
//! Creates quaternion from rotation matrix 3*3
//! (which should be orthonormal skew-symmetric matrix)
Standard_EXPORT gp_Quaternion(const gp_Mat& theMat);
//! Simple equal test without precision
Standard_EXPORT Standard_Boolean IsEqual (const gp_Quaternion& theOther) const;
//! Sets quaternion to shortest-arc rotation producing
//! vector theVecTo from vector theVecFrom.
//! If vectors theVecFrom and theVecTo are opposite then rotation
//! axis is computed as theVecFrom ^ (1,0,0) or theVecFrom ^ (0,0,1).
Standard_EXPORT void SetRotation (const gp_Vec& theVecFrom, const gp_Vec& theVecTo);
//! Sets quaternion to shortest-arc rotation producing
//! vector theVecTo from vector theVecFrom.
//! If vectors theVecFrom and theVecTo are opposite then rotation
//! axis is computed as theVecFrom ^ theHelpCrossVec.
Standard_EXPORT void SetRotation (const gp_Vec& theVecFrom, const gp_Vec& theVecTo, const gp_Vec& theHelpCrossVec);
//! Create a unit quaternion from Axis+Angle representation
Standard_EXPORT void SetVectorAndAngle (const gp_Vec& theAxis, const Standard_Real theAngle);
//! Convert a quaternion to Axis+Angle representation,
//! preserve the axis direction and angle from -PI to +PI
Standard_EXPORT void GetVectorAndAngle (gp_Vec& theAxis, Standard_Real& theAngle) const;
//! Create a unit quaternion by rotation matrix
//! matrix must contain only rotation (not scale or shear)
//!
//! For numerical stability we find first the greatest component of quaternion
//! and than search others from this one
Standard_EXPORT void SetMatrix (const gp_Mat& theMat);
//! Returns rotation operation as 3*3 matrix
Standard_EXPORT gp_Mat GetMatrix() const;
//! Create a unit quaternion representing rotation defined
//! by generalized Euler angles
Standard_EXPORT void SetEulerAngles (const gp_EulerSequence theOrder, const Standard_Real theAlpha, const Standard_Real theBeta, const Standard_Real theGamma);
//! Returns Euler angles describing current rotation
Standard_EXPORT void GetEulerAngles (const gp_EulerSequence theOrder, Standard_Real& theAlpha, Standard_Real& theBeta, Standard_Real& theGamma) const;
Standard_EXPORT void Set (const Standard_Real x, const Standard_Real y, const Standard_Real z, const Standard_Real w);
Standard_EXPORT void Set (const gp_Quaternion& theQuaternion);
Standard_EXPORT Standard_Real X() const;
Standard_EXPORT Standard_Real Y() const;
Standard_EXPORT Standard_Real Z() const;
Standard_EXPORT Standard_Real W() const;
//! Make identity quaternion (zero-rotation)
Standard_EXPORT void SetIdent();
//! Reverse direction of rotation (conjugate quaternion)
Standard_EXPORT void Reverse();
//! Return rotation with reversed direction (conjugated quaternion)
Standard_EXPORT gp_Quaternion Reversed() const;
//! Inverts quaternion (both rotation direction and norm)
Standard_EXPORT void Invert();
//! Return inversed quaternion q^-1
Standard_EXPORT gp_Quaternion Inverted() const;
//! Returns square norm of quaternion
Standard_EXPORT Standard_Real SquareNorm() const;
//! Returns norm of quaternion
Standard_EXPORT Standard_Real Norm() const;
//! Scale all components by quaternion by theScale; note that
//! rotation is not changed by this operation (except 0-scaling)
Standard_EXPORT void Scale (const Standard_Real theScale);
void operator *= (const Standard_Real theScale)
{
Scale(theScale);
}
//! Returns scaled quaternion
Standard_EXPORT gp_Quaternion Scaled (const Standard_Real theScale) const;
gp_Quaternion operator * (const Standard_Real theScale) const
{
return Scaled(theScale);
}
//! Stabilize quaternion length within 1 - 1/4.
//! This operation is a lot faster than normalization
//! and preserve length goes to 0 or infinity
Standard_EXPORT void StabilizeLength();
//! Scale quaternion that its norm goes to 1.
//! The appearing of 0 magnitude or near is a error,
//! so we can be sure that can divide by magnitude
Standard_EXPORT void Normalize();
//! Returns quaternion scaled so that its norm goes to 1.
Standard_EXPORT gp_Quaternion Normalized() const;
//! Returns quaternion with all components negated.
//! Note that this operation does not affect neither
//! rotation operator defined by quaternion nor its norm.
Standard_EXPORT gp_Quaternion Negated() const;
gp_Quaternion operator -() const
{
return Negated();
}
//! Makes sum of quaternion components; result is "rotations mix"
Standard_EXPORT gp_Quaternion Added (const gp_Quaternion& theOther) const;
gp_Quaternion operator + (const gp_Quaternion& theOther) const
{
return Added(theOther);
}
//! Makes difference of quaternion components; result is "rotations mix"
Standard_EXPORT gp_Quaternion Subtracted (const gp_Quaternion& theOther) const;
gp_Quaternion operator - (const gp_Quaternion& theOther) const
{
return Subtracted(theOther);
}
//! Multiply function - work the same as Matrices multiplying.
//! qq' = (cross(v,v') + wv' + w'v, ww' - dot(v,v'))
//! Result is rotation combination: q' than q (here q=this, q'=theQ).
//! Notices than:
//! qq' != q'q;
//! qq^-1 = q;
Standard_EXPORT gp_Quaternion Multiplied (const gp_Quaternion& theOther) const;
gp_Quaternion operator * (const gp_Quaternion& theOther) const
{
return Multiplied(theOther);
}
//! Adds componnets of other quaternion; result is "rotations mix"
Standard_EXPORT void Add (const gp_Quaternion& theOther);
void operator += (const gp_Quaternion& theOther)
{
Add(theOther);
}
//! Subtracts componnets of other quaternion; result is "rotations mix"
Standard_EXPORT void Subtract (const gp_Quaternion& theOther);
void operator -= (const gp_Quaternion& theOther)
{
Subtract(theOther);
}
//! Adds rotation by multiplication
Standard_EXPORT void Multiply (const gp_Quaternion& theOther);
void operator *= (const gp_Quaternion& theOther)
{
Multiply(theOther);
}
//! Computes inner product / scalar product / Dot
Standard_EXPORT Standard_Real Dot (const gp_Quaternion& theOther) const;
//! Return rotation angle from -PI to PI
Standard_EXPORT Standard_Real GetRotationAngle() const;
//! Rotates vector by quaternion as rotation operator
Standard_EXPORT gp_Vec Multiply (const gp_Vec& theVec) const;
gp_Vec operator * (const gp_Vec& theVec) const
{
return Multiply(theVec);
}
protected:
private:
Standard_Real x;
Standard_Real y;
Standard_Real z;
Standard_Real w;
};
#include <gp_Quaternion.lxx>
#endif // _gp_Quaternion_HeaderFile

View File

@@ -1,238 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Sphere from gp
--- Purpose :
-- Describes a sphere.
-- A sphere is defined by its radius and positioned in space
-- with a coordinate system (a gp_Ax3 object). The origin of
-- the coordinate system is the center of the sphere. This
-- coordinate system is the "local coordinate system" of the sphere.
-- Note: when a gp_Sphere sphere is converted into a
-- Geom_SphericalSurface sphere, some implicit
-- properties of its local coordinate system are used explicitly:
-- - its origin, "X Direction", "Y Direction" and "main
-- Direction" are used directly to define the parametric
-- directions on the sphere and the origin of the parameters,
-- - its implicit orientation (right-handed or left-handed)
-- gives the orientation (direct, indirect) to the
-- Geom_SphericalSurface sphere.
-- See Also
-- gce_MakeSphere which provides functions for more
-- complex sphere constructions
-- Geom_SphericalSurface which provides additional
-- functions for constructing spheres and works, in
-- particular, with the parametric equations of spheres.
uses Ax1 from gp,
Ax2 from gp,
Ax3 from gp,
Dir from gp,
Pnt from gp,
Trsf from gp,
Vec from gp
raises ConstructionError from Standard
is
Create returns Sphere;
---C++:inline
--- Purpose : Creates an indefinite sphere.
Create (A3 : Ax3; Radius : Real) returns Sphere
---C++: inline
--- Purpose :
-- Constructs a sphere with radius Radius, centered on the origin
-- of A3. A3 is the local coordinate system of the sphere.
-- Warnings :
-- It is not forbidden to create a sphere with null radius.
-- Raises ConstructionError if Radius < 0.0
raises ConstructionError;
SetLocation (me : in out; Loc : Pnt) is static;
---C++: inline
--- Purpose : Changes the center of the sphere.
SetPosition (me : in out; A3 : Ax3) is static;
---C++: inline
--- Purpose : Changes the local coordinate system of the sphere.
SetRadius (me : in out; R : Real)
---C++: inline
--- Purpose : Assigns R the radius of the Sphere.
-- Warnings :
-- It is not forbidden to create a sphere with null radius.
-- Raises ConstructionError if R < 0.0
raises ConstructionError
is static;
Area (me) returns Real is static;
---C++: inline
--- Purpose :
-- Computes the aera of the sphere.
Coefficients (me; A1, A2, A3, B1, B2, B3, C1, C2, C3, D : out Real)
is static;
--- Purpose :
-- Computes the coefficients of the implicit equation of the quadric
-- in the absolute cartesian coordinates system :
-- A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) +
-- 2.(C1.X + C2.Y + C3.Z) + D = 0.0
UReverse (me : in out)
---C++: inline
---Purpose: Reverses the U parametrization of the sphere
-- reversing the YAxis.
is static;
VReverse (me : in out)
---C++: inline
---Purpose: Reverses the V parametrization of the sphere
-- reversing the ZAxis.
is static;
Direct (me) returns Boolean from Standard
---C++: inline
---Purpose: Returns true if the local coordinate system of this sphere
-- is right-handed.
is static;
Location (me) returns Pnt is static;
---C++: inline
--- Purpose ;
-- Returns the center of the sphere.
---C++: return const&
Position (me) returns Ax3 is static;
--- Purpose :
-- Returns the local coordinates system of the sphere.
---C++: inline
---C++: return const&
Radius (me) returns Real is static;
---C++: inline
--- Purpose : Returns the radius of the sphere.
Volume (me) returns Real is static;
---C++: inline
--- Purpose : Computes the volume of the sphere
XAxis (me) returns Ax1 is static;
---C++: inline
--- Purpose : Returns the axis X of the sphere.
YAxis (me) returns Ax1 is static;
---C++: inline
--- Purpose : Returns the axis Y of the sphere.
Mirror (me : in out; P : Pnt) is static;
Mirrored (me; P : Pnt) returns Sphere is static;
--- Purpose :
-- Performs the symmetrical transformation of a sphere
-- with respect to the point P which is the center of the
-- symmetry.
Mirror (me : in out; A1 : Ax1) is static;
Mirrored (me; A1 : Ax1) returns Sphere is static;
--- Purpose :
-- Performs the symmetrical transformation of a sphere with
-- respect to an axis placement which is the axis of the
-- symmetry.
Mirror (me : in out; A2 : Ax2) is static;
Mirrored (me; A2 : Ax2) returns Sphere is static;
--- Purpose :
-- Performs the symmetrical transformation of a sphere with respect
-- to a plane. The axis placement A2 locates the plane of the
-- of the symmetry : (Location, XDirection, YDirection).
Rotate (me : in out; A1 : Ax1; Ang : Real) is static;
---C++: inline
Rotated (me; A1 : Ax1; Ang : Real) returns Sphere is static;
---C++: inline
--- Purpose :
-- Rotates a sphere. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt; S : Real) is static;
---C++:inline
Scaled (me; P : Pnt; S : Real) returns Sphere is static;
---C++:inline
--- Purpose :
-- Scales a sphere. S is the scaling value.
-- The absolute value of S is used to scale the sphere
Transform (me : in out; T : Trsf) is static;
---C++:inline
Transformed (me; T : Trsf) returns Sphere is static;
---C++:inline
--- Purpose :
-- Transforms a sphere with the transformation T from class Trsf.
Translate (me : in out; V : Vec) is static;
---C++:inline
Translated (me; V : Vec) returns Sphere is static;
---C++:inline
--- Purpose :
-- Translates a sphere in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt) is static;
---C++:inline
Translated (me; P1, P2 : Pnt) returns Sphere is static;
---C++:inline
--- Purpose :
-- Translates a sphere from the point P1 to the point P2.
fields
pos : Ax3;
radius : Real;
end;

View File

@@ -12,7 +12,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gp_Sphere.ixx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>
#include <gp_Pnt.hxx>
#include <gp_Sphere.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
void gp_Sphere::Coefficients

212
src/gp/gp_Sphere.hxx Normal file
View File

@@ -0,0 +1,212 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Sphere_HeaderFile
#define _gp_Sphere_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax3.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <gp_Ax1.hxx>
class Standard_ConstructionError;
class gp_Ax3;
class gp_Pnt;
class gp_Ax1;
class gp_Ax2;
class gp_Trsf;
class gp_Vec;
//! Describes a sphere.
//! A sphere is defined by its radius and positioned in space
//! with a coordinate system (a gp_Ax3 object). The origin of
//! the coordinate system is the center of the sphere. This
//! coordinate system is the "local coordinate system" of the sphere.
//! Note: when a gp_Sphere sphere is converted into a
//! Geom_SphericalSurface sphere, some implicit
//! properties of its local coordinate system are used explicitly:
//! - its origin, "X Direction", "Y Direction" and "main
//! Direction" are used directly to define the parametric
//! directions on the sphere and the origin of the parameters,
//! - its implicit orientation (right-handed or left-handed)
//! gives the orientation (direct, indirect) to the
//! Geom_SphericalSurface sphere.
//! See Also
//! gce_MakeSphere which provides functions for more
//! complex sphere constructions
//! Geom_SphericalSurface which provides additional
//! functions for constructing spheres and works, in
//! particular, with the parametric equations of spheres.
class gp_Sphere
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an indefinite sphere.
gp_Sphere();
//! Constructs a sphere with radius Radius, centered on the origin
//! of A3. A3 is the local coordinate system of the sphere.
//! Warnings :
//! It is not forbidden to create a sphere with null radius.
//! Raises ConstructionError if Radius < 0.0
gp_Sphere(const gp_Ax3& A3, const Standard_Real Radius);
//! Changes the center of the sphere.
void SetLocation (const gp_Pnt& Loc);
//! Changes the local coordinate system of the sphere.
void SetPosition (const gp_Ax3& A3);
//! Assigns R the radius of the Sphere.
//! Warnings :
//! It is not forbidden to create a sphere with null radius.
//! Raises ConstructionError if R < 0.0
void SetRadius (const Standard_Real R);
//! Computes the aera of the sphere.
Standard_Real Area() const;
//! Computes the coefficients of the implicit equation of the quadric
//! in the absolute cartesian coordinates system :
//! A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) +
//! 2.(C1.X + C2.Y + C3.Z) + D = 0.0
Standard_EXPORT void Coefficients (Standard_Real& A1, Standard_Real& A2, Standard_Real& A3, Standard_Real& B1, Standard_Real& B2, Standard_Real& B3, Standard_Real& C1, Standard_Real& C2, Standard_Real& C3, Standard_Real& D) const;
//! Reverses the U parametrization of the sphere
//! reversing the YAxis.
void UReverse();
//! Reverses the V parametrization of the sphere
//! reversing the ZAxis.
void VReverse();
//! Returns true if the local coordinate system of this sphere
//! is right-handed.
Standard_Boolean Direct() const;
//! --- Purpose ;
//! Returns the center of the sphere.
const gp_Pnt& Location() const;
//! Returns the local coordinates system of the sphere.
const gp_Ax3& Position() const;
//! Returns the radius of the sphere.
Standard_Real Radius() const;
//! Computes the volume of the sphere
Standard_Real Volume() const;
//! Returns the axis X of the sphere.
gp_Ax1 XAxis() const;
//! Returns the axis Y of the sphere.
gp_Ax1 YAxis() const;
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of a sphere
//! with respect to the point P which is the center of the
//! symmetry.
Standard_EXPORT gp_Sphere Mirrored (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of a sphere with
//! respect to an axis placement which is the axis of the
//! symmetry.
Standard_EXPORT gp_Sphere Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of a sphere with respect
//! to a plane. The axis placement A2 locates the plane of the
//! of the symmetry : (Location, XDirection, YDirection).
Standard_EXPORT gp_Sphere Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates a sphere. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Sphere Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Scales a sphere. S is the scaling value.
//! The absolute value of S is used to scale the sphere
gp_Sphere Scaled (const gp_Pnt& P, const Standard_Real S) const;
void Transform (const gp_Trsf& T);
//! Transforms a sphere with the transformation T from class Trsf.
gp_Sphere Transformed (const gp_Trsf& T) const;
void Translate (const gp_Vec& V);
//! Translates a sphere in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Sphere Translated (const gp_Vec& V) const;
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates a sphere from the point P1 to the point P2.
gp_Sphere Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Ax3 pos;
Standard_Real radius;
};
#include <gp_Sphere.lxx>
#endif // _gp_Sphere_HeaderFile

View File

@@ -1,300 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Torus from gp
--- Purpose :
-- Describes a torus.
-- A torus is defined by its major and minor radii and
-- positioned in space with a coordinate system (a gp_Ax3
-- object) as follows:
-- - The origin of the coordinate system is the center of the torus;
-- - The surface is obtained by rotating a circle of radius
-- equal to the minor radius of the torus about the "main
-- Direction" of the coordinate system. This circle is
-- located in the plane defined by the origin, the "X
-- Direction" and the "main Direction" of the coordinate
-- system. It is centered on the "X Axis" of this coordinate
-- system, and located at a distance, from the origin of
-- this coordinate system, equal to the major radius of the torus;
-- - The "X Direction" and "Y Direction" define the
-- reference plane of the torus.
-- The coordinate system described above is the "local
-- coordinate system" of the torus.
-- Note: when a gp_Torus torus is converted into a
-- Geom_ToroidalSurface torus, some implicit properties
-- of its local coordinate system are used explicitly:
-- - its origin, "X Direction", "Y Direction" and "main
-- Direction" are used directly to define the parametric
-- directions on the torus and the origin of the parameters,
-- - its implicit orientation (right-handed or left-handed)
-- gives the orientation (direct, indirect) to the
-- Geom_ToroidalSurface torus.
-- See Also
-- gce_MakeTorus which provides functions for more
-- complex torus constructions
-- Geom_ToroidalSurface which provides additional
-- functions for constructing tori and works, in particular,
-- with the parametric equations of tori.
uses Array1OfReal from TColStd,
Ax1 from gp,
Ax2 from gp,
Ax3 from gp,
Dir from gp,
Pnt from gp,
Trsf from gp,
Vec from gp
raises ConstructionError from Standard,
DimensionError from Standard
is
Create returns Torus;
---C++: inline
--- Purpose : creates an indefinite Torus.
Create (A3 : Ax3; MajorRadius, MinorRadius : Real) returns Torus
---C++: inline
--- Purpose :
-- a torus centered on the origin of coordinate system
-- A3, with major radius MajorRadius and minor radius
-- MinorRadius, and with the reference plane defined
-- by the origin, the "X Direction" and the "Y Direction" of A3.
-- Warnings :
-- It is not forbidden to create a torus with
-- MajorRadius = MinorRadius = 0.0
-- Raises ConstructionError if MinorRadius < 0.0 or if MajorRadius < 0.0
raises ConstructionError;
SetAxis (me : in out; A1 : Ax1)
---C++: inline
--- Purpose : Modifies this torus, by redefining its local coordinate
-- system so that:
-- - its origin and "main Direction" become those of the
-- axis A1 (the "X Direction" and "Y Direction" are then recomputed).
-- Raises ConstructionError if the direction of A1 is parallel to the "XDirection"
-- of the coordinate system of the toroidal surface.
raises ConstructionError
is static;
SetLocation (me : in out; Loc : Pnt) is static;
---C++:inline
--- Purpose : Changes the location of the torus.
SetMajorRadius (me : in out; MajorRadius : Real)
---C++: inline
--- Purpose : Assigns value to the major radius of this torus.
-- Raises ConstructionError if MajorRadius - MinorRadius <= Resolution()
raises ConstructionError
is static;
SetMinorRadius (me : in out; MinorRadius : Real)
---C++: inline
--- Purpose : Assigns value to the minor radius of this torus.
-- Raises ConstructionError if MinorRadius < 0.0 or if
-- MajorRadius - MinorRadius <= Resolution from gp.
raises ConstructionError
is static;
SetPosition (me : in out; A3 : Ax3) is static;
---C++: inline
--- Purpose : Changes the local coordinate system of the surface.
Area (me) returns Real is static;
---C++: inline
--- Purpose : Computes the area of the torus.
UReverse (me : in out)
---C++: inline
---Purpose: Reverses the U parametrization of the torus
-- reversing the YAxis.
is static;
VReverse (me : in out)
---Purpose: Reverses the V parametrization of the torus
-- reversing the ZAxis.
is static;
Direct (me) returns Boolean from Standard
---C++:inline
---Purpose: returns true if the Ax3, the local coordinate system of this torus, is right handed.
is static;
Axis (me) returns Ax1 is static;
---C++:inline
--- Purpose : returns the symmetry axis of the torus.
---C++: return const&
Coefficients (me; Coef : out Array1OfReal from TColStd)
--- Purpose :
-- Computes the coefficients of the implicit equation of the surface
-- in the absolute cartesian coordinate system :
-- Coef(1) * X**4 + Coef(2) * Y**4 + Coef(3) * Z**4 +
-- Coef(4) * X**3 * Y + Coef(5) * X**3 * Z + Coef(6) * Y**3 * X +
-- Coef(7) * Y**3 * Z + Coef(8) * Z**3 * X + Coef(9) * Z**3 * Y +
-- Coef(10) * X**2 * Y**2 + Coef(11) * X**2 * Z**2 +
-- Coef(12) * Y**2 * Z**2 + Coef(13) * X**3 + Coef(14) * Y**3 +
-- Coef(15) * Z**3 + Coef(16) * X**2 * Y + Coef(17) * X**2 * Z +
-- Coef(18) * Y**2 * X + Coef(19) * Y**2 * Z + Coef(20) * Z**2 * X +
-- Coef(21) * Z**2 * Y + Coef(22) * X**2 + Coef(23) * Y**2 +
-- Coef(24) * Z**2 + Coef(25) * X * Y + Coef(26) * X * Z +
-- Coef(27) * Y * Z + Coef(28) * X + Coef(29) * Y + Coef(30) * Z +
-- Coef(31) = 0.0
-- Raises DimensionError if the length of Coef is lower than 31.
raises DimensionError
is static;
Location (me) returns Pnt is static;
---C++:inline
--- Purpose : Returns the Torus's location.
---C++: return const&
Position (me) returns Ax3 is static;
--- Purpose : Returns the local coordinates system of the torus.
---C++: inline
---C++: return const&
MajorRadius (me) returns Real is static;
--- Purpose : returns the major radius of the torus.
---C++: inline
MinorRadius (me) returns Real is static;
--- Purpose : returns the minor radius of the torus.
---C++: inline
Volume (me) returns Real is static;
--- Purpose : Computes the volume of the torus.
---C++: inline
XAxis (me) returns Ax1 is static;
---C++:inline
--- Purpose : returns the axis X of the torus.
YAxis (me) returns Ax1 is static;
---C++:inline
--- Purpose : returns the axis Y of the torus.
Mirror (me : in out; P : Pnt)
is static;
Mirrored (me; P : Pnt) returns Torus is static;
--- Purpose :
-- Performs the symmetrical transformation of a torus
-- with respect to the point P which is the center of the
-- symmetry.
Mirror (me : in out; A1 : Ax1)
is static;
Mirrored (me; A1 : Ax1) returns Torus is static;
--- Purpose :
-- Performs the symmetrical transformation of a torus with
-- respect to an axis placement which is the axis of the
-- symmetry.
Mirror (me : in out; A2 : Ax2)
is static;
Mirrored (me; A2 : Ax2) returns Torus is static;
--- Purpose :
-- Performs the symmetrical transformation of a torus with respect
-- to a plane. The axis placement A2 locates the plane of the
-- of the symmetry : (Location, XDirection, YDirection).
Rotate (me : in out; A1 : Ax1; Ang : Real)
---C++:inline
is static;
Rotated (me; A1 : Ax1; Ang : Real) returns Torus is static;
---C++:inline
--- Purpose :
-- Rotates a torus. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
Scale (me : in out; P : Pnt; S : Real) is static;
---C++:inline
Scaled (me; P : Pnt; S : Real) returns Torus is static;
---C++:inline
--- Purpose :
-- Scales a torus. S is the scaling value.
-- The absolute value of S is used to scale the torus
Transform (me : in out; T : Trsf) is static;
---C++:inline
Transformed (me; T : Trsf) returns Torus is static;
---C++:inline
--- Purpose :
-- Transforms a torus with the transformation T from class Trsf.
Translate (me : in out; V : Vec)
---C++:inline
is static;
Translated (me; V : Vec) returns Torus is static;
---C++:inline
--- Purpose :
-- Translates a torus in the direction of the vector V.
-- The magnitude of the translation is the vector's magnitude.
Translate (me : in out; P1, P2 : Pnt) is static;
---C++:inline
Translated (me; P1, P2 : Pnt) returns Torus is static;
---C++:inline
--- Purpose :
-- Translates a torus from the point P1 to the point P2.
fields
pos : Ax3;
majorRadius : Real;
minorRadius : Real;
end;

View File

@@ -12,8 +12,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <gp_Torus.ixx>
#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>
#include <gp_Pnt.hxx>
#include <gp_Torus.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_DimensionError.hxx>

253
src/gp/gp_Torus.hxx Normal file
View File

@@ -0,0 +1,253 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Torus_HeaderFile
#define _gp_Torus_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <gp_Ax3.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <gp_Ax1.hxx>
class Standard_ConstructionError;
class Standard_DimensionError;
class gp_Ax3;
class gp_Ax1;
class gp_Pnt;
class gp_Ax2;
class gp_Trsf;
class gp_Vec;
//! Describes a torus.
//! A torus is defined by its major and minor radii and
//! positioned in space with a coordinate system (a gp_Ax3
//! object) as follows:
//! - The origin of the coordinate system is the center of the torus;
//! - The surface is obtained by rotating a circle of radius
//! equal to the minor radius of the torus about the "main
//! Direction" of the coordinate system. This circle is
//! located in the plane defined by the origin, the "X
//! Direction" and the "main Direction" of the coordinate
//! system. It is centered on the "X Axis" of this coordinate
//! system, and located at a distance, from the origin of
//! this coordinate system, equal to the major radius of the torus;
//! - The "X Direction" and "Y Direction" define the
//! reference plane of the torus.
//! The coordinate system described above is the "local
//! coordinate system" of the torus.
//! Note: when a gp_Torus torus is converted into a
//! Geom_ToroidalSurface torus, some implicit properties
//! of its local coordinate system are used explicitly:
//! - its origin, "X Direction", "Y Direction" and "main
//! Direction" are used directly to define the parametric
//! directions on the torus and the origin of the parameters,
//! - its implicit orientation (right-handed or left-handed)
//! gives the orientation (direct, indirect) to the
//! Geom_ToroidalSurface torus.
//! See Also
//! gce_MakeTorus which provides functions for more
//! complex torus constructions
//! Geom_ToroidalSurface which provides additional
//! functions for constructing tori and works, in particular,
//! with the parametric equations of tori.
class gp_Torus
{
public:
DEFINE_STANDARD_ALLOC
//! creates an indefinite Torus.
gp_Torus();
//! a torus centered on the origin of coordinate system
//! A3, with major radius MajorRadius and minor radius
//! MinorRadius, and with the reference plane defined
//! by the origin, the "X Direction" and the "Y Direction" of A3.
//! Warnings :
//! It is not forbidden to create a torus with
//! MajorRadius = MinorRadius = 0.0
//! Raises ConstructionError if MinorRadius < 0.0 or if MajorRadius < 0.0
gp_Torus(const gp_Ax3& A3, const Standard_Real MajorRadius, const Standard_Real MinorRadius);
//! Modifies this torus, by redefining its local coordinate
//! system so that:
//! - its origin and "main Direction" become those of the
//! axis A1 (the "X Direction" and "Y Direction" are then recomputed).
//! Raises ConstructionError if the direction of A1 is parallel to the "XDirection"
//! of the coordinate system of the toroidal surface.
void SetAxis (const gp_Ax1& A1);
//! Changes the location of the torus.
void SetLocation (const gp_Pnt& Loc);
//! Assigns value to the major radius of this torus.
//! Raises ConstructionError if MajorRadius - MinorRadius <= Resolution()
void SetMajorRadius (const Standard_Real MajorRadius);
//! Assigns value to the minor radius of this torus.
//! Raises ConstructionError if MinorRadius < 0.0 or if
//! MajorRadius - MinorRadius <= Resolution from gp.
void SetMinorRadius (const Standard_Real MinorRadius);
//! Changes the local coordinate system of the surface.
void SetPosition (const gp_Ax3& A3);
//! Computes the area of the torus.
Standard_Real Area() const;
//! Reverses the U parametrization of the torus
//! reversing the YAxis.
void UReverse();
//! Reverses the V parametrization of the torus
//! reversing the ZAxis.
Standard_EXPORT void VReverse();
//! returns true if the Ax3, the local coordinate system of this torus, is right handed.
Standard_Boolean Direct() const;
//! returns the symmetry axis of the torus.
const gp_Ax1& Axis() const;
//! Computes the coefficients of the implicit equation of the surface
//! in the absolute cartesian coordinate system :
//! Coef(1) * X**4 + Coef(2) * Y**4 + Coef(3) * Z**4 +
//! Coef(4) * X**3 * Y + Coef(5) * X**3 * Z + Coef(6) * Y**3 * X +
//! Coef(7) * Y**3 * Z + Coef(8) * Z**3 * X + Coef(9) * Z**3 * Y +
//! Coef(10) * X**2 * Y**2 + Coef(11) * X**2 * Z**2 +
//! Coef(12) * Y**2 * Z**2 + Coef(13) * X**3 + Coef(14) * Y**3 +
//! Coef(15) * Z**3 + Coef(16) * X**2 * Y + Coef(17) * X**2 * Z +
//! Coef(18) * Y**2 * X + Coef(19) * Y**2 * Z + Coef(20) * Z**2 * X +
//! Coef(21) * Z**2 * Y + Coef(22) * X**2 + Coef(23) * Y**2 +
//! Coef(24) * Z**2 + Coef(25) * X * Y + Coef(26) * X * Z +
//! Coef(27) * Y * Z + Coef(28) * X + Coef(29) * Y + Coef(30) * Z +
//! Coef(31) = 0.0
//! Raises DimensionError if the length of Coef is lower than 31.
Standard_EXPORT void Coefficients (TColStd_Array1OfReal& Coef) const;
//! Returns the Torus's location.
const gp_Pnt& Location() const;
//! Returns the local coordinates system of the torus.
const gp_Ax3& Position() const;
//! returns the major radius of the torus.
Standard_Real MajorRadius() const;
//! returns the minor radius of the torus.
Standard_Real MinorRadius() const;
//! Computes the volume of the torus.
Standard_Real Volume() const;
//! returns the axis X of the torus.
gp_Ax1 XAxis() const;
//! returns the axis Y of the torus.
gp_Ax1 YAxis() const;
Standard_EXPORT void Mirror (const gp_Pnt& P);
//! Performs the symmetrical transformation of a torus
//! with respect to the point P which is the center of the
//! symmetry.
Standard_EXPORT gp_Torus Mirrored (const gp_Pnt& P) const;
Standard_EXPORT void Mirror (const gp_Ax1& A1);
//! Performs the symmetrical transformation of a torus with
//! respect to an axis placement which is the axis of the
//! symmetry.
Standard_EXPORT gp_Torus Mirrored (const gp_Ax1& A1) const;
Standard_EXPORT void Mirror (const gp_Ax2& A2);
//! Performs the symmetrical transformation of a torus with respect
//! to a plane. The axis placement A2 locates the plane of the
//! of the symmetry : (Location, XDirection, YDirection).
Standard_EXPORT gp_Torus Mirrored (const gp_Ax2& A2) const;
void Rotate (const gp_Ax1& A1, const Standard_Real Ang);
//! Rotates a torus. A1 is the axis of the rotation.
//! Ang is the angular value of the rotation in radians.
gp_Torus Rotated (const gp_Ax1& A1, const Standard_Real Ang) const;
void Scale (const gp_Pnt& P, const Standard_Real S);
//! Scales a torus. S is the scaling value.
//! The absolute value of S is used to scale the torus
gp_Torus Scaled (const gp_Pnt& P, const Standard_Real S) const;
void Transform (const gp_Trsf& T);
//! Transforms a torus with the transformation T from class Trsf.
gp_Torus Transformed (const gp_Trsf& T) const;
void Translate (const gp_Vec& V);
//! Translates a torus in the direction of the vector V.
//! The magnitude of the translation is the vector's magnitude.
gp_Torus Translated (const gp_Vec& V) const;
void Translate (const gp_Pnt& P1, const gp_Pnt& P2);
//! Translates a torus from the point P1 to the point P2.
gp_Torus Translated (const gp_Pnt& P1, const gp_Pnt& P2) const;
protected:
private:
gp_Ax3 pos;
Standard_Real majorRadius;
Standard_Real minorRadius;
};
#include <gp_Torus.lxx>
#endif // _gp_Torus_HeaderFile

View File

@@ -1,386 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Trsf from gp
--- Purpose: Defines a non-persistent transformation in 3D space.
-- The following transformations are implemented :
-- . Translation, Rotation, Scale
-- . Symmetry with respect to a point, a line, a plane.
-- Complex transformations can be obtained by combining the
-- previous elementary transformations using the method
-- Multiply.
-- The transformations can be represented as follow :
--
-- V1 V2 V3 T XYZ XYZ
-- | a11 a12 a13 a14 | | x | | x'|
-- | a21 a22 a23 a24 | | y | | y'|
-- | a31 a32 a33 a34 | | z | = | z'|
-- | 0 0 0 1 | | 1 | | 1 |
--
-- where {V1, V2, V3} defines the vectorial part of the
-- transformation and T defines the translation part of the
-- transformation.
-- This transformation never change the nature of the objects.
uses Ax1 from gp,
Ax2 from gp,
Ax3 from gp,
Mat from gp,
Pnt from gp,
TrsfForm from gp,
Vec from gp,
XYZ from gp,
Trsf2d from gp,
Quaternion from gp
raises ConstructionError from Standard,
OutOfRange from Standard
is
Create returns Trsf from gp;
---C++: inline
--- Purpose : Returns the identity transformation.
Create(T : Trsf2d from gp) returns Trsf from gp;
---Purpose: Creates a 3D transformation from the 2D transformation T.
-- The resulting transformation has a homogeneous
-- vectorial part, V3, and a translation part, T3, built from T:
-- a11 a12
-- 0 a13
-- V3 = a21 a22 0 T3
-- = a23
-- 0 0 1.
-- 0
-- It also has the same scale factor as T. This
-- guarantees (by projection) that the transformation
-- which would be performed by T in a plane (2D space)
-- is performed by the resulting transformation in the xOy
-- plane of the 3D space, (i.e. in the plane defined by the
-- origin (0., 0., 0.) and the vectors DX (1., 0., 0.), and DY
-- (0., 1., 0.)). The scale factor is applied to the entire space.
SetMirror (me : in out; P : Pnt) is static;
---C++: inline
--- Purpose :
-- Makes the transformation into a symmetrical transformation.
-- P is the center of the symmetry.
SetMirror (me : in out; A1 : Ax1) is static;
--- Purpose :
-- Makes the transformation into a symmetrical transformation.
-- A1 is the center of the axial symmetry.
SetMirror (me : in out; A2 : Ax2) is static;
--- Purpose :
-- Makes the transformation into a symmetrical transformation.
-- A2 is the center of the planar symmetry
-- and defines the plane of symmetry by its origin, "X
-- Direction" and "Y Direction".
SetRotation (me : in out; A1 : Ax1; Ang : Real) is static;
--- Purpose :
-- Changes the transformation into a rotation.
-- A1 is the rotation axis and Ang is the angular value of the
-- rotation in radians.
SetRotation (me : in out; R : Quaternion) is static;
--- Purpose :
-- Changes the transformation into a rotation defined by quaternion.
-- Note that rotation is performed around origin, i.e.
-- no translation is involved.
SetScale (me : in out; P : Pnt; S : Real)
--- Purpose :
-- Changes the transformation into a scale.
-- P is the center of the scale and S is the scaling value.
-- Raises ConstructionError If <S> is null.
raises
ConstructionError from Standard
is static;
SetDisplacement (me : in out; FromSystem1, ToSystem2 : Ax3) is static;
--- Purpose :
-- Modifies this transformation so that it transforms the
-- coordinate system defined by FromSystem1 into the
-- one defined by ToSystem2. After this modification, this
-- transformation transforms:
-- - the origin of FromSystem1 into the origin of ToSystem2,
-- - the "X Direction" of FromSystem1 into the "X
-- Direction" of ToSystem2,
-- - the "Y Direction" of FromSystem1 into the "Y
-- Direction" of ToSystem2, and
-- - the "main Direction" of FromSystem1 into the "main
-- Direction" of ToSystem2.
-- Warning
-- When you know the coordinates of a point in one
-- coordinate system and you want to express these
-- coordinates in another one, do not use the
-- transformation resulting from this function. Use the
-- transformation that results from SetTransformation instead.
-- SetDisplacement and SetTransformation create
-- related transformations: the vectorial part of one is the
-- inverse of the vectorial part of the other.
SetTransformation (me : in out; FromSystem1, ToSystem2 : Ax3) is static;
--- Purpose : Modifies this transformation so that it transforms the
-- coordinates of any point, (x, y, z), relative to a source
-- coordinate system into the coordinates (x', y', z') which
-- are relative to a target coordinate system, but which
-- represent the same point
-- The transformation is from the coordinate
-- system "FromSystem1" to the coordinate system "ToSystem2".
-- Example :
-- In a C++ implementation :
-- Real x1, y1, z1; // are the coordinates of a point in the
-- // local system FromSystem1
-- Real x2, y2, z2; // are the coordinates of a point in the
-- // local system ToSystem2
-- gp_Pnt P1 (x1, y1, z1)
-- Trsf T;
-- T.SetTransformation (FromSystem1, ToSystem2);
-- gp_Pnt P2 = P1.Transformed (T);
-- P2.Coord (x2, y2, z2);
SetTransformation (me : in out; ToSystem : Ax3) is static;
--- Purpose : Modifies this transformation so that it transforms the
-- coordinates of any point, (x, y, z), relative to a source
-- coordinate system into the coordinates (x', y', z') which
-- are relative to a target coordinate system, but which
-- represent the same point
-- The transformation is from the default coordinate system
-- {P(0.,0.,0.), VX (1.,0.,0.), VY (0.,1.,0.), VZ (0., 0. ,1.) }
-- to the local coordinate system defined with the Ax3 ToSystem.
-- Use in the same way as the previous method. FromSystem1 is
-- defaulted to the absolute coordinate system.
SetTransformation (me : in out; R : Quaternion; T : Vec) is static;
--- Purpose :
-- Sets transformation by directly specified rotation and translation.
SetTranslation (me : in out; V : Vec) is static;
---C++: inline
--- Purpose :
-- Changes the transformation into a translation.
-- V is the vector of the translation.
SetTranslation (me : in out; P1, P2 : Pnt) is static;
---C++: inline
--- Purpose :
-- Makes the transformation into a translation where the translation vector
-- is the vector (P1, P2) defined from point P1 to point P2.
SetTranslationPart (me : in out; V : Vec) is static;
--- Purpose : Replaces the translation vector with the vector V.
SetScaleFactor (me : in out; S : Real)
--- Purpose : Modifies the scale factor.
-- Raises ConstructionError If S is null.
raises
ConstructionError from Standard
is static;
SetForm (me : in out; P : TrsfForm from gp) is static;
SetValues(me : in out;
a11, a12, a13, a14,
a21, a22, a23, a24,
a31, a32, a33, a34 : Real)
---Purpose: Sets the coefficients of the transformation. The
-- transformation of the point x,y,z is the point
-- x',y',z' with :
--
-- x' = a11 x + a12 y + a13 z + a14
-- y' = a21 x + a22 y + a23 z + a24
-- z' = a31 x + a32 y + a33 z + a34
--
-- The method Value(i,j) will return aij.
-- Raises ConstructionError if the determinant of the aij is null.
-- The matrix is orthogonalized before future using.
raises
ConstructionError from Standard
is static;
IsNegative (me) returns Boolean is static;
---C++: inline
--- Purpose : Returns true if the determinant of the vectorial part of
-- this transformation is negative.
Form (me) returns TrsfForm is static;
--- Purpose :
-- Returns the nature of the transformation. It can be: an
-- identity transformation, a rotation, a translation, a mirror
-- transformation (relative to a point, an axis or a plane), a
-- scaling transformation, or a compound transformation.
---C++: inline
ScaleFactor (me) returns Real is static;
--- Purpose : Returns the scale factor.
---C++: inline
TranslationPart (me) returns XYZ is static;
--- Purpose :
-- Returns the translation part of the transformation's matrix
---C++: inline
---C++: return const&
GetRotation (me; theAxis : out XYZ from gp;
theAngle: out Real from Standard)
returns Boolean from Standard is static;
--- Purpose :
-- Returns the boolean True if there is non-zero rotation.
-- In the presence of rotation, the output parameters store the axis
-- and the angle of rotation. The method always returns positive
-- value "theAngle", i.e., 0. < theAngle <= PI.
-- Note that this rotation is defined only by the vectorial part of
-- the transformation; generally you would need to check also the
-- translational part to obtain the axis (gp_Ax1) of rotation.
GetRotation (me) returns Quaternion from gp is static;
--- Purpose :
-- Returns quaternion representing rotational part of the transformation.
VectorialPart (me) returns Mat is static;
--- Purpose :
-- Returns the vectorial part of the transformation. It is
-- a 3*3 matrix which includes the scale factor.
HVectorialPart (me) returns Mat is static;
--- Purpose :
-- Computes the homogeneous vectorial part of the transformation.
-- It is a 3*3 matrix which doesn't include the scale factor.
-- In other words, the vectorial part of this transformation is equal
-- to its homogeneous vectorial part, multiplied by the scale factor.
-- The coefficients of this matrix must be multiplied by the
-- scale factor to obtain the coefficients of the transformation.
---C++: inline
---C++: return const&
Value (me; Row, Col : Integer) returns Real
---C++: inline
--- Purpose :
-- Returns the coefficients of the transformation's matrix.
-- It is a 3 rows * 4 columns matrix.
-- This coefficient includes the scale factor.
-- Raises OutOfRanged if Row < 1 or Row > 3 or Col < 1 or Col > 4
raises OutOfRange
is static;
Invert (me : in out) raises ConstructionError is static;
Inverted (me) returns Trsf raises ConstructionError is static;
--- Purpose :
-- Computes the reverse transformation
-- Raises an exception if the matrix of the transformation
-- is not inversible, it means that the scale factor is lower
-- or equal to Resolution from package gp.
-- Computes the transformation composed with T and <me>.
-- In a C++ implementation you can also write Tcomposed = <me> * T.
--- Example :
-- Trsf T1, T2, Tcomp; ...............
-- Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
-- Pnt P1(10.,3.,4.);
-- Pnt P2 = P1.Transformed(Tcomp); //using Tcomp
-- Pnt P3 = P1.Transformed(T1); //using T1 then T2
-- P3.Transform(T2); // P3 = P2 !!!
---C++: inline
Multiplied (me; T : Trsf) returns Trsf is static;
---C++: inline
---C++: alias operator *
-- Computes the transformation composed from T and <me>.
-- In a C++ implementation you can also write Tcomposed = <me> * T.
-- Example :
-- Trsf T1, T2, Tcomp; ...............
-- //composition :
-- Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
-- // transformation of a point
-- Pnt P1(10.,3.,4.);
-- Pnt P2 = P1.Transformed(Tcomp); //using Tcomp
-- Pnt P3 = P1.Transformed(T1); //using T1 then T2
-- P3.Transform(T2); // P3 = P2 !!!
Multiply (me : in out; T : Trsf) is static;
---C++: alias operator *=
--- Purpose :
-- Computes the transformation composed with <me> and T.
-- <me> = <me> * T
PreMultiply (me : in out; T : Trsf) is static;
--- Purpose :
-- Computes the transformation composed with <me> and T.
-- <me> = T * <me>
Power (me : in out; N : Integer) raises ConstructionError is static;
Powered (me; N : Integer) returns Trsf
---C++: inline
--- Purpose :
-- Computes the following composition of transformations
-- <me> * <me> * .......* <me>, N time.
-- if N = 0 <me> = Identity
-- if N < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().
--
-- Raises if N < 0 and if the matrix of the transformation not
-- inversible.
raises ConstructionError
is static;
Transforms (me; X, Y, Z : out Real) is static;
---C++: inline
Transforms (me; Coord : out XYZ) is static;
---C++: inline
--- Purpose : Transformation of a triplet XYZ with a Trsf
Orthogonalize(me: in out)
is protected;
--- Purpose : Makes orthogonalization of "matrix"
fields
scale : Real;
shape : TrsfForm;
matrix : Mat;
loc : XYZ;
friends
class GTrsf
end;

View File

@@ -19,16 +19,26 @@
#define No_Standard_OutOfRange
#include <gp_Trsf.ixx>
#include <gp.hxx>
#include <Standard_ConstructionError.hxx>
#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax3.hxx>
#include <gp_GTrsf.hxx>
#include <gp_Mat.hxx>
#include <gp_Pnt.hxx>
#include <gp_Quaternion.hxx>
#include <gp_Trsf.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Vec.hxx>
#include <gp_XYZ.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
//=======================================================================
//function : gp_Trsf
//purpose : Constructor from 2d
//=======================================================================
gp_Trsf::gp_Trsf (const gp_Trsf2d& T) :
scale(T.ScaleFactor()),
shape(T.Form()),

355
src/gp/gp_Trsf.hxx Normal file
View File

@@ -0,0 +1,355 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Trsf_HeaderFile
#define _gp_Trsf_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <gp_TrsfForm.hxx>
#include <gp_Mat.hxx>
#include <gp_XYZ.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class gp_GTrsf;
class gp_Trsf2d;
class gp_Pnt;
class gp_Ax1;
class gp_Ax2;
class gp_Quaternion;
class gp_Ax3;
class gp_Vec;
class gp_XYZ;
class gp_Mat;
//! Defines a non-persistent transformation in 3D space.
//! The following transformations are implemented :
//! . Translation, Rotation, Scale
//! . Symmetry with respect to a point, a line, a plane.
//! Complex transformations can be obtained by combining the
//! previous elementary transformations using the method
//! Multiply.
//! The transformations can be represented as follow :
//!
//! V1 V2 V3 T XYZ XYZ
//! | a11 a12 a13 a14 | | x | | x'|
//! | a21 a22 a23 a24 | | y | | y'|
//! | a31 a32 a33 a34 | | z | = | z'|
//! | 0 0 0 1 | | 1 | | 1 |
//!
//! where {V1, V2, V3} defines the vectorial part of the
//! transformation and T defines the translation part of the
//! transformation.
//! This transformation never change the nature of the objects.
class gp_Trsf
{
public:
DEFINE_STANDARD_ALLOC
//! Returns the identity transformation.
gp_Trsf();
//! Creates a 3D transformation from the 2D transformation T.
//! The resulting transformation has a homogeneous
//! vectorial part, V3, and a translation part, T3, built from T:
//! a11 a12
//! 0 a13
//! V3 = a21 a22 0 T3
//! = a23
//! 0 0 1.
//! 0
//! It also has the same scale factor as T. This
//! guarantees (by projection) that the transformation
//! which would be performed by T in a plane (2D space)
//! is performed by the resulting transformation in the xOy
//! plane of the 3D space, (i.e. in the plane defined by the
//! origin (0., 0., 0.) and the vectors DX (1., 0., 0.), and DY
//! (0., 1., 0.)). The scale factor is applied to the entire space.
Standard_EXPORT gp_Trsf(const gp_Trsf2d& T);
//! Makes the transformation into a symmetrical transformation.
//! P is the center of the symmetry.
void SetMirror (const gp_Pnt& P);
//! Makes the transformation into a symmetrical transformation.
//! A1 is the center of the axial symmetry.
Standard_EXPORT void SetMirror (const gp_Ax1& A1);
//! Makes the transformation into a symmetrical transformation.
//! A2 is the center of the planar symmetry
//! and defines the plane of symmetry by its origin, "X
//! Direction" and "Y Direction".
Standard_EXPORT void SetMirror (const gp_Ax2& A2);
//! Changes the transformation into a rotation.
//! A1 is the rotation axis and Ang is the angular value of the
//! rotation in radians.
Standard_EXPORT void SetRotation (const gp_Ax1& A1, const Standard_Real Ang);
//! Changes the transformation into a rotation defined by quaternion.
//! Note that rotation is performed around origin, i.e.
//! no translation is involved.
Standard_EXPORT void SetRotation (const gp_Quaternion& R);
//! Changes the transformation into a scale.
//! P is the center of the scale and S is the scaling value.
//! Raises ConstructionError If <S> is null.
Standard_EXPORT void SetScale (const gp_Pnt& P, const Standard_Real S);
//! Modifies this transformation so that it transforms the
//! coordinate system defined by FromSystem1 into the
//! one defined by ToSystem2. After this modification, this
//! transformation transforms:
//! - the origin of FromSystem1 into the origin of ToSystem2,
//! - the "X Direction" of FromSystem1 into the "X
//! Direction" of ToSystem2,
//! - the "Y Direction" of FromSystem1 into the "Y
//! Direction" of ToSystem2, and
//! - the "main Direction" of FromSystem1 into the "main
//! Direction" of ToSystem2.
//! Warning
//! When you know the coordinates of a point in one
//! coordinate system and you want to express these
//! coordinates in another one, do not use the
//! transformation resulting from this function. Use the
//! transformation that results from SetTransformation instead.
//! SetDisplacement and SetTransformation create
//! related transformations: the vectorial part of one is the
//! inverse of the vectorial part of the other.
Standard_EXPORT void SetDisplacement (const gp_Ax3& FromSystem1, const gp_Ax3& ToSystem2);
//! Modifies this transformation so that it transforms the
//! coordinates of any point, (x, y, z), relative to a source
//! coordinate system into the coordinates (x', y', z') which
//! are relative to a target coordinate system, but which
//! represent the same point
//! The transformation is from the coordinate
//! system "FromSystem1" to the coordinate system "ToSystem2".
//! Example :
//! In a C++ implementation :
//! Real x1, y1, z1; // are the coordinates of a point in the
//! // local system FromSystem1
//! Real x2, y2, z2; // are the coordinates of a point in the
//! // local system ToSystem2
//! gp_Pnt P1 (x1, y1, z1)
//! Trsf T;
//! T.SetTransformation (FromSystem1, ToSystem2);
//! gp_Pnt P2 = P1.Transformed (T);
//! P2.Coord (x2, y2, z2);
Standard_EXPORT void SetTransformation (const gp_Ax3& FromSystem1, const gp_Ax3& ToSystem2);
//! Modifies this transformation so that it transforms the
//! coordinates of any point, (x, y, z), relative to a source
//! coordinate system into the coordinates (x', y', z') which
//! are relative to a target coordinate system, but which
//! represent the same point
//! The transformation is from the default coordinate system
//! {P(0.,0.,0.), VX (1.,0.,0.), VY (0.,1.,0.), VZ (0., 0. ,1.) }
//! to the local coordinate system defined with the Ax3 ToSystem.
//! Use in the same way as the previous method. FromSystem1 is
//! defaulted to the absolute coordinate system.
Standard_EXPORT void SetTransformation (const gp_Ax3& ToSystem);
//! Sets transformation by directly specified rotation and translation.
Standard_EXPORT void SetTransformation (const gp_Quaternion& R, const gp_Vec& T);
//! Changes the transformation into a translation.
//! V is the vector of the translation.
void SetTranslation (const gp_Vec& V);
//! Makes the transformation into a translation where the translation vector
//! is the vector (P1, P2) defined from point P1 to point P2.
void SetTranslation (const gp_Pnt& P1, const gp_Pnt& P2);
//! Replaces the translation vector with the vector V.
Standard_EXPORT void SetTranslationPart (const gp_Vec& V);
//! Modifies the scale factor.
//! Raises ConstructionError If S is null.
Standard_EXPORT void SetScaleFactor (const Standard_Real S);
Standard_EXPORT void SetForm (const gp_TrsfForm P);
//! Sets the coefficients of the transformation. The
//! transformation of the point x,y,z is the point
//! x',y',z' with :
//!
//! x' = a11 x + a12 y + a13 z + a14
//! y' = a21 x + a22 y + a23 z + a24
//! z' = a31 x + a32 y + a33 z + a34
//!
//! The method Value(i,j) will return aij.
//! Raises ConstructionError if the determinant of the aij is null.
//! The matrix is orthogonalized before future using.
Standard_EXPORT void SetValues (const Standard_Real a11, const Standard_Real a12, const Standard_Real a13, const Standard_Real a14, const Standard_Real a21, const Standard_Real a22, const Standard_Real a23, const Standard_Real a24, const Standard_Real a31, const Standard_Real a32, const Standard_Real a33, const Standard_Real a34);
//! Returns true if the determinant of the vectorial part of
//! this transformation is negative.
Standard_Boolean IsNegative() const;
//! Returns the nature of the transformation. It can be: an
//! identity transformation, a rotation, a translation, a mirror
//! transformation (relative to a point, an axis or a plane), a
//! scaling transformation, or a compound transformation.
gp_TrsfForm Form() const;
//! Returns the scale factor.
Standard_Real ScaleFactor() const;
//! Returns the translation part of the transformation's matrix
const gp_XYZ& TranslationPart() const;
//! Returns the boolean True if there is non-zero rotation.
//! In the presence of rotation, the output parameters store the axis
//! and the angle of rotation. The method always returns positive
//! value "theAngle", i.e., 0. < theAngle <= PI.
//! Note that this rotation is defined only by the vectorial part of
//! the transformation; generally you would need to check also the
//! translational part to obtain the axis (gp_Ax1) of rotation.
Standard_EXPORT Standard_Boolean GetRotation (gp_XYZ& theAxis, Standard_Real& theAngle) const;
//! Returns quaternion representing rotational part of the transformation.
Standard_EXPORT gp_Quaternion GetRotation() const;
//! Returns the vectorial part of the transformation. It is
//! a 3*3 matrix which includes the scale factor.
Standard_EXPORT gp_Mat VectorialPart() const;
//! Computes the homogeneous vectorial part of the transformation.
//! It is a 3*3 matrix which doesn't include the scale factor.
//! In other words, the vectorial part of this transformation is equal
//! to its homogeneous vectorial part, multiplied by the scale factor.
//! The coefficients of this matrix must be multiplied by the
//! scale factor to obtain the coefficients of the transformation.
const gp_Mat& HVectorialPart() const;
//! Returns the coefficients of the transformation's matrix.
//! It is a 3 rows * 4 columns matrix.
//! This coefficient includes the scale factor.
//! Raises OutOfRanged if Row < 1 or Row > 3 or Col < 1 or Col > 4
Standard_Real Value (const Standard_Integer Row, const Standard_Integer Col) const;
Standard_EXPORT void Invert();
//! Computes the reverse transformation
//! Raises an exception if the matrix of the transformation
//! is not inversible, it means that the scale factor is lower
//! or equal to Resolution from package gp.
//! Computes the transformation composed with T and <me>.
//! In a C++ implementation you can also write Tcomposed = <me> * T.
//! Example :
//! Trsf T1, T2, Tcomp; ...............
//! Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
//! Pnt P1(10.,3.,4.);
//! Pnt P2 = P1.Transformed(Tcomp); //using Tcomp
//! Pnt P3 = P1.Transformed(T1); //using T1 then T2
//! P3.Transform(T2); // P3 = P2 !!!
gp_Trsf Inverted() const;
gp_Trsf Multiplied (const gp_Trsf& T) const;
gp_Trsf operator * (const gp_Trsf& T) const
{
return Multiplied(T);
}
//! Computes the transformation composed with <me> and T.
//! <me> = <me> * T
Standard_EXPORT void Multiply (const gp_Trsf& T);
void operator *= (const gp_Trsf& T)
{
Multiply(T);
}
//! Computes the transformation composed with <me> and T.
//! <me> = T * <me>
Standard_EXPORT void PreMultiply (const gp_Trsf& T);
Standard_EXPORT void Power (const Standard_Integer N);
//! Computes the following composition of transformations
//! <me> * <me> * .......* <me>, N time.
//! if N = 0 <me> = Identity
//! if N < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().
//!
//! Raises if N < 0 and if the matrix of the transformation not
//! inversible.
gp_Trsf Powered (const Standard_Integer N) const;
void Transforms (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
//! Transformation of a triplet XYZ with a Trsf
void Transforms (gp_XYZ& Coord) const;
friend class gp_GTrsf;
protected:
//! Makes orthogonalization of "matrix"
Standard_EXPORT void Orthogonalize();
private:
Standard_Real scale;
gp_TrsfForm shape;
gp_Mat matrix;
gp_XYZ loc;
};
#include <gp_Trsf.lxx>
#endif // _gp_Trsf_HeaderFile

View File

@@ -1,283 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Trsf2d from gp
--- Purpose :
-- Defines a non-persistent transformation in 2D space.
-- The following transformations are implemented :
-- . Translation, Rotation, Scale
-- . Symmetry with respect to a point and a line.
-- Complex transformations can be obtained by combining the
-- previous elementary transformations using the method Multiply.
-- The transformations can be represented as follow :
--
-- V1 V2 T XY XY
-- | a11 a12 a13 | | x | | x'|
-- | a21 a22 a23 | | y | | y'|
-- | 0 0 1 | | 1 | | 1 |
--
-- where {V1, V2} defines the vectorial part of the transformation
-- and T defines the translation part of the transformation.
-- This transformation never change the nature of the objects.
uses Ax2d from gp,
Mat2d from gp,
Pnt2d from gp,
TrsfForm from gp,
Trsf from gp,
Vec2d from gp,
XY from gp
raises ConstructionError from Standard,
OutOfRange from Standard
is
Create returns Trsf2d from gp;
---C++: inline
--- Purpose : Returns identity transformation.
Create(T : Trsf from gp)
returns Trsf2d from gp
raises ConstructionError;
---C++: inline
---Purpose: Creates a 2d transformation in the XY plane from a
-- 3d transformation .
SetMirror (me : in out; P : Pnt2d) is static;
---C++: inline
--- Purpose :
-- Changes the transformation into a symmetrical transformation.
-- P is the center of the symmetry.
SetMirror (me : in out; A : Ax2d) is static;
--- Purpose :
-- Changes the transformation into a symmetrical transformation.
-- A is the center of the axial symmetry.
SetRotation (me : in out; P : Pnt2d; Ang : Real) is static;
---C++: inline
--- Purpose :
-- Changes the transformation into a rotation.
-- P is the rotation's center and Ang is the angular value of the
-- rotation in radian.
SetScale (me : in out; P : Pnt2d; S : Real) is static;
---C++: inline
--- Purpose :
-- Changes the transformation into a scale.
-- P is the center of the scale and S is the scaling value.
SetTransformation (me : in out; FromSystem1, ToSystem2 : Ax2d) is static;
--- Purpose :
-- Changes a transformation allowing passage from the coordinate
-- system "FromSystem1" to the coordinate system "ToSystem2".
SetTransformation (me : in out; ToSystem : Ax2d) is static;
--- Purpose :
-- Changes the transformation allowing passage from the basic
-- coordinate system
-- {P(0.,0.,0.), VX (1.,0.,0.), VY (0.,1.,0.)}
-- to the local coordinate system defined with the Ax2d ToSystem.
SetTranslation (me : in out; V : Vec2d) is static;
---C++: inline
--- Purpose :
-- Changes the transformation into a translation.
-- V is the vector of the translation.
SetTranslation (me: in out; P1, P2 : Pnt2d) is static;
---C++: inline
--- Purpose :
-- Makes the transformation into a translation from
-- the point P1 to the point P2.
SetTranslationPart (me : in out; V : Vec2d) is static;
--- Purpose : Replaces the translation vector with V.
SetScaleFactor (me : in out; S : Real) is static;
--- Purpose : Modifies the scale factor.
IsNegative (me) returns Boolean is static;
--- Purpose : Returns true if the determinant of the vectorial part of
-- this transformation is negative..
---C++: inline
Form (me) returns TrsfForm is static;
--- Purpose :
-- Returns the nature of the transformation. It can be an
-- identity transformation, a rotation, a translation, a mirror
-- (relative to a point or an axis), a scaling transformation,
-- or a compound transformation.
---C++: inline
ScaleFactor (me) returns Real is static;
--- Purpose : Returns the scale factor.
---C++: inline
TranslationPart (me) returns XY is static;
--- Purpose :
-- Returns the translation part of the transformation's matrix
---C++: inline
---C++: return const&
VectorialPart (me) returns Mat2d is static;
--- Purpose :
-- Returns the vectorial part of the transformation. It is a
-- 2*2 matrix which includes the scale factor.
HVectorialPart (me) returns Mat2d is static;
--- Purpose :
-- Returns the homogeneous vectorial part of the transformation.
-- It is a 2*2 matrix which doesn't include the scale factor.
-- The coefficients of this matrix must be multiplied by the
-- scale factor to obtain the coefficients of the transformation.
---C++: inline
---C++: return const&
RotationPart (me) returns Real is static;
--- Purpose :
-- Returns the angle corresponding to the rotational component
-- of the transformation matrix (operation opposite to SetRotation()).
Value (me; Row, Col : Integer) returns Real
---C++: inline
--- Purpose :
-- Returns the coefficients of the transformation's matrix.
-- It is a 2 rows * 3 columns matrix.
-- Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3
raises OutOfRange
is static;
Invert (me : in out) raises ConstructionError is static;
Inverted (me) returns Trsf2d raises ConstructionError is static;
--- Purpose :
-- Computes the reverse transformation.
-- Raises an exception if the matrix of the transformation
-- is not inversible, it means that the scale factor is lower
-- or equal to Resolution from package gp.
---C++: inline
Multiplied (me; T : Trsf2d) returns Trsf2d is static;
---C++: inline
---C++: alias operator *
-- Computes the transformation composed from <T> and <me>.
-- In a C++ implementation you can also write Tcomposed = <me> * T.
-- Example :
-- Trsf2d T1, T2, Tcomp; ...............
-- //composition :
-- Tcomp = T2.Multiplied(T1); // or (Tcomp = T2 * T1)
-- // transformation of a point
-- Pnt2d P1(10.,3.,4.);
-- Pnt2d P2 = P1.Transformed(Tcomp); //using Tcomp
-- Pnt2d P3 = P1.Transformed(T1); //using T1 then T2
-- P3.Transform(T2); // P3 = P2 !!!
Multiply (me : in out; T : Trsf2d) is static;
---C++: alias operator *=
--- Purpose :
-- Computes the transformation composed from <me> and T.
-- <me> = <me> * T
PreMultiply (me : in out; T : Trsf2d) is static;
--- Purpose :
-- Computes the transformation composed from <me> and T.
-- <me> = T * <me>
Power (me : in out; N : Integer) raises ConstructionError is static;
Powered (me : in out; N : Integer) returns Trsf2d
raises ConstructionError
is static;
--- Purpose :
-- Computes the following composition of transformations
-- <me> * <me> * .......* <me>, N time.
-- if N = 0 <me> = Identity
-- if N < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().
--
-- Raises if N < 0 and if the matrix of the transformation not
-- inversible.
---C++: inline
Transforms (me; X, Y : out Real) is static;
---C++: inline
Transforms (me; Coord : out XY) is static;
---C++: inline
--- Purpose : Transforms a doublet XY with a Trsf2d
SetValues(me : in out;
a11, a12, a13, a21, a22, a23 : Real)
---Purpose: Sets the coefficients of the transformation. The
-- transformation of the point x,y is the point
-- x',y' with :
--
-- x' = a11 x + a12 y + a13
-- y' = a21 x + a22 y + a23
--
-- The method Value(i,j) will return aij.
-- Raises ConstructionError if the determinant of the aij is null.
-- If the matrix as not a uniform scale it will be orthogonalized before future using.
raises
ConstructionError from Standard
is static;
Orthogonalize(me: in out)
is protected;
--- Purpose : Makes orthogonalization of "matrix"
fields
scale : Real;
shape : TrsfForm;
matrix : Mat2d;
loc : XY;
friends
class GTrsf2d
end;

View File

@@ -16,9 +16,18 @@
#define No_Standard_OutOfRange
#include <gp_Trsf2d.ixx>
#include <gp.hxx>
#include <gp_Ax2d.hxx>
#include <gp_GTrsf2d.hxx>
#include <gp_Mat2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf.hxx>
#include <gp_Trsf2d.hxx>
#include <gp_Vec2d.hxx>
#include <gp_XY.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
void gp_Trsf2d::SetMirror (const gp_Ax2d& A)
{

250
src/gp/gp_Trsf2d.hxx Normal file
View File

@@ -0,0 +1,250 @@
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Trsf2d_HeaderFile
#define _gp_Trsf2d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <gp_TrsfForm.hxx>
#include <gp_Mat2d.hxx>
#include <gp_XY.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class gp_GTrsf2d;
class gp_Trsf;
class gp_Pnt2d;
class gp_Ax2d;
class gp_Vec2d;
class gp_XY;
class gp_Mat2d;
//! Defines a non-persistent transformation in 2D space.
//! The following transformations are implemented :
//! . Translation, Rotation, Scale
//! . Symmetry with respect to a point and a line.
//! Complex transformations can be obtained by combining the
//! previous elementary transformations using the method Multiply.
//! The transformations can be represented as follow :
//!
//! V1 V2 T XY XY
//! | a11 a12 a13 | | x | | x'|
//! | a21 a22 a23 | | y | | y'|
//! | 0 0 1 | | 1 | | 1 |
//!
//! where {V1, V2} defines the vectorial part of the transformation
//! and T defines the translation part of the transformation.
//! This transformation never change the nature of the objects.
class gp_Trsf2d
{
public:
DEFINE_STANDARD_ALLOC
//! Returns identity transformation.
gp_Trsf2d();
//! Creates a 2d transformation in the XY plane from a
//! 3d transformation .
gp_Trsf2d(const gp_Trsf& T);
//! Changes the transformation into a symmetrical transformation.
//! P is the center of the symmetry.
void SetMirror (const gp_Pnt2d& P);
//! Changes the transformation into a symmetrical transformation.
//! A is the center of the axial symmetry.
Standard_EXPORT void SetMirror (const gp_Ax2d& A);
//! Changes the transformation into a rotation.
//! P is the rotation's center and Ang is the angular value of the
//! rotation in radian.
void SetRotation (const gp_Pnt2d& P, const Standard_Real Ang);
//! Changes the transformation into a scale.
//! P is the center of the scale and S is the scaling value.
void SetScale (const gp_Pnt2d& P, const Standard_Real S);
//! Changes a transformation allowing passage from the coordinate
//! system "FromSystem1" to the coordinate system "ToSystem2".
Standard_EXPORT void SetTransformation (const gp_Ax2d& FromSystem1, const gp_Ax2d& ToSystem2);
//! Changes the transformation allowing passage from the basic
//! coordinate system
//! {P(0.,0.,0.), VX (1.,0.,0.), VY (0.,1.,0.)}
//! to the local coordinate system defined with the Ax2d ToSystem.
Standard_EXPORT void SetTransformation (const gp_Ax2d& ToSystem);
//! Changes the transformation into a translation.
//! V is the vector of the translation.
void SetTranslation (const gp_Vec2d& V);
//! Makes the transformation into a translation from
//! the point P1 to the point P2.
void SetTranslation (const gp_Pnt2d& P1, const gp_Pnt2d& P2);
//! Replaces the translation vector with V.
Standard_EXPORT void SetTranslationPart (const gp_Vec2d& V);
//! Modifies the scale factor.
Standard_EXPORT void SetScaleFactor (const Standard_Real S);
//! Returns true if the determinant of the vectorial part of
//! this transformation is negative..
Standard_Boolean IsNegative() const;
//! Returns the nature of the transformation. It can be an
//! identity transformation, a rotation, a translation, a mirror
//! (relative to a point or an axis), a scaling transformation,
//! or a compound transformation.
gp_TrsfForm Form() const;
//! Returns the scale factor.
Standard_Real ScaleFactor() const;
//! Returns the translation part of the transformation's matrix
const gp_XY& TranslationPart() const;
//! Returns the vectorial part of the transformation. It is a
//! 2*2 matrix which includes the scale factor.
Standard_EXPORT gp_Mat2d VectorialPart() const;
//! Returns the homogeneous vectorial part of the transformation.
//! It is a 2*2 matrix which doesn't include the scale factor.
//! The coefficients of this matrix must be multiplied by the
//! scale factor to obtain the coefficients of the transformation.
const gp_Mat2d& HVectorialPart() const;
//! Returns the angle corresponding to the rotational component
//! of the transformation matrix (operation opposite to SetRotation()).
Standard_EXPORT Standard_Real RotationPart() const;
//! Returns the coefficients of the transformation's matrix.
//! It is a 2 rows * 3 columns matrix.
//! Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 3
Standard_Real Value (const Standard_Integer Row, const Standard_Integer Col) const;
Standard_EXPORT void Invert();
//! Computes the reverse transformation.
//! Raises an exception if the matrix of the transformation
//! is not inversible, it means that the scale factor is lower
//! or equal to Resolution from package gp.
gp_Trsf2d Inverted() const;
gp_Trsf2d Multiplied (const gp_Trsf2d& T) const;
gp_Trsf2d operator * (const gp_Trsf2d& T) const
{
return Multiplied(T);
}
//! Computes the transformation composed from <me> and T.
//! <me> = <me> * T
Standard_EXPORT void Multiply (const gp_Trsf2d& T);
void operator *= (const gp_Trsf2d& T)
{
Multiply(T);
}
//! Computes the transformation composed from <me> and T.
//! <me> = T * <me>
Standard_EXPORT void PreMultiply (const gp_Trsf2d& T);
Standard_EXPORT void Power (const Standard_Integer N);
//! Computes the following composition of transformations
//! <me> * <me> * .......* <me>, N time.
//! if N = 0 <me> = Identity
//! if N < 0 <me> = <me>.Inverse() *...........* <me>.Inverse().
//!
//! Raises if N < 0 and if the matrix of the transformation not
//! inversible.
gp_Trsf2d Powered (const Standard_Integer N);
void Transforms (Standard_Real& X, Standard_Real& Y) const;
//! Transforms a doublet XY with a Trsf2d
void Transforms (gp_XY& Coord) const;
//! Sets the coefficients of the transformation. The
//! transformation of the point x,y is the point
//! x',y' with :
//!
//! x' = a11 x + a12 y + a13
//! y' = a21 x + a22 y + a23
//!
//! The method Value(i,j) will return aij.
//! Raises ConstructionError if the determinant of the aij is null.
//! If the matrix as not a uniform scale it will be orthogonalized before future using.
Standard_EXPORT void SetValues (const Standard_Real a11, const Standard_Real a12, const Standard_Real a13, const Standard_Real a21, const Standard_Real a22, const Standard_Real a23);
friend class gp_GTrsf2d;
protected:
//! Makes orthogonalization of "matrix"
Standard_EXPORT void Orthogonalize();
private:
Standard_Real scale;
gp_TrsfForm shape;
gp_Mat2d matrix;
gp_XY loc;
};
#include <gp_Trsf2d.lxx>
#endif // _gp_Trsf2d_HeaderFile

48
src/gp/gp_TrsfForm.hxx Normal file
View File

@@ -0,0 +1,48 @@
// Created on: 1993-04-13
// Created by: JCV
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_TrsfForm_HeaderFile
#define _gp_TrsfForm_HeaderFile
//! Identifies the type of a geometric transformation.
//! Enumerates all 24 possible variants of generalized
//! Euler angles, defining general 3d rotation by three
//! rotations around main axes of coordinate system,
//! in different possible orders.
//! The name of the enumeration
//! corresponds to order of rotations, prefixed by type
//! of co-ordinate system used:
//! - Intrinsic: rotations are made around axes of rotating
//! co-ordinate system associated with the object
//! - Extrinsic: rotations are made around axes of fixed
//! (reference) co-ordinate system
//! Two specific values provided for most frequently used
//! conventions: proper Euler angles (intrinsic ZXZ) and
//! yaw-pitch-roll (intrinsic ZYX).
enum gp_TrsfForm
{
gp_Identity,
gp_Rotation,
gp_Translation,
gp_PntMirror,
gp_Ax1Mirror,
gp_Ax2Mirror,
gp_Scale,
gp_CompoundTrsf,
gp_Other
};
#endif // _gp_TrsfForm_HeaderFile

View File

@@ -1,406 +0,0 @@
-- Copyright (c) 1991-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Vec from gp
--- Purpose :
-- Defines a non-persistent vector in 3D space.
uses Ax1 from gp,
Ax2 from gp,
Dir from gp,
Pnt from gp,
Trsf from gp,
XYZ from gp
raises ConstructionError from Standard,
DomainError from Standard,
OutOfRange from Standard,
VectorWithNullMagnitude from gp
is
Create returns Vec;
---C++: inline
--- Purpose : Creates a zero vector.
Create (V : Dir) returns Vec;
---C++: inline
--- Purpose : Creates a unitary vector from a direction V.
Create (Coord : XYZ) returns Vec;
---C++: inline
--- Purpose : Creates a vector with a triplet of coordinates.
Create (Xv, Yv, Zv : Real) returns Vec;
---C++: inline
--- Purpose : Creates a point with its three cartesian coordinates.
Create (P1, P2 : Pnt) returns Vec;
---C++: inline
--- Purpose :
-- Creates a vector from two points. The length of the vector
-- is the distance between P1 and P2
SetCoord(me: in out; Index : Integer; Xi : Real)
---C++: inline
--- Purpose : Changes the coordinate of range Index
-- Index = 1 => X is modified
-- Index = 2 => Y is modified
-- Index = 3 => Z is modified
raises OutOfRange
--- Purpose : Raised if Index != {1, 2, 3}.
is static;
SetCoord (me : in out; Xv, Yv, Zv : Real) is static;
---C++: inline
---Purpose: For this vector, assigns
-- - the values Xv, Yv and Zv to its three coordinates.
SetX (me: in out; X : Real) is static;
---Purpose: Assigns the given value to the X coordinate of this vector.
---C++: inline
SetY (me: in out; Y : Real) is static;
---Purpose: Assigns the given value to the X coordinate of this vector.
---C++: inline
SetZ (me: in out; Z : Real) is static;
---Purpose: Assigns the given value to the X coordinate of this vector.
---C++: inline
SetXYZ (me: in out; Coord : XYZ) is static;
---Purpose: Assigns the three coordinates of Coord to this vector.
---C++: inline
Coord (me; Index : Integer) returns Real
---C++: inline
--- Purpose :
-- Returns the coordinate of range Index :
-- Index = 1 => X is returned
-- Index = 2 => Y is returned
-- Index = 3 => Z is returned
raises OutOfRange
--- Purpose : Raised if Index != {1, 2, 3}.
is static;
Coord (me; Xv, Yv, Zv : out Real) is static;
---Purpose: For this vector returns its three coordinates Xv, Yv, and Zvinline
---C++: inline
X (me) returns Real is static;
---Purpose: For this vector, returns its X coordinate.
---C++: inline
Y (me) returns Real is static;
---Purpose: For this vector, returns its Y coordinate.
---C++: inline
Z (me) returns Real is static;
---Purpose: For this vector, returns its Z coordinate.
---C++: inline
XYZ (me) returns XYZ is static;
---Purpose: For this vector, returns
-- - its three coordinates as a number triple
---C++: inline
---C++: return const&
IsEqual (me; Other : Vec; LinearTolerance, AngularTolerance : Real)
returns Boolean
--- Purpose :
-- Returns True if the two vectors have the same magnitude value
-- and the same direction. The precision values are LinearTolerance
-- for the magnitude and AngularTolerance for the direction.
is static;
IsNormal (me; Other : Vec; AngularTolerance : Real) returns Boolean
--- Purpose :
-- Returns True if abs(<me>.Angle(Other) - PI/2.) <= AngularTolerance
-- Raises VectorWithNullMagnitude if <me>.Magnitude() <= Resolution or
-- Other.Magnitude() <= Resolution from gp
---C++: inline
raises VectorWithNullMagnitude
is static;
IsOpposite (me; Other : Vec; AngularTolerance : Real) returns Boolean
--- Purpose :
-- Returns True if PI - <me>.Angle(Other) <= AngularTolerance
-- Raises VectorWithNullMagnitude if <me>.Magnitude() <= Resolution or
-- Other.Magnitude() <= Resolution from gp
---C++: inline
raises VectorWithNullMagnitude
is static;
IsParallel (me; Other : Vec; AngularTolerance : Real) returns Boolean
--- Purpose :
-- Returns True if Angle(<me>, Other) <= AngularTolerance or
-- PI - Angle(<me>, Other) <= AngularTolerance
-- This definition means that two parallel vectors cannot define
-- a plane but two vectors with opposite directions are considered
-- as parallel. Raises VectorWithNullMagnitude if <me>.Magnitude() <= Resolution or
-- Other.Magnitude() <= Resolution from gp
---C++: inline
raises VectorWithNullMagnitude
is static;
Angle (me; Other : Vec) returns Real
--- Purpose :
-- Computes the angular value between <me> and <Other>
-- Returns the angle value between 0 and PI in radian.
-- Raises VectorWithNullMagnitude if <me>.Magnitude() <= Resolution from gp or
-- Other.Magnitude() <= Resolution because the angular value is
-- indefinite if one of the vectors has a null magnitude.
---C++: inline
raises VectorWithNullMagnitude
is static;
AngleWithRef (me; Other , VRef : Vec) returns Real
---C++: inline
---Purpose : Computes the angle, in radians, between this vector and
-- vector Other. The result is a value between -Pi and Pi.
-- For this, VRef defines the positive sense of rotation: the
-- angular value is positive, if the cross product this ^ Other
-- has the same orientation as VRef relative to the plane
-- defined by the vectors this and Other. Otherwise, the
-- angular value is negative.
-- Exceptions
-- gp_VectorWithNullMagnitude if the magnitude of this
-- vector, the vector Other, or the vector VRef is less than or
-- equal to gp::Resolution().
-- Standard_DomainError if this vector, the vector Other,
-- and the vector VRef are coplanar, unless this vector and
-- the vector Other are parallel.
raises VectorWithNullMagnitude,
DomainError
is static;
Magnitude (me) returns Real is static;
---Purpose: Computes the magnitude of this vector.
---C++: inline
SquareMagnitude (me) returns Real is static;
---Purpose: Computes the square magnitude of this vector.
---C++: inline
Add (me : in out; Other : Vec) is static;
---C++: inline
---C++: alias operator +=
--- Purpose : Adds two vectors
Added (me; Other : Vec) returns Vec is static;
---C++: inline
---C++: alias operator +
--- Purpose : Adds two vectors
Subtract (me : in out; Right : Vec) is static;
---C++: inline
---C++: alias operator -=
--- Purpose : Subtracts two vectors
Subtracted (me; Right : Vec) returns Vec is static;
---C++: inline
---C++: alias operator -
--- Purpose : Subtracts two vectors
Multiply (me : in out; Scalar : Real) is static;
---C++: inline
---C++: alias operator *=
--- Purpose : Multiplies a vector by a scalar
Multiplied (me; Scalar : Real) returns Vec is static;
---C++: inline
---C++: alias operator *
--- Purpose : Multiplies a vector by a scalar
Divide (me : in out; Scalar : Real) is static;
---C++: inline
---C++: alias operator /=
--- Purpose : Divides a vector by a scalar
Divided (me; Scalar : Real) returns Vec is static;
---C++: inline
---C++: alias operator /
--- Purpose : Divides a vector by a scalar
Cross (me : in out; Right : Vec) is static;
---C++: inline
---C++: alias operator ^=
--- Purpose : computes the cross product between two vectors
Crossed (me; Right : Vec) returns Vec is static;
--- Purpose : computes the cross product between two vectors
---C++: inline
---C++: alias operator ^
CrossMagnitude (me; Right : Vec) returns Real is static;
--- Purpose :
-- Computes the magnitude of the cross
-- product between <me> and Right.
-- Returns || <me> ^ Right ||
---C++: inline
CrossSquareMagnitude (me; Right : Vec) returns Real is static;
--- Purpose :
-- Computes the square magnitude of
-- the cross product between <me> and Right.
-- Returns || <me> ^ Right ||**2
---C++: inline
CrossCross (me : in out; V1, V2 : Vec) is static;
---C++: inline
--- Purpose : Computes the triple vector product.
-- <me> ^= (V1 ^ V2)
CrossCrossed (me; V1, V2 : Vec) returns Vec is static;
---C++: inline
--- Purpose : Computes the triple vector product.
-- <me> ^ (V1 ^ V2)
Dot (me; Other : Vec) returns Real is static;
---C++: inline
---C++: alias operator *
--- Purpose : computes the scalar product
DotCross (me; V1, V2 : Vec) returns Real is static;
---C++: inline
--- Purpose : Computes the triple scalar product <me> * (V1 ^ V2).
Normalize (me : in out) raises ConstructionError is static;
---C++: inline
--- Purpose : normalizes a vector
-- Raises an exception if the magnitude of the vector is
-- lower or equal to Resolution from gp.
Normalized (me) returns Vec raises ConstructionError is static;
--- Purpose : normalizes a vector
-- Raises an exception if the magnitude of the vector is
-- lower or equal to Resolution from gp.
---C++: inline
Reverse (me : in out) is static;
---C++: inline
--- Purpose : Reverses the direction of a vector
Reversed (me) returns Vec is static;
--- Purpose : Reverses the direction of a vector
---C++: inline
---C++: alias operator -
SetLinearForm (me : in out;
A1 : Real; V1 : Vec; A2 : Real; V2 : Vec;
A3 : Real; V3 : Vec; V4 : Vec)
is static;
--- Purpose :
-- <me> is set to the following linear form :
-- A1 * V1 + A2 * V2 + A3 * V3 + V4
---C++: inline
SetLinearForm (me : in out;
A1 : Real; V1 : Vec; A2 : Real; V2 : Vec; A3 : Real; V3 : Vec)
is static;
--- Purpose :
-- <me> is set to the following linear form :
-- A1 * V1 + A2 * V2 + A3 * V3
---C++: inline
SetLinearForm (me : in out;
A1 : Real; V1 : Vec; A2 : Real; V2 : Vec; V3 : Vec)
is static;
--- Purpose :
-- <me> is set to the following linear form :
-- A1 * V1 + A2 * V2 + V3
---C++: inline
SetLinearForm (me : in out; A1 : Real; V1 : Vec; A2 : Real; V2 : Vec)
is static;
--- Purpose :
-- <me> is set to the following linear form :
-- A1 * V1 + A2 * V2
---C++: inline
SetLinearForm (me : in out; A1 : Real; V1, V2 : Vec)
is static;
--- Purpose :
-- <me> is set to the following linear form : A1 * V1 + V2
---C++: inline
SetLinearForm (me : in out; V1, V2 : Vec)
is static;
--- Purpose :
-- <me> is set to the following linear form : V1 + V2
---C++: inline
Mirror (me : in out; V : Vec) is static;
Mirrored (me; V : Vec) returns Vec is static;
--- Purpose :
-- Performs the symmetrical transformation of a vector
-- with respect to the vector V which is the center of
-- the symmetry.
Mirror (me : in out; A1 : Ax1) is static;
Mirrored (me; A1 : Ax1) returns Vec is static;
--- Purpose :
-- Performs the symmetrical transformation of a vector
-- with respect to an axis placement which is the axis
-- of the symmetry.
Mirror (me : in out; A2 : Ax2) is static;
Mirrored (me; A2 : Ax2) returns Vec is static;
--- Purpose :
-- Performs the symmetrical transformation of a vector
-- with respect to a plane. The axis placement A2 locates
-- the plane of the symmetry : (Location, XDirection, YDirection).
Rotate (me : in out; A1 : Ax1; Ang : Real) is static;
---C++: inline
Rotated (me; A1 : Ax1; Ang : Real) returns Vec is static;
--- Purpose :
-- Rotates a vector. A1 is the axis of the rotation.
-- Ang is the angular value of the rotation in radians.
---C++: inline
Scale (me : in out; S : Real) is static;
---C++: inline
Scaled (me; S : Real) returns Vec is static;
--- Purpose : Scales a vector. S is the scaling value.
---C++: inline
Transform (me : in out; T : Trsf) is static;
--- Purpose : Transforms a vector with the transformation T.
Transformed (me; T : Trsf) returns Vec is static;
---C++: inline
--- Purpose : Transforms a vector with the transformation T.
fields
coord : XYZ;
end;

View File

@@ -18,8 +18,19 @@
#define No_Standard_OutOfRange
#include <gp_Vec.ixx>
#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <gp_VectorWithNullMagnitude.hxx>
#include <gp_XYZ.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_OutOfRange.hxx>
Standard_Boolean gp_Vec::IsEqual
(const gp_Vec& Other,

Some files were not shown because too many files have changed in this diff Show More