New Rectilinear::getNearestHSide() function.
* New: In Rectilinear::getNearestHSide(), returns the *horizontal* side of a polygon which is closest to a given Y coordinate. Unused for now.
This commit is contained in:
parent
7c0b61e669
commit
77463c4803
|
@ -479,6 +479,19 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
Box Rectilinear::getNearestHSide ( DbU::Unit y ) const
|
||||
{
|
||||
Box side;
|
||||
for ( size_t i=1 ; i<_points.size() ; ++i ) {
|
||||
if (_points[i-1].getY() != _points[i].getY()) continue;
|
||||
if ( not side.isEmpty()
|
||||
and (std::abs(side.getYCenter() - y) >= std::abs(_points[i].getY() - y))) continue;
|
||||
side = Box( _points[i-1], _points[i] );
|
||||
}
|
||||
return side;
|
||||
}
|
||||
|
||||
|
||||
void Rectilinear::_toJson ( JsonWriter* writer ) const
|
||||
{
|
||||
Inherit::_toJson( writer );
|
||||
|
|
|
@ -60,6 +60,7 @@ namespace Hurricane {
|
|||
inline Points getContour () const;
|
||||
bool getAsRectangles ( std::vector<Box>& ) const;
|
||||
inline const vector<Point>& getPoints () const;
|
||||
Box getNearestHSide ( DbU::Unit y ) const;
|
||||
// Mutators.
|
||||
void setLayer ( const Layer* );
|
||||
virtual void translate ( const DbU::Unit& dx, const DbU::Unit& dy );
|
||||
|
|
Loading…
Reference in New Issue