0031035: Coding - uninitialized class fields reported by Visual Studio Code Analysis
[occt.git] / src / IntCurveSurface / IntCurveSurface_Intersection.cxx
CommitLineData
b311480e 1// Created on: 1993-04-16
2// Created by: Laurent BUCHARD
3// Copyright (c) 1993-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
7fd59977 17
42cf5bc1 18#include <IntCurveSurface_Intersection.hxx>
7fd59977 19#include <IntCurveSurface_IntersectionPoint.hxx>
20#include <IntCurveSurface_IntersectionSegment.hxx>
21#include <IntCurveSurface_TransitionOnCurve.hxx>
42cf5bc1 22#include <Standard_OutOfRange.hxx>
23#include <StdFail_NotDone.hxx>
7fd59977 24
25#define PARAMEQUAL(a,b) (Abs((a)-(b))< (1e-8))
26
27//================================================================================
f84edf58 28IntCurveSurface_Intersection::IntCurveSurface_Intersection():
29done(Standard_False),
30myIsParallel(Standard_False)
31{
7fd59977 32}
33//================================================================================
34Standard_Boolean IntCurveSurface_Intersection::IsDone() const { return(done); }
35//================================================================================
f84edf58 36Standard_Boolean IntCurveSurface_Intersection::IsParallel() const
37{
38 return(myIsParallel);
39}
40//================================================================================
7fd59977 41Standard_Integer IntCurveSurface_Intersection::NbPoints() const {
9775fa61 42 if (!done) {throw StdFail_NotDone();}
7fd59977 43 return lpnt.Length();
44}
45//================================================================================
46Standard_Integer IntCurveSurface_Intersection::NbSegments() const {
9775fa61 47 if (!done) {throw StdFail_NotDone();}
7fd59977 48 return lseg.Length();
49}
50//================================================================================
51const IntCurveSurface_IntersectionPoint& IntCurveSurface_Intersection::Point( const Standard_Integer N) const {
9775fa61 52 if (!done) {throw StdFail_NotDone();}
7fd59977 53 return lpnt.Value(N);
54}
55//================================================================================
56const IntCurveSurface_IntersectionSegment& IntCurveSurface_Intersection::Segment( const Standard_Integer N) const {
9775fa61 57 if (!done) {throw StdFail_NotDone();}
7fd59977 58 return lseg.Value(N);
59}
60//================================================================================
61void IntCurveSurface_Intersection::SetValues(const IntCurveSurface_Intersection& Other) {
62 if(Other.done) {
63 lseg.Clear();
64 lpnt.Clear();
65 Standard_Integer N = Other.lpnt.Length();
66 Standard_Integer i ;
67 for( i=1; i<= N ; i++) {
68 lpnt.Append(Other.lpnt.Value(i));
69 }
70 N = Other.lseg.Length();
71 for(i=1; i<= N ; i++) {
72 lseg.Append(Other.lseg.Value(i));
73 }
74 done=Standard_True;
75 }
76 else {
77 done=Standard_False;
78 }
79}
80//================================================================================
81void IntCurveSurface_Intersection::Append(const IntCurveSurface_Intersection& Other,
82// const Standard_Real a,
83 const Standard_Real ,
84// const Standard_Real b)
85 const Standard_Real )
86{
87 Standard_Integer i,ni;
88 if(Other.done) {
89 ni = Other.lpnt.Length();
90 for(i=1;i<=ni;i++) { Append(Other.Point(i)); }
91 ni = Other.lseg.Length();
92 for(i=1;i<=ni;i++) { Append(Other.Segment(i)); }
93 }
94}
95//================================================================================
96void IntCurveSurface_Intersection::Append(const IntCurveSurface_IntersectionPoint& OtherPoint) {
97 Standard_Integer i,ni;
98 Standard_Real anu,anv,anw,u,v,w;
99 IntCurveSurface_TransitionOnCurve TrOnCurve,anTrOnCurve;
100 gp_Pnt P,anP;
101 ni = lpnt.Length();
102 for(i=1;i<=ni;i++) {
103 OtherPoint.Values(P,u,v,w,TrOnCurve);
104 lpnt(i).Values(anP,anu,anv,anw,anTrOnCurve);
105 if(PARAMEQUAL(u,anu)) {
106 if(PARAMEQUAL(v,anv)) {
107 if(PARAMEQUAL(w,anw)) {
108 if(anTrOnCurve==TrOnCurve) {
109 return;
110 }
111 }
112 }
113 }
114 }
115 lpnt.Append(OtherPoint);
116}
117//================================================================================
118void IntCurveSurface_Intersection::Append(const IntCurveSurface_IntersectionSegment& OtherSegment) {
119 lseg.Append(OtherSegment);
120}
121//================================================================================
122void IntCurveSurface_Intersection::ResetFields() {
123 if(done) {
124 lseg.Clear();
125 lpnt.Clear();
126 done=Standard_False;
f84edf58 127 myIsParallel = Standard_False;
7fd59977 128 }
129}
130//================================================================================
131void IntCurveSurface_Intersection::Dump() const {
132 if(done) {
133 Standard_Integer i,ni;
134 ni = lpnt.Length();
135 for(i=1;i<=ni;i++) { Point(i).Dump(); }
136 ni = lseg.Length();
137 for(i=1;i<=ni;i++) { Segment(i).Dump(); }
138 }
139 else {
04232180 140 std::cout<<" Intersection NotDone"<<std::endl;
7fd59977 141 }
142}