Angle at spline

Discussion forum for contributors and developers who are using the QCAD ECMAScript development platform or the C++ plugin interface or who are otherwise looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Post Reply
Premier Member
Posts: 855
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Angle at spline

Post by CVH » Mon Aug 05, 2019 11:52 am

Win7pro Qcad3.23pro wininstaller 32bit

Refering to the spline in the attached file, just any spline.

// with entity isspline
var shape = entity.castToShape();
var aaa = shape.getAngleAt(12.200,RS.FromStart);
// OR
var castPoint = shape.getPointWithDistanceToStart(12.200);
var bbb = shape.getAngleAtPoint(castPoint);

Angle aaa differs with bbb with a small amount up to 0.1 degree.
I can't find the source of that even with all scripts loaded to my script folder.
In the debugger the differences come from 'native code'.

Graphing them shows a periodic nature. A higher frequency and an lower one.
See screengrab: 1/2 period at low frequency & 11 periods of about 5 units.

I am intrigued with the source for that.
I persume Qcad uses biarc poly intermediate to do the math.
And as there is a proven flaw with the biarcs I am troubled.

Can you point out the better solution?


PS The layer 'Rope' is a sneak preview for what I need the tangent at a point.
Bending the rope.
Spline AngleAt diffs.png
Spline AngleAt diffs.png (38.15 KiB) Viewed 5893 times
Spline representation isoff.dxf
(410.1 KiB) Downloaded 276 times

Post Reply

Return to “QCAD Developers and Contributors”