forked from 1b-agent/opencadstudio-upstream
fix(geometry): honor polyline OCS in commands
Route editing and derived geometry through kernel world-space curves.\n\nRefs #797\nRefs #798\nRefs #799
This commit is contained in:
1 parent
08f4cc97f8
commit
7c818d15e9
12 files changed
+127
-60
No files matched your search
@@ -1058,15 +1058,15 @@ impl crate::entities::traits::MassPropsCalc for acadrust::entities::LwPolyline {
|
||||
.expect("an LwPolyline with at least two vertices has a planar curve");
|
||||
let area = curve.curve.enclosed_area().abs();
|
||||
let perimeter = curve.length();
|
||||
let (cx, cy) = curve
|
||||
let center = curve
|
||||
.curve
|
||||
.enclosed_centroid()
|
||||
.map(|point| (point[0], point[1]))
|
||||
.unwrap_or_else(|| {
|
||||
let x = p.vertices.iter().map(|v| v.location.x).sum::<f64>() / n as f64;
|
||||
let y = p.vertices.iter().map(|v| v.location.y).sum::<f64>() / n as f64;
|
||||
(x, y)
|
||||
[x, y]
|
||||
});
|
||||
let [cx, cy, _] = curve.plane.point_at(center);
|
||||
crate::entities::traits::MassProps {
|
||||
area,
|
||||
perimeter,
|
||||
|
||||
Reference in new issue
Block a user