Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/ACadSharp/Entities/LwPolyLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,27 @@ public override void ApplyTransform(Transform transform)

this.getWorldMatrix(transform, this.Normal, newNormal, out Matrix3 transOW, out Matrix3 transWO);

var m = transform.Matrix;
double det =
m.M00 * m.M11 -
m.M01 * m.M10;

bool mirrored = det < 0;

foreach (var vertex in this.Vertices)
{
XYZ v = transOW * vertex.Location.Convert<XYZ>();
v = transform.ApplyTransform(v);
v = transWO * v;
vertex.Location = v.Convert<XY>();
// OCS → WCS
XYZ transformationVector = transOW * vertex.Location.Convert<XYZ>();
transformationVector = transform.ApplyTransform(transformationVector);

// WCS → new OCS
transformationVector = transWO * transformationVector;
vertex.Location = transformationVector.Convert<XY>();

if (mirrored && vertex.Bulge != 0.0)
{
vertex.Bulge = -vertex.Bulge;
}
}

this.Normal = newNormal;
Expand Down
Loading