MoI discussion forum
MoI discussion forum

Full Version: Curve Explorer, MoI4 only

Show messages:  1-7  8-26

From: Michael Gibson
14 Feb 2018   [#8] In reply to [#7]
Hi Brian,

> The values of the tangent or derivative is given as (x,y,z), a vector.
> Sometimes the tangent vector values appear different from the 1st derivative values,
> but I think that the two vectors are parallel?

The tangent has the same direction as the derivative but the tangent is normalized so it is a unit length vector.


> FromLeft = false, reverses the "direction" of calculation of tangent or derivatives.

Not quite - the FromLeft parameter only has an impact at a discontinuity. At a discontinuity there can be 2 different tangents at one single parameter value and "FromLeft" chooses whether it returns the tangent of the segment to the left or the segment to the right.

Say for example there is a curve like this:



If you evaluate the tangent right at that t = 6.3 location there is a discontinuity there and there are 2 possible tangent values, one from this segment (let's call this the "left segment":



And then there is a different tangent direction using the right segment:




The FromLeft parameter determines which of these 2 will be returned, if FromLeft = true (the default if you don't specify it) the one from the left segment will be returned, FromLeft = false means the one from the right segment will be returned.

The tangent is still in the overall direction from the start to end of the entire curve, so setting FromLeft = false does not reverse the direction of the tangent, it just picks which of the 2 will be returned.


> (Flipping the curve would result in reversing of FromLeft true vs false vector results. (except maybe at a corner point?))

Flipping the curve would result in both a flipping of all tangent directions and also which segment's tangent would be returned by FromLeft true vs false, since now the other one is lower in segment order.


> For a straight line, all of the 'FromLeft = true tangents' for all of the points on the line, will be the same, as will all of the 1st derivatives.

This is true if it is a simple 2 point line. If it's a curve made up of many control points which all happen to be arranged in a line then the tangents will be the same but the 1st derivatives will change depending on the control point spacing.


> In order to make a "Clothoid Blend" from a start point of a curve, the tangent at the startpoint will (MAYBE) have
> to be the "FromLeft = false" version.

Nope - if you want to have a direction pointing opposite from the start tangent of a curve you would evaluate the tangent of the curve with "FromLeft" not having any impact whether true or false, and then you would modify the tangent by multiplying it by -1.0 to flip it.



> A curve with a "corner point" in it, with non-tangent curve segments joined at the corner point, would have a discontinuity at the corner point.

Yes, a tangent discontinuity.



> I think that the Blend command would benefit from incorporating "crv.isClickSelectedNearEnd" ?

The Blend command already uses it internally in the blend factory.



> For non-corner point tangents of a curve, the 'FromLeft = true' tangent is 180 degrees from the 'FromLeft = false' tangent.

Nope - at non-corner points there is only one curve tangent and either FromLeft = true or FromLeft = false will return the same value there since the tangent as seen approaching the point from lower in parameter space (FromLeft = true) is the same a the one seen by approaching the point from higher in parameter space (FromLeft = false).

The evaluated tangent is always in the direction of start to end of the curve no matter what value you specify for FromLeft.


> A CurveSegment is part of a curve consisting of joined segments.

Yup. In MoI each segment is restricted to be tangent/G1 continuous. If there's a break in tangent continuity the segments will be divided there.


> Selecting a curve selects all of its segments.

Pretty much, but it's implicit, it's only the parent curve that will have obj.selected == true.


> Is there a corner point between all joined curve segments?

Yes, although it is possible for a corner point to still be tangent continuous if the segments happen to be formed that way (which is not unusual, for example a curve that is filleted will be like this). You'd only see a sharp corner in a case like that if you dragged the corner point somewhere.


> To tell if a curve has curve segments, Separate the curve. Is there another way?

The segments of a curve are returned by the getSubObjects() method which is available on every object type in MoI. A curve always has at least one segment. To see if it's made up of multiple segments you could do crv.getSubObjects().length > 1.


Hope this helps!

- Michael

Image Attachments:
brian_fromleft1.jpg  brian_fromleft2.jpg  brian_fromleft3.jpg 


From: mkdm
14 Feb 2018   [#9] In reply to [#6]
Hello Brian!

@You : "...I am interested in how you did the htm display in the sidepane..."

Oh...nothing special, believe me :)

I try to post the code within a couple of hours.

Stay tuned.
From: bemfarmer
14 Feb 2018   [#10] In reply to [#8]
Thank you Michael,
I'm laughing at all the mistakes I made, and trying to remember calculus :-)

- Brian

Thank you Marco
From: Michael Gibson
14 Feb 2018   [#11] In reply to [#10]
No problem Brian - it can take some time to become familiar with the naming conventions and things like that with all of this detailed low level stuff!

- Michael
From: mkdm
14 Feb 2018   [#12] In reply to [#6]
Ciao Brian.

Ok...here I am.

This is the zip file of my "FilterCurvesByLength" custom command, alpha version v. 0.5, Oct 07 2017.

http://take.ms/rwm9Q

It works on both V3 and V4.

For V3 and V4 you can unzip the archive and copy the two files into the standard "commands" folder of Moi

For V4 you can decide to copy the two files into the new C:\Users\<user>\AppData\Roaming\Moi\commands

To use this custom command you have to select at least 1 edge or curve.
It works on both kind of entities.

Keep in mind one thing before playing with this command.

As you can see, its UI needs a minimum amount of room to be shown properly, on my default Windows 10 config with default fonts, this room is "21em".

This size is related to the width of the "flex_vbox" into the file "C:\Program Files\MoI 4.0 beta Feb-9-2018\ui\SidePane.htm"







This custom command has almost nothing special as I said, and its Javascript code has no fancy in it.

It's already pretty fast but it could be optimized much more.

Anyway, besides its usefulness (I've written this plugin with 2D workflows in mind) it has at least one special feature :)
If you will test it you will see.

As you can see its UI has two main sliders, "Min" an "Max", referring to the length that we want to use as main "filter"

Well, the tricky thing is that the lower and upper limit of both sliders are automatically calculated when the command starts, based on the selected entities.

That's all.

Keep in mind that I never finished the coding of this plugin and it has for sure some hidden bug.
But for what I've tested so far it worked very well.

Enjoy!
From: bemfarmer
14 Feb 2018   [#13] In reply to [#12]
Thank you Marco.
- Brian
From: mkdm
14 Feb 2018   [#14] In reply to [#13]
You're welcome!
From: bemfarmer
22 Feb 2018   [#15]
Alert box with 6 curve values at each curve end.
It would be nice to have a persistent floating box?

I'll have to try for Normal and BiNormal, and torsion...

For a circular arc, 1/radius = "K" curvature. The curvature is the length of the displayed "position vector," = sqrt( x*x, y*y, z*z ).
4.9999999... ~= 5 :-)

Paul's online notes is helpful with reviewing the mathematics, and has pdf downloads.
Chrome web browser displays his site better than Internet Explorer does.

http://tutorial.math.lamar.edu/

- Brian

Attachments:
_CurveExplorerVersion002.zip


From: Charlie (CHARLESRA)
26 Feb 2018   [#16] In reply to [#15]
Hi Brian,

Thank you so much for this tool, I am now downloading the MoI4 beta to use it.

I am an architect and have found it hard to find good curve tools on any program. I have used your Ionic Volute tool and that has hugely helped me.

I am copying the Parthenon and other Athenian buildings into MoI with dimensions from Stuart and Revett's 'Antiquities of Athens'. I believe this will help me with particularly hard curves, which I have drawn with theControl Point curve.

May I ask, are there any other scripts/tools for MoI, you know of, that may help me as an architect? I hope it is okay to ask, and I will keep searching the forums!

Many thanks for your help!

Charles
From: Frenchy Pilou (PILOU)
26 Feb 2018   [#17] In reply to [#16]
< <other scripts/tools for MoI, you know of, that may help me as an architect?

This ? (Here in French but of course is existing in English! :) (Press Original)
http://moiscript.weebly.com/cotations.html


From: Charlie (CHARLESRA)
26 Feb 2018   [#18] In reply to [#17]
Yes! Thank you very much Pilou.
From: Charlie (CHARLESRA)
26 Feb 2018   [#19] In reply to [#15]
Here are some examples of curves from mouldings of the Parthenon that I have had trouble replicating (in particular the S Curve in the lower circle):

- Again many thanks for your help, as being able to draw these curves will help me immeasurably! -





P.S. I haven't been able to open Curve Explorer, could it have been because there is no .htm file in the recent ZIP?

Image Attachments:
MoI Curve Examples The Parthenon - Antiquities of Athens_Page_11.jpg 


From: Frenchy Pilou (PILOU)
26 Feb 2018   [#20]
Put the file result of unzip inside the commands folder of Moi
then call it by Press TAB and write _CurveExplorerVersion002 (capitals or not anywhere but without any space)
or make a shortcut with the same word in the second column ;)

Else for the Drawing

Disable Snap Grid, Snap Direct
Press CTRL when you want "Sharp" angle
Put 3 or 4 Controls Point on the same part of curve with same curvature and of course a point at the inflexion! ( direction change)
Make zoom when it's hard to draw a point
Try to have same space between points if possible

At the end you can move the points as you want, add or kill someones...

Speedy test...as you see some points must bee moved at the end! :)



After some little moves seems perfect! :)



some similitude to this! :)



From: Charlie (CHARLESRA)
26 Feb 2018   [#21] In reply to [#20]
Thank you Pilou!

The curve explorer works, I thought it was a tool to draw curves and have now realised it is a tool to discover mathematical details of a curve. I am so sorry for any inconvenience.

Merci beaucoup, Through Points is a much better way to draw these curves than Control Points! I think I need to figure out how to upload a higher resolution image, as mine come out quite fuzzy.

I love Tintin! What a fabulous comic.
From: Frenchy Pilou (PILOU)
26 Feb 2018   [#22] In reply to [#21]
<< Through Points is a much better way to draw these curves than Control Points!

It's always "Control Points" ! ;)

If you want "Control Points" on the curve itself Press Tab and write "Rebuild" and input number Points you want!
(depending of the nature of your curve)

If now you take a "Point" of this new "rebuild curve" and move it you see that is always a "Contol Point"! ;)


From: bemfarmer
26 Feb 2018   [#23] In reply to [#16]
Hi Charles,

Burr's script list is here:

http://moi3d.com/forum/index.php?webtag=MOI&msg=7841.6

- Brian
From: Charlie (CHARLESRA)
26 Feb 2018   [#24] In reply to [#22]
Thank you for your continued help Pilou, I am just figuring this program out! It is an incredible program.

Charles
From: Charlie (CHARLESRA)
26 Feb 2018   [#25] In reply to [#23]
Brian,

Thank you for the link to command files, I wholeheartedly appreciate it.

Charles
From: bemfarmer
4 May 2020   [#26]
Just a quick minimal test:

By minor modification to Michael's orderCurves script, adding a section for crv.evaluateCurvature, and crv.evaluateDerivatives,
arrows were created for the Curvature Vector, and the second derivative vector at segment points.
The curvature vector is orthogonal to the tangent vector. (?)

The Curvature Vector "k" points towards the center of (invisible) osculating circle, from the parameter point "t". (The magnitude is probably "K". (?))

(As a mathematics side note, Note that (capital K) curvature "K" is a scalar. I've been reading up on vector functions. )

For the test clothoid, the k curvature vectors pointed in the same direction as the second derivative.

For test circle, test open circle-oid, and test ellipse, the k curvature vectors were directed several degrees differently than the second derivative arrows.

The second derivative arrows were much longer than the curvature vectors.

I'd like to do an update to curveExplorer with these vectors, with different colored arrows, but have no time now.
The user could select desired points. Several styles would be available. There would be a persist option checkbox...
There could be checkbox options for the desired vectors.

In the test script, the curvature and 2nd derivative arrow style color will be the same, and the same style as your current style selection.
Tangents are lime green.

- Brian

The attached file is a bare bones modification, alpha test version.

Attachments:
OrderCurves3TEST.zip


Show messages:  1-7  8-26