1 -- Created on: 1993-03-10
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class VectorWithMagnitude from Geom inherits Vector from Geom
20 -- Defines a vector with magnitude.
21 -- A vector with magnitude can have a zero length.
28 raises ConstructionError from Standard
32 Create (V : Vec) returns VectorWithMagnitude;
33 ---Purpose : Creates a transient copy of V.
36 Create (X, Y, Z : Real) returns VectorWithMagnitude;
37 ---Purpose : Creates a vector with three cartesian coordinates.
40 Create (P1, P2 : Pnt) returns VectorWithMagnitude;
42 -- Creates a vector from the point P1 to the point P2.
43 -- The magnitude of the vector is the distance between P1 and P2
48 SetCoord (me : mutable; X, Y, Z : Real);
49 ---Purpose : Assigns the values X, Y and Z to the coordinates of this vector.
52 SetVec (me : mutable; V : Vec);
53 --- Purpose : Converts the gp_Vec vector V into this vector.
55 SetX (me : mutable; X : Real);
56 ---Purpose : Changes the X coordinate of <me>.
59 SetY (me : mutable; Y : Real);
60 ---Purpose : Changes the Y coordinate of <me>
63 SetZ (me : mutable; Z : Real);
64 ---Purpose : Changes the Z coordinate of <me>.
67 Magnitude (me) returns Real;
68 ---Purpose : Returns the magnitude of <me>.
71 SquareMagnitude (me) returns Real;
72 ---Purpose : Returns the square magnitude of <me>.
75 Add (me : mutable; Other : Vector);
77 -- Adds the Vector Other to <me>.
80 Added (me; Other : Vector) returns VectorWithMagnitude
82 -- Adds the vector Other to <me>.
87 Cross (me : mutable; Other : Vector);
89 -- Computes the cross product between <me> and Other
93 Crossed (me; Other : Vector) returns like me
95 -- Computes the cross product between <me> and Other
96 -- <me> ^ Other. A new vector is returned.
100 CrossCross (me : mutable; V1, V2 : Vector);
102 -- Computes the triple vector product <me> ^ (V1 ^ V2).
105 CrossCrossed (me; V1, V2 : Vector) returns like me
107 -- Computes the triple vector product <me> ^ (V1 ^ V2).
108 -- A new vector is returned.
112 Divide (me : mutable; Scalar : Real);
113 ---Purpose : Divides <me> by a scalar.
116 Divided (me; Scalar : Real) returns VectorWithMagnitude
118 -- Divides <me> by a scalar. A new vector is returned.
122 Multiplied (me; Scalar : Real) returns VectorWithMagnitude
124 -- Computes the product of the vector <me> by a scalar.
125 -- A new vector is returned.
130 Multiply (me : mutable; Scalar : Real);
132 -- Computes the product of the vector <me> by a scalar.
134 Normalize (me : mutable)
135 ---Purpose : Normalizes <me>.
136 raises ConstructionError;
138 -- Raised if the magnitude of the vector is lower or equal to
139 -- Resolution from package gp.
142 Normalized (me) returns VectorWithMagnitude
143 ---Purpose : Returns a copy of <me> Normalized.
144 raises ConstructionError
146 -- Raised if the magnitude of the vector is lower or equal to
147 -- Resolution from package gp.
151 Subtract (me : mutable; Other : Vector);
152 ---Purpose : Subtracts the Vector Other to <me>.
155 Subtracted (me; Other : Vector) returns VectorWithMagnitude
157 -- Subtracts the vector Other to <me>. A new vector is returned.
163 Transform (me: mutable; T : Trsf);
165 ---Purpose: Applies the transformation T to this vector.
168 Copy (me) returns like me;
169 ---Purpose: Creates a new object which is a copy of this vector.