blob: c143129e2e6f8dfd6c8fbe54df6a70465949557b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
// File: Geom2d_Direction.cxx
// Created: Wed Mar 24 19:21:27 1993
// Author: JCV
// <fid@sdsun2>
// Copyright: Matra Datavision 1993
//File Geom2d_Direction.cxx, JCV 25/06/91
#include <Geom2d_Direction.ixx>
#include <gp.hxx>
#include <Standard_ConstructionError.hxx>
typedef Geom2d_Direction Direction;
typedef Handle(Geom2d_Direction) Handle(Direction);
typedef Handle(Geom2d_Vector) Handle(Vector);
typedef gp_Ax2d Ax2d;
typedef gp_Pnt2d Pnt2d;
typedef gp_Trsf2d Trsf2d;
Handle(Geom2d_Geometry) Geom2d_Direction::Copy() const {
Handle(Direction) D;
D = new Direction (gpVec2d);
return D;
}
Geom2d_Direction::Geom2d_Direction (const Standard_Real X, const Standard_Real Y) {
Standard_Real D = Sqrt (X * X + Y * Y);
Standard_ConstructionError_Raise_if (D <= gp::Resolution(), "");
gpVec2d = gp_Vec2d (X/D, Y/D);
}
Geom2d_Direction::Geom2d_Direction (const gp_Dir2d& V) { gpVec2d = V; }
void Geom2d_Direction::SetCoord (const Standard_Real X, const Standard_Real Y) {
Standard_Real D = Sqrt (X * X + Y * Y);
Standard_ConstructionError_Raise_if (D <= gp::Resolution(), "");
gpVec2d = gp_Vec2d (X/D, Y/D);
}
void Geom2d_Direction::SetDir2d (const gp_Dir2d& V) { gpVec2d = V; }
void Geom2d_Direction::SetX (const Standard_Real X) {
Standard_Real D = Sqrt(X * X + gpVec2d.Y() * gpVec2d.Y());
Standard_ConstructionError_Raise_if (D <= gp::Resolution(), "");
gpVec2d = gp_Vec2d (X/D, gpVec2d.Y()/D);
}
void Geom2d_Direction::SetY (const Standard_Real Y) {
Standard_Real D = Sqrt (gpVec2d.X() * gpVec2d.X() + Y * Y);
Standard_ConstructionError_Raise_if (D <= gp::Resolution(), "");
gpVec2d = gp_Vec2d (gpVec2d.X()/D, Y/D);
}
gp_Dir2d Geom2d_Direction::Dir2d () const { return gpVec2d; }
Standard_Real Geom2d_Direction::Magnitude () const { return 1.0; }
Standard_Real Geom2d_Direction::SquareMagnitude () const { return 1.0; }
Standard_Real Geom2d_Direction::Crossed (const Handle(Vector)& Other) const {
return gpVec2d.Crossed (Other->Vec2d());
}
void Geom2d_Direction::Transform (const gp_Trsf2d& T) {
gp_Dir2d dir = gpVec2d;
dir.Transform (T);
gpVec2d = dir;
}
|