1 // Created on: 1994-01-10
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <Bisector_PolyBis.ixx>
18 #include <Bisector_PointOnBis.hxx>
19 #include <Geom2d_Curve.hxx>
23 #include <Standard_ConstructionError.hxx>
25 //=============================================================================
26 //function : Bisector_PolyBis
28 //=============================================================================
29 Bisector_PolyBis::Bisector_PolyBis()
34 //=============================================================================
37 //=============================================================================
38 void Bisector_PolyBis::Append (const Bisector_PointOnBis& P)
41 thePoints [nbPoints] = P;
44 //=============================================================================
47 //=============================================================================
48 Standard_Integer Bisector_PolyBis::Length() const
53 //=============================================================================
56 //=============================================================================
57 Standard_Boolean Bisector_PolyBis::IsEmpty() const
59 return (nbPoints == 0);
62 //=============================================================================
65 //=============================================================================
66 const Bisector_PointOnBis& Bisector_PolyBis::Value
67 (const Standard_Integer Index)
70 return thePoints [Index];
73 //=============================================================================
76 //=============================================================================
77 const Bisector_PointOnBis& Bisector_PolyBis::First() const
82 //=============================================================================
85 //=============================================================================
86 const Bisector_PointOnBis& Bisector_PolyBis::Last() const
88 return thePoints[nbPoints];
91 //=============================================================================
94 //=============================================================================
95 //const PointOnBis& Bisector_PolyBis::Points()
100 //=============================================================================
101 //function : Interval
103 //=============================================================================
104 Standard_Integer Bisector_PolyBis::Interval (const Standard_Real U) const
106 if ( Last().ParamOnBis() - U < gp::Resolution()) {
109 Standard_Real dU = (Last().ParamOnBis() - First().ParamOnBis())/(nbPoints - 1);
110 if (dU <= gp::Resolution()) return 1;
112 Standard_Integer IntU = Standard_Integer(Abs(U - First().ParamOnBis())/dU) ;
115 if (thePoints[IntU].ParamOnBis() >= U) {
116 for (Standard_Integer i = IntU; i >= 1; i--) {
117 if (thePoints[i].ParamOnBis() <= U) {
124 for (Standard_Integer i = IntU; i <= nbPoints - 1; i++) {
125 if (thePoints[i].ParamOnBis() >= U) {
135 //=======================================================================
136 //function : Transform
138 //=======================================================================
140 void Bisector_PolyBis::Transform(const gp_Trsf2d& T)
142 for (Standard_Integer i = 1; i <= nbPoints; i ++) {
143 gp_Pnt2d P = thePoints[i].Point();
145 thePoints[i].Point(P);