summaryrefslogtreecommitdiff
path: root/inc/IntRes2d_IntersectionSegment.lxx
blob: 561020bd2b894c8473fe8b42197e57a94728220e (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
#include <Standard_DomainError.hxx>

inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment (
	 const IntRes2d_IntersectionPoint& P1, 
	 const IntRes2d_IntersectionPoint& P2,
	 const Standard_Boolean Oppos,
	 const Standard_Boolean ReverseFlag):

  oppos(Oppos),
  first(Standard_True),
  last(Standard_True),
  ptfirst(P1),
  ptlast(P2)
{ 
  if(ReverseFlag) {
    if(Oppos) {
      ptfirst= P2;
      ptlast = P1;
    }
  }
}

inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment (
	 const IntRes2d_IntersectionPoint& P, 
	 const Standard_Boolean First,
	 const Standard_Boolean Oppos,
	 const Standard_Boolean ReverseFlag):

  oppos(Oppos),
  ptfirst(),
  ptlast()
    {
      if(ReverseFlag && Oppos) {
	if (First) {
	  first=Standard_False; last=Standard_True; ptlast=P;
	}
	else {
	  first=Standard_True; last=Standard_False; ptfirst=P;
	}
      }
      else {
	if (First) {
	  first=Standard_True; last=Standard_False; ptfirst=P;
	}
	else {
	  first=Standard_False; last=Standard_True; ptlast=P;
	}
      }
    }

inline IntRes2d_IntersectionSegment::IntRes2d_IntersectionSegment (
                                            const Standard_Boolean Oppos):
  oppos(Oppos),
  first(Standard_False),
  last(Standard_False),
  ptfirst(),
  ptlast()
{ }

inline Standard_Boolean IntRes2d_IntersectionSegment::IsOpposite () const {
  return oppos;
}

inline Standard_Boolean IntRes2d_IntersectionSegment::HasFirstPoint () const {
  return first; 
}

inline Standard_Boolean IntRes2d_IntersectionSegment::HasLastPoint () const {
  return last;
}

inline const IntRes2d_IntersectionPoint& 
        IntRes2d_IntersectionSegment::FirstPoint () const {

  if (!first) { Standard_DomainError::Raise(); }
  return ptfirst;
}


inline const IntRes2d_IntersectionPoint&
        IntRes2d_IntersectionSegment::LastPoint () const {

  if (!last) { Standard_DomainError::Raise();}
  return ptlast;
}