Show messages:
1
2-21
22-31
From: Michael Gibson
Hi Brian, re: Is there an "UnsignedNumericInput?"
Sorry, no there isn't a specific control for that particular one.
Currently in v3 there is:
<moi:TextInput> - text characters
<moi:NumericInput> - floating point number
<moi:DistanceInput> - floating point number but formatted for display using the current unit system (using feet&inches notation for example), and gets a units label after it.
<moi:IntegerInput> - integer number
<moi:UnsignedIntegerInput> - non-negative integers like for item counts
<moi:PointInput> - xyz coordinate
- Michael
From: bemfarmer
Thank you Michael.
Math.abs() takes care of negative numbers.
I'll have to search the scripts for examples of the other entry methods :-)
- Brian
From: Andy (ANDYT)
Thank you Frenchy, Bem & Karsten for your prompt replys
Karsten I am after a 2D spiral line, that I can then project down onto a beehive shape to get the 3D element
Bem your last suggestion of using the logspiral script and then sweeping an expanding tube along will work I think, I will try. The log spiral itself is a fixed ratio of expansion and only of limited use to me
Michael suggested the below, but this is beyond my expertise to do sadly -
there’s a pretty simple sine wave script here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=1519.38
You could take that script and modify the EvalSineWave function to instead evaluate your own desired function.
The other thing is a function curve graphing script here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=6447.1
Best wishes
Andy
From: bemfarmer
Here is a revision of the logarithmic spiral script, called logspiral4.
Notes and credits to Max and Michael are in the .js comments.
The code is nice and concise, compared to the previous version, but the sliders are a bit "flickery."
Additions, similar to the Archimedian Spirals script, include rotation direction, and start angle control.
There is no extrude.
- Brian
From: bemfarmer
After much revamping, here is the logSpiral5 script, which supersedes version 4.
A help button was added with Michael's tremendous help.
The Help alert box text took several hours to type up and correct.
Script was returned to the .js file, from the .htm file.
The center point can have a zero or non-zero z value.
The spiral is in a plane parallel to the xy plane.
Perhaps the preferred view is Top View
An Inward_Outward checkbox was added.
Golden spiral is described.
Decay percentage is explained, and how to convert decay percentage to the logSpiral curve and parameter exponent "b".
The expansion value is the reciprocal of the decay percentage, for outward versus inward spiral curve.
The Help alert box helps to explain the confusion which can result.
Wikipedia provides a lot more information
- Brian
From: bemfarmer
Note that with Turns at 2 or more, increasing the Grow_Shrink parameter to more than 1 or more, creates a HUGE spiral,
and any pre-existing dimensions get first smeared, then vanish. Pre-existing curves become jagged, and can disappear also.
This is outside of the slider range.
This also occurred with logSpiral4, and occurs with both MoI4 and MoI5 beta.
May be related to circle centers going away, as in another topic ?
MoI does not crash.
- Brian
From: Michael Gibson
Hi Brian,
re:
> May be related to circle centers going away, as in another topic ?
It is sort of related since it's probably due to floating point arithmetic rounding errors.
When doing arithmetic with large numbers there is a sort of quantizing effect because the gaps between representable numbers gets larger.
- Michael
From: bemfarmer
Just playing around with curves and dimensions about 1 unit in size, with
huge spiral a few million units in size, and growing it a few more million units.
Or a few billion units in size...
The vertical dimensions vanish before the horizontal dimensions.
Hiding the huge spiral restores the small curves and small dimensions.
So the small curves and dimensions still exist, just their display seems to be impacted by the huge curve.
Tried a huge archimedian spiral also, with similar results.
Tried rebuild on small log spiral, then scale up to a few million units. Similar results.
This is in Beta5, but I think applies to version 4 as well.
- Brian
From: Michael Gibson
Hi Brian,
re:
> So the small curves and dimensions still exist, just their display seems to be impacted by the huge curve.
Yes, the zbuffer rendering mechanism used by the display generates depth values depending on where they are located inside of the scene bounding box.
So when you have a huge curve making a huge scene bounding box there is not much resolution within there for the small curves.
- Michael
From: bemfarmer
QuarterCircleSpiral
Excellent posts by John D Cook:
https://www.johndcook.com/blog/2017/05/01/golden-angle/
https://www.johndcook.com/blog/2022/05/09/iterated-golden-rectangles/
https://www.johndcook.com/blog/2022/05/09/logarithmic-spiral/
https://www.johndcook.com/blog/2022/05/10/spiral-arcs/
The Golden Spiral is a logarithmic spiral, with the radius continuously changing with angle theta.
The Golden Spiral can be approximated with circular arcs, in golden rectangles, where each quarter arc has a constant radius, but each successive quarter arc has its radius reduced by the factor of the (golden ratio - 1) = (phi-1) = about 0.618034, which is the "decay factor" The QtrArc spiral is very easy to construct in MoI, and the center of the spiral constructed. Orient Line,Line is very useful.
Adjoining arcs are connected G1, with equal tangents at the connection.
The connection is not G2. The second derivatives are different.
With the Golden rectangles beginning at the Origin, the coordinates of the center of the QtrArc spirals has been calculated by John D Cook.
The center is also located by two "diagonal" lines.
A golden logarithmic spiral can also be created using the LogSpiral5 script, and Orient used to adjust it to the QtrArc ends and the center.
The two spirals are different, but are very close to each other.
Using QtrArc with decay of 85%, 0.85, may approximate violin volutes.
Or multiple decay values may be needed.
http://zhurnal.lib.ru/m/muratow_s_w/violin_design.shtml
The formulas for the Golden Arc Spiral are a bit simpler.
Using John D Cooks slope_intersect formula method for the golden spiral, for a spiral with a different decay factor, e.g. 0.85,
enables the center of QtrArcDecaySpiral to be calculated from the two "diagonals". The initial decay square begins at the origin.
The formula for the coordinates (x0,y0) of the center of the decay spiral are as follows, solving for x0:
x0 = (1+decay)/(decay*decay) For 85% decay x0 = 1.0740203 (+/-).
y0 = (-decay)*(x0) +1 For 85% decay y0 = 0.087083 (+/-).
Construction of the decay arcs in MoI confirms the values.
The logSpiral can also be plotted by calculating associated exponent
value "b", as previously remarked.
- Brian
From: Larry Fahnoe (FAHNOE)
Hi Brian,
I'm a little confused by the meaning of "Click for Golden Spiral" and "Click for Golden Spiral on the text". Makes it sound like there should be a checkbox to be clicked?
The help text:
quote:
_Grow_Shrink has a slider, with Golden Spiral default value.
Click for Golden Spiral on the text
suggests that the default Grow_Shrink of 0.306349 is what causes the Golden Spiral to be produced, but no clicks required.
My minor befuddlement aside, pretty neat script which could be handy for laying out attractive scrolls for blacksmith work. Thanks!
--Larry
From: bemfarmer
Hi Larry,
Clicking on a line of text, in order to cause a certain value to be restored, was borrowed from one of Max's scripts.
The "grow_shrink" default "b" exponent value of 0.306349... (an irrational number), is calculated from the Golden Ratio number (1+sqrt(5))/2, = about 1.618...,
also irrational, and yields the Golden Logarithmic spiral (within some decimal tolerance or approximation, because the decimals go on forever).
In the event the value of "grow_shrink" is changed by the user, clicking on the Click line of text, restores the "grow_shrink" value to 0.306349...
I agree that there could be some confusion about clicking on the text line.
Perhaps someone knows of a different control "button" which could be clicked on, placed next to the Click for Golden Spiral.
Maybe a "radio button"?
Another checkbox button does not seem quite right, because the checkbox check persists, unless script could be added to both the grow_shrink slider, and the grow_shrink entry slot, which would uncheck the checkbox, in the event some other value is chosen?
I do not know which new control button would be appropriate...
Maybe Michael would have a better idea...
Maybe a button could be named "here"? And have a different color?
Or the whole text line could become a "button", a different color in a rounded box.
Part of the htm or html code is ... onclick='growthslider.value=0.306349; moi.ui.fireUIEvent("growthslider");...Click for Golden Spiral...
So some augmentation of the .htm code would be nice...
https://www.w3docs.com/snippets/html/how-to-make-button-onclick-in-html.html
So maybe all that needs to be added is a couple of "button" controls? And maybe a color change?
The onclick button needs to look like a button...
- Brian
From: bemfarmer
Changed the "Click for Golden Spiral" to a button, but it looks like a parameter entry box.
Did not change color. Looks like html could be used, or CSS, or both.
Do not know how best to be compatible with MoI "themes".
Maybe I should be using <moi:LabelButton?, like for the blue help button?
Modified Help text for "Click for Golden Spiral.
- Brian
From: Larry Fahnoe (FAHNOE)
Hi Brian,
Ah, I see how it works now, thanks!
I'm not much of a UI guy...I end up copying other people's patterns... The button idea sounds like a logical UI element for the purpose and if that doesn't work, either a "here" using a different color in the text should help guide the user.
On edit:
Just grabbed LogSpiral6.zip and it is much clearer.
--Larry
From: bemfarmer
Hi Larry,
Thank you for your prompting to make things more understandable.
- Brian
From: Michael Gibson
Hi Brian, for the button probably use a <moi:PushButton>, like:
<moi:PushButton>Golden Spiral</moi:PushButton>
That should make it look like other buttons.
- Michael
From: bemfarmer
Thank you Michael.
Redid the PushButton in the .htm file from good version6 file, and now it works.
*****
Notepad++ formats .htm code with different colors, black, red, bold, for certain html code portions.
Various MoI code is not formatted this way.
Wonder if some simple addon to Notepad++ would do such formatting?,
or maybe it would not be worth the effort...?
- Brian
From: Michael Gibson
Hi Brian, you should be able to have an onclick="" event handler on a <moi:PushButton>. I'll give it a test on your file.
re:
> I cannot get the LogSpiral6b script to run, even if I delete the pushbutton completely,
> so I must have zonked something else?
> Or is there a cache rerunning the older version of the script?
It looks like the zonked thing is you've got the file named _LogSpiral6b.html (note ending l in html) while MoI is expecting it to be named _LogSpiral6b.htm (note just .htm not .html).
- Michael
From: Michael Gibson
Hi Brian, sounds like you've got the <moi:PushButton> working ok now?
One other thing to note, if you give a control in the command UI an id="" value then it will automatically generate a UI event of that id value when it is clicked or updated or whatever it does.
- Michael
From: bemfarmer
Thank you Michael.
.html vs htm, my mistake. (I'll blame it on the computer helping me out with extension.)
put " " around 0.306349. (does not seem to matter.)
added missing table closure. ( absence did not seem to matter.)
Script is working good now. PushButton looks nice.
- Brian
ps,
per google search, As of June 2022, it is not possible to disable the popup on Hover of the news/weather, in Windows 11. (Very annoying.)
Show messages:
1
2-21
22-31