mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 22:43:41 +00:00
SvgSerializer: Fix bounding box for arc segments
Not necessarily minimal, but better to be conservative w.r.t. getting all geometry inside bounds.
This commit is contained in:
committed by
Thomas Krijnen
parent
d53d4a96c9
commit
376c2de85c
@@ -118,15 +118,22 @@ void SvgSerializer::write(path_object& p, const TopoDS_Wire& wire) {
|
|||||||
// the direction is reversed.
|
// the direction is reversed.
|
||||||
positive_direction = !positive_direction;
|
positive_direction = !positive_direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gp_Pnt center;
|
||||||
if (ty == STANDARD_TYPE(Geom_Circle)) {
|
if (ty == STANDARD_TYPE(Geom_Circle)) {
|
||||||
Handle(Geom_Circle) circle = Handle(Geom_Circle)::DownCast(curve);
|
Handle(Geom_Circle) circle = Handle(Geom_Circle)::DownCast(curve);
|
||||||
r1 = r2 = circle->Radius();
|
r1 = r2 = circle->Radius();
|
||||||
|
center = circle->Location();
|
||||||
} else {
|
} else {
|
||||||
Handle(Geom_Ellipse) ellipse = Handle(Geom_Ellipse)::DownCast(curve);
|
Handle(Geom_Ellipse) ellipse = Handle(Geom_Ellipse)::DownCast(curve);
|
||||||
r1 = ellipse->MajorRadius();
|
r1 = ellipse->MajorRadius();
|
||||||
r2 = ellipse->MinorRadius();
|
r2 = ellipse->MinorRadius();
|
||||||
|
center = ellipse->Location();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the arc segment is entirely inside bounding box:
|
||||||
|
growBoundingBox(center.X() - r1, center.Y() - r1);
|
||||||
|
growBoundingBox(center.X() + r1, center.Y() + r1);
|
||||||
|
|
||||||
// Calculate the angle between 2d vecs to have signed result
|
// Calculate the angle between 2d vecs to have signed result
|
||||||
const gp_Dir& d = conic->Position().XDirection();
|
const gp_Dir& d = conic->Position().XDirection();
|
||||||
|
|||||||
Reference in New Issue
Block a user