0030731: Modeling Data - B-Spline should have explicit data check error messages
[occt.git] / src / Geom / Geom_Vector.cxx
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
18 #include <Geom_Vector.hxx>
19 #include <gp_Vec.hxx>
20 #include <gp_VectorWithNullMagnitude.hxx>
21 #include <Standard_ConstructionError.hxx>
22 #include <Standard_DomainError.hxx>
23 #include <Standard_Type.hxx>
24
25 IMPLEMENT_STANDARD_RTTIEXT(Geom_Vector,Geom_Geometry)
26
27 typedef Geom_Vector         Vector;
28 typedef gp_Ax1  Ax1;
29 typedef gp_Ax2  Ax2;
30 typedef gp_Pnt  Pnt;
31 typedef gp_Trsf Trsf;
32
33 void Geom_Vector::Reverse ()                  { gpVec.Reverse(); }
34
35 Standard_Real Geom_Vector::X () const                  { return gpVec.X(); }
36
37 Standard_Real Geom_Vector::Y () const                  { return gpVec.Y(); }
38
39 Standard_Real Geom_Vector::Z () const                  { return gpVec.Z(); }
40
41 const gp_Vec& Geom_Vector::Vec () const              { return gpVec; }
42
43 Handle(Geom_Vector) Geom_Vector::Reversed () const
44 {
45   Handle(Geom_Vector) V = Handle(Geom_Vector)::DownCast(Copy());
46   V->Reverse();
47   return V;
48 }
49
50
51 Standard_Real Geom_Vector::Angle (const Handle(Geom_Vector)& Other) const { 
52
53   return gpVec.Angle (Other->Vec());
54 }
55
56
57 Standard_Real Geom_Vector::AngleWithRef (
58 const Handle(Geom_Vector)& Other, const Handle(Geom_Vector)& VRef) const {
59
60    return gpVec.AngleWithRef (Other->Vec(), VRef->Vec());
61 }
62
63
64 void Geom_Vector::Coord (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const {
65
66    gpVec.Coord (X, Y, Z);
67 }
68  
69
70 Standard_Real Geom_Vector::Dot (const Handle(Geom_Vector)& Other) const  { 
71
72   return gpVec.Dot (Other->Vec());
73 }
74
75
76 Standard_Real Geom_Vector::DotCross (
77 const Handle(Geom_Vector)& V1, const Handle(Geom_Vector)& V2) const {
78
79   return gpVec.DotCross (V1->Vec(), V2->Vec());
80 }
81
82
83