summaryrefslogtreecommitdiff
path: root/src/gce/gce_MakeLin.cxx
blob: ea2e38b06cf0da967f93fa21bd7782a0a2cdf2af (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
// File:	gce_MakeLin.cxx
// Created:	Wed Sep  2 11:35:00 1992
// Author:	Remi GILET
//		<reg@sdsun1>

#include <gce_MakeLin.ixx>
#include <StdFail_NotDone.hxx>
#include <gp.hxx>

//=========================================================================
//   Creation d une ligne 3d de gp a partir d un Ax1 de gp.               +
//=========================================================================

gce_MakeLin::gce_MakeLin(const gp_Ax1& A1)
{
  TheLin = gp_Lin(A1);
  TheError = gce_Done;
}

//=========================================================================
//   Creation d une ligne 3d de gp a partir de son origine P (Pnt de gp)  +
//   et d une direction V (Dir de gp).                                    +
//=========================================================================

gce_MakeLin::gce_MakeLin(const gp_Pnt& P,
			 const gp_Dir& V)
{
  TheLin = gp_Lin(P,V);
  TheError = gce_Done;
}

//=========================================================================
//   Creation d une ligne 3d de gp passant par les deux points <P1> et    +
//   <P2>.                                                                +
//=========================================================================

gce_MakeLin::gce_MakeLin(const gp_Pnt& P1 ,
			 const gp_Pnt& P2 ) 
{
  if (P1.Distance(P2) >= gp::Resolution()) {
    TheLin = gp_Lin(P1,gp_Dir(P2.XYZ()-P1.XYZ()));
    TheError = gce_Done;
  }
  else { TheError = gce_ConfusedPoints; }
}

//=========================================================================
//   Creation d une ligne 3d de gp parallele a une autre <Lin> et passant +
//   par le point <P>.                                                    +
//=========================================================================

gce_MakeLin::gce_MakeLin(const gp_Lin& Lin ,
			 const gp_Pnt& P   )
{
  TheLin = gp_Lin(P,Lin.Direction());
  TheError = gce_Done;
}

const gp_Lin& gce_MakeLin::Value() const
{ 
  StdFail_NotDone_Raise_if(!TheError == gce_Done,"");
  return TheLin;
}

const gp_Lin& gce_MakeLin::Operator() const 
{
  return Value();
}

gce_MakeLin::operator gp_Lin() const
{
  return Value();
}