summaryrefslogtreecommitdiff
path: root/inc/ApproxInt_WLine.gxx
blob: 8638ec2aa842ad078fda7a34656d8af38f7cfe99 (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
// File:          ApproxInt_WLine.gxx
// Created:       Mon Nov  8 10:00:00 1993
// Author:        lbr
// Copyright:	  Matra Datavision 1993




ApproxInt_WLine::ApproxInt_WLine(const TheCurve&    CurveXYZ,
				 const TheCurve2d&  CurveUV1,
				 const TheCurve2d&  CurveUV2) { 
  curvxyz = CurveXYZ;
  curvuv1 = CurveUV1;
  curvuv2 = CurveUV2;
}


ApproxInt_WLine::ApproxInt_WLine(const Handle(IntSurf_LineOn2S)& lin,
				 const Standard_Boolean )
     :linon2s(lin) 
{ 
}

Standard_Integer ApproxInt_WLine::NbPnts() const {
  if(!curvxyz.IsNull())
    return(curvxyz->NbPoles());
  if(!curvuv1.IsNull())
    return(curvuv1->NbPoles());
  if(!curvuv2.IsNull())
    return(curvuv2->NbPoles());
  return(linon2s->NbPoints());
}

IntSurf_PntOn2S ApproxInt_WLine::Point(const Standard_Integer Index) {
  if(!linon2s.IsNull()) { 
    if(linon2s->NbPoints()) { 
      return(linon2s->Value(Index));
    }
  }
  gp_Pnt2d P1,P2;
  gp_Pnt   P;
  if(!curvxyz.IsNull()) 
    P = curvxyz->Pole(Index);
  if(!curvuv1.IsNull())
    P1 = curvuv1->Pole(Index);
  if(!curvuv2.IsNull())
    P2 = curvuv2->Pole(Index);

  pnton2s.SetValue(P,
		   P1.X(),
		   P1.Y(),
		   P2.X(),
		   P2.Y());
  return(pnton2s);
}