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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
// File: gce_MakeLin2d.cxx
// Created: Wed Sep 2 11:35:00 1992
// Author: Remi GILET
// <reg@sdsun1>
#include <gce_MakeLin2d.ixx>
#include <gp.hxx>
#include <StdFail_NotDone.hxx>
//=========================================================================
// Creation d une ligne 2d de gp a partir d un Ax2d de gp. +
//=========================================================================
gce_MakeLin2d::gce_MakeLin2d(const gp_Ax2d& A)
{
TheLin2d = gp_Lin2d(A);
TheError = gce_Done;
}
//=========================================================================
// Creation d une ligne 2d de gp a partir de son origine P (Pnt2d de gp)+
// et d une direction V (Dir2d de gp). +
//=========================================================================
gce_MakeLin2d::gce_MakeLin2d(const gp_Pnt2d& P,
const gp_Dir2d& V)
{
TheLin2d = gp_Lin2d(P,V);
TheError = gce_Done;
}
//=========================================================================
// Creation d une ligne 2d de gp a partir des parametres de son +
// equation. +
//=========================================================================
gce_MakeLin2d::gce_MakeLin2d(const Standard_Real A,
const Standard_Real B,
const Standard_Real C)
{
if (A*A + B*B <= gp::Resolution()) {
TheError = gce_NullAxis;
}
else {
TheLin2d = gp_Lin2d(A,B,C);
TheError = gce_Done;
}
}
//=========================================================================
// Creation d une ligne 2d de gp passant par les deux points <P1> et +
// <P2>. +
//=========================================================================
gce_MakeLin2d::gce_MakeLin2d(const gp_Pnt2d& P1,
const gp_Pnt2d& P2)
{
if (P1.Distance(P2) >= gp::Resolution()) {
TheLin2d = gp_Lin2d(P1,gp_Dir2d(P2.XY()-P1.XY()));
TheError = gce_Done;
}
else {
TheError = gce_ConfusedPoints;
}
}
//=========================================================================
// Creation d une ligne 2d de gp <TheLine> parallele a une autre ligne +
// <Line1> passant par le point <Point1>. +
//=========================================================================
gce_MakeLin2d::gce_MakeLin2d(const gp_Lin2d& Line,
const gp_Pnt2d& Point)
{
TheLin2d = gp_Lin2d(Point,Line.Direction());
TheError = gce_Done;
}
//=========================================================================
// Creation d une ligne 2d de gp <TheLine> parallele a une autre ligne +
// <Line1> a une distance <Dist1>. +
//=========================================================================
gce_MakeLin2d::gce_MakeLin2d(const gp_Lin2d& Line,
const Standard_Real Dist)
{
gp_Pnt2d Point(Line.Location().XY()+
Dist*gp_XY(-Line.Direction().Y(),Line.Direction().X()));
TheLin2d = gp_Lin2d(Point,Line.Direction());
TheError = gce_Done;
}
gp_Lin2d gce_MakeLin2d::Value() const
{
StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
return TheLin2d;
}
gp_Lin2d gce_MakeLin2d::Operator() const
{
return Value();
}
gce_MakeLin2d::operator gp_Lin2d () const
{
return Value();
}
|