0030731: Modeling Data - B-Spline should have explicit data check error messages
[occt.git] / src / Geom / Geom_Vector.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-03-10
2// Created by: JCV
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _Geom_Vector_HeaderFile
18#define _Geom_Vector_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <gp_Vec.hxx>
24#include <Geom_Geometry.hxx>
25#include <Standard_Real.hxx>
26class Standard_ConstructionError;
27class Standard_DomainError;
28class gp_VectorWithNullMagnitude;
29class gp_Vec;
30
31
32class Geom_Vector;
33DEFINE_STANDARD_HANDLE(Geom_Vector, Geom_Geometry)
34
35//! The abstract class Vector describes the common
36//! behavior of vectors in 3D space.
37//! The Geom package provides two concrete classes of
38//! vectors: Geom_Direction (unit vector) and Geom_VectorWithMagnitude.
39class Geom_Vector : public Geom_Geometry
40{
41
42public:
43
44
45 //! Reverses the vector <me>.
46 Standard_EXPORT void Reverse();
47
48
49 //! Returns a copy of <me> reversed.
0be7dbe1 50 Standard_EXPORT Standard_NODISCARD Handle(Geom_Vector) Reversed() const;
42cf5bc1 51
52 //! Computes the angular value, in radians, between this
53 //! vector and vector Other. The result is a value between 0 and Pi.
54 //! Exceptions
55 //! gp_VectorWithNullMagnitude if:
56 //! - the magnitude of this vector is less than or equal to
57 //! gp::Resolution(), or
58 //! - the magnitude of vector Other is less than or equal
59 //! to gp::Resolution().
60 Standard_EXPORT Standard_Real Angle (const Handle(Geom_Vector)& Other) const;
61
62 //! Computes the angular value, in radians, between this
63 //! vector and vector Other. The result is a value
64 //! between -Pi and Pi. The vector VRef defines the
65 //! positive sense of rotation: the angular value is positive
66 //! if the cross product this ^ Other has the same
67 //! orientation as VRef (in relation to the plane defined
68 //! by this vector and vector Other). Otherwise, it is negative.
69 //! Exceptions
70 //! Standard_DomainError if this vector, vector Other
71 //! and vector VRef are coplanar, except if this vector
72 //! and vector Other are parallel.
73 //! gp_VectorWithNullMagnitude if the magnitude of
74 //! this vector, vector Other or vector VRef is less than
75 //! or equal to gp::Resolution().
76 Standard_EXPORT Standard_Real AngleWithRef (const Handle(Geom_Vector)& Other, const Handle(Geom_Vector)& VRef) const;
77
78 //! Returns the coordinates X, Y and Z of this vector.
79 Standard_EXPORT void Coord (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const;
80
81 //! Returns the Magnitude of <me>.
82 Standard_EXPORT virtual Standard_Real Magnitude() const = 0;
83
84 //! Returns the square magnitude of <me>.
85 Standard_EXPORT virtual Standard_Real SquareMagnitude() const = 0;
86
87 //! Returns the X coordinate of <me>.
88 Standard_EXPORT Standard_Real X() const;
89
90 //! Returns the Y coordinate of <me>.
91 Standard_EXPORT Standard_Real Y() const;
92
93 //! Returns the Z coordinate of <me>.
94 Standard_EXPORT Standard_Real Z() const;
95
96
97 //! Computes the cross product between <me> and <Other>.
98 //!
99 //! Raised if <me> is a "Direction" and if <me> and <Other>
100 //! are parallel because it is not possible to build a
101 //! "Direction" with null length.
102 Standard_EXPORT virtual void Cross (const Handle(Geom_Vector)& Other) = 0;
103
104
105 //! Computes the cross product between <me> and <Other>.
106 //! A new direction is returned.
107 //!
108 //! Raised if <me> is a "Direction" and if the two vectors
109 //! are parallel because it is not possible to create a
110 //! "Direction" with null length.
111 Standard_EXPORT virtual Handle(Geom_Vector) Crossed (const Handle(Geom_Vector)& Other) const = 0;
112
113
114 //! Computes the triple vector product <me> ^(V1 ^ V2).
115 //!
116 //! Raised if <me> is a "Direction" and if V1 and V2 are parallel
117 //! or <me> and (V1 ^ V2) are parallel
118 Standard_EXPORT virtual void CrossCross (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) = 0;
119
120
121 //! Computes the triple vector product <me> ^(V1 ^ V2).
122 //!
123 //! Raised if <me> is a direction and if V1 and V2 are
124 //! parallel or <me> and (V1 ^ V2) are parallel
125 Standard_EXPORT virtual Handle(Geom_Vector) CrossCrossed (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) const = 0;
126
127 //! Computes the scalar product of this vector and vector Other.
128 Standard_EXPORT Standard_Real Dot (const Handle(Geom_Vector)& Other) const;
129
130
131 //! Computes the triple scalar product. Returns me . (V1 ^ V2)
132 Standard_EXPORT Standard_Real DotCross (const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) const;
133
134 //! Converts this vector into a gp_Vec vector.
135 Standard_EXPORT const gp_Vec& Vec() const;
136
137
138
139
92efcf78 140 DEFINE_STANDARD_RTTIEXT(Geom_Vector,Geom_Geometry)
42cf5bc1 141
142protected:
143
144
145 gp_Vec gpVec;
146
147
148private:
149
150
151
152
153};
154
155
156
157
158
159
160
161#endif // _Geom_Vector_HeaderFile