0024624: Lost word in license statement in source files
[occt.git] / src / AppDef / AppDef_MyLineTool.cxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15// AppDef_MyLineTool.cxx
7fd59977 16
17#include <AppDef_MyLineTool.ixx>
18#include <AppDef_MultiPointConstraint.hxx>
19#include <gp_Pnt.hxx>
20#include <gp_Pnt2d.hxx>
21#include <gp_Vec.hxx>
22#include <gp_Vec2d.hxx>
23
24Standard_Integer AppDef_MyLineTool::FirstPoint(const AppDef_MultiLine&)
25{
26 return 1;
27}
28
29Standard_Integer AppDef_MyLineTool::LastPoint(const AppDef_MultiLine& ML)
30{
31 return ML.NbMultiPoints();
32}
33
34Standard_Integer AppDef_MyLineTool::NbP2d(const AppDef_MultiLine& ML)
35{
36 return ML.Value(1).NbPoints2d();
37}
38
39Standard_Integer AppDef_MyLineTool::NbP3d(const AppDef_MultiLine& ML)
40{
41 return ML.Value(1).NbPoints();
42}
43
44
45void AppDef_MyLineTool::Value(const AppDef_MultiLine& ML,
46 const Standard_Integer MPointIndex,
47 TColgp_Array1OfPnt& tabPt)
48{
49 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
50 Standard_Integer nbp3d = MPC.NbPoints(), low = tabPt.Lower();
51 for (Standard_Integer i = 1; i <= nbp3d; i++) {
52 tabPt(i+low-1) = MPC.Point(i);
53 }
54}
55
56void AppDef_MyLineTool::Value(const AppDef_MultiLine& ML,
57 const Standard_Integer MPointIndex,
58 TColgp_Array1OfPnt2d& tabPt2d)
59{
60 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
61 Standard_Integer nbp2d = MPC.NbPoints2d(), low = tabPt2d.Lower();
62 for (Standard_Integer i = 1; i <= nbp2d; i++) {
63 tabPt2d(i+low-1) = MPC.Point2d(i);
64 }
65}
66
67void AppDef_MyLineTool::Value(const AppDef_MultiLine& ML,
68 const Standard_Integer MPointIndex,
69 TColgp_Array1OfPnt& tabPt,
70 TColgp_Array1OfPnt2d& tabPt2d)
71{
72 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
73 Standard_Integer i, nbp2d = MPC.NbPoints2d(), low2d = tabPt2d.Lower();
74 Standard_Integer nbp3d = MPC.NbPoints(), low = tabPt.Lower();
75 for (i = 1; i <= nbp3d; i++) {
76 tabPt(i+low-1) = MPC.Point(i);
77 }
78 for (i = 1; i <= nbp2d; i++) {
79 tabPt2d(i+low2d-1) = MPC.Point2d(nbp3d+i);
80 }
81}
82
83
84Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
85 const Standard_Integer MPointIndex,
86 TColgp_Array1OfVec& tabV)
87{
88 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
89 if (MPC.IsTangencyPoint()) {
90 Standard_Integer nbp3d = MPC.NbPoints(), low = tabV.Lower();
91 for (Standard_Integer i = 1; i <= nbp3d; i++) {
92 tabV(i+low-1) = MPC.Tang(i);
93 }
94 return Standard_True;
95 }
96 else return Standard_False;
97}
98
99Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
100 const Standard_Integer MPointIndex,
101 TColgp_Array1OfVec2d& tabV2d)
102{
103 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
104 if (MPC.IsTangencyPoint()) {
105 Standard_Integer nbp2d = MPC.NbPoints2d(), low = tabV2d.Lower();
106 for (Standard_Integer i = 1; i <= nbp2d; i++) {
107 tabV2d(i+low-1) = MPC.Tang2d(i);
108 }
109 return Standard_True;
110 }
111 else return Standard_False;
112}
113
114Standard_Boolean AppDef_MyLineTool::Tangency(const AppDef_MultiLine& ML,
115 const Standard_Integer MPointIndex,
116 TColgp_Array1OfVec& tabV,
117 TColgp_Array1OfVec2d& tabV2d)
118{
119 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
120 if (MPC.IsTangencyPoint()) {
121 Standard_Integer i, nbp3d = MPC.NbPoints(), low = tabV.Lower();
122 Standard_Integer nbp2d = MPC.NbPoints2d(), low2d = tabV2d.Lower();
123 for (i = 1; i <= nbp3d; i++) {
124 tabV(i+low-1) = MPC.Tang(i);
125 }
126 for (i = 1; i <= nbp2d; i++) {
127 tabV2d(i+low2d-1) = MPC.Tang2d(nbp3d+i);
128 }
129 return Standard_True;
130 }
131 else return Standard_False;
132
133}
134
135
136AppDef_MultiLine& AppDef_MyLineTool::MakeMLBetween(const AppDef_MultiLine&,
137 const Standard_Integer ,
138 const Standard_Integer ,
139 const Standard_Integer )
140{
141 return *((AppDef_MultiLine*) 0);
142}
143
144Approx_Status AppDef_MyLineTool::WhatStatus(const AppDef_MultiLine&,
145 const Standard_Integer,
146 const Standard_Integer)
147{
148 return Approx_NoPointsAdded;
149}
150
151
152Standard_Boolean AppDef_MyLineTool::Curvature(const AppDef_MultiLine& ML,
153 const Standard_Integer MPointIndex,
154 TColgp_Array1OfVec& tabV)
155{
156 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
157 if (MPC.IsCurvaturePoint()) {
158 Standard_Integer nbp3d = MPC.NbPoints(), low = tabV.Lower();
159 for (Standard_Integer i = 1; i <= nbp3d; i++) {
160 tabV(i+low-1) = MPC.Curv(i);
161 }
162 return Standard_True;
163 }
164 else return Standard_False;
165}
166
167Standard_Boolean AppDef_MyLineTool::Curvature(const AppDef_MultiLine& ML,
168 const Standard_Integer MPointIndex,
169 TColgp_Array1OfVec2d& tabV2d)
170{
171 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
172 if (MPC.IsCurvaturePoint()) {
173 Standard_Integer nbp2d = MPC.NbPoints2d(), low = tabV2d.Lower();
174 for (Standard_Integer i = 1; i <= nbp2d; i++) {
175 tabV2d(i+low-1) = MPC.Curv2d(i);
176 }
177 return Standard_True;
178 }
179 else return Standard_False;
180}
181
182
183Standard_Boolean AppDef_MyLineTool::Curvature(const AppDef_MultiLine& ML,
184 const Standard_Integer MPointIndex,
185 TColgp_Array1OfVec& tabV,
186 TColgp_Array1OfVec2d& tabV2d)
187
188{
189 AppDef_MultiPointConstraint MPC = ML.Value(MPointIndex);
190 if (MPC.IsCurvaturePoint()) {
191 Standard_Integer i, nbp3d = MPC.NbPoints(), low = tabV.Lower();
192 Standard_Integer nbp2d = MPC.NbPoints2d(), low2d = tabV2d.Lower();
193 for (i = 1; i <= nbp3d; i++) {
194 tabV(i+low-1) = MPC.Curv(i);
195 }
196 for (i = 1; i <= nbp2d; i++) {
197 tabV2d(i+low2d-1) = MPC.Curv2d(nbp3d+i);
198 }
199 return Standard_True;
200 }
201 else return Standard_False;
202
203}
204
205