powerCone Spiral, Allometric Growth

Next
 From:  bemfarmer
10608.1 
_powerConeSpiral script by Brian McMillin, January, 2022.
This script builds models of Teeth, Horns, Claws, and other structures.

References:
The script is based upon the paper:
https://bmcbiol.biomedcentral.com/articles/10.1186/s12915-021-00990-w
The paper is Open Access, licensed under Creative Commons Attribution.
There is also a supplement, with a Mathematica implementation which required extensive study. The morpho site has more organism files.
The Wikipedia entry "Logarithmic spiral" is very good.
Allometric growth, was also studied extensively.
The paper, program, math, and models, were very confusing, but can be understood with a lot of study. So the script has a lot of verbose comments. The two pdf papers contain a lot of explanations also.

Usually the straight powerCone, with its modified cross section, is FLOWed to a segment of a 3D logarithmic spiral. Study notes are contained in the two PDF files, "Logarithmic spirals" and "PowerConespiral", which may be posted eventually.

The attached version is a Rough Draft Alpha, which needs to be cleaned up and finished. I posted the ALPHA script, because time for finishing up the script is swiftly vanishing. Scripting the objectlists was particularly difficult, but Max's cMorph, and previous Michael help, including chain.js helped a lot.
Flow is not working yet, but can be done manually. The baseline is along the y-axis. The log spiral is the target curve. The straight powerCone loft is the object to be flowed.
Each creature structure has its own preset parameters. The matching baseline length is the same as the matching log spiral arc length.

image host

- Brian
Note, deleted script 3/5/22, for repairs :-)

EDITED: 5 Mar 2022 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10608.2 In reply to 10608.1 
Updated Alpha.
Flow now works.
Cleanup removal of old powerCone & powerConeSpiral has not been done. Preliminary code is shown, but still needs some help. Need to include some Chain script like cleanup code.
Cleanup on Cancel has not been done. No more time today.

Speed may be too slow for sliders? The mathematica sliders were also slow.
It may be faster to do one cross section and scale it ???

One peculiarity with using build presets, is that during one session of MoI,
Changing a parameter, such as "closed" checkbox, exiting script, and right mouse click to re-run script, causes the changed checkbox setting
to revert to its preset. It only took a couple of hours to realize this simple fact :-)

- Brian

ps, If the user does not like the tip, an iso-line can cut the tip off. And then blendCap can add a new tip.
Also, Inner Flat has not been finished.

EDITED: 5 Mar 2022 by BEMFARMER


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10608.3 In reply to 10608.2 
Hi Brian,

> One peculiarity with using build presets, is that during one session of MoI,
> Changing a parameter, such as "closed" checkbox, exiting script, and right mouse click to re-run script, causes the changed checkbox setting
> to revert to its preset. It only took a couple of hours to realize this simple fact :-)

Yes any element in a command's .htm file that has an id="" value will get its value stored when the command exits and then initialized to that value when the command is run again in that same program session.

You can override that behavior by putting style="persist:false" on a control.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10608.4 In reply to 10608.3 
Hi Michael,

Thank you for the information.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10608.5 
Here is an improved alpha version of powerConeSpiralGOOD16.

The straight powerCone is deleted from the geometry database.
The older/previous version of powerConeSpiral is deleted, when building a new preset, or changing "closed".

The sliders do not seem to do anything :-(

- Brian

EDITED: 5 Mar 2022 by BEMFARMER


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  TOM (SIRTOM)
10608.6 
Very interesting script again ! Thank you, and downloading now.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10608.7 In reply to 10608.6 
Thank you SIRTOM.

I'll have a try at getting the sliders to work.

I'm not sure if the MoI meshangle settings is having an effect on the view, or not.

I tried a logarithmic for loop for spacing more profiles near the apex, which worked, but not sure if it improves the tip look, or not.
Nor if it has more overhead. (The log spacing is not in the current alpha.)

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10608.8 
Numerous changes were made, trying to get the sliders and parameters to update, without success. Just get programming errors so far.

If sliders are slid, (without update effect), clicking on the ClosedTip checkbox, causes ClosedTip checkbox to act as a defacto Update button, and causes the new slider static changes to implement to their new settings.
So the sliders are changing their parameters locally, but not being interactively updated.
Grafting Chain.js style programming to EggOvoid and cMorph style programming has caused some unknown lack of interactive updating problem.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10608.9 In reply to 10608.8 
Hi Brian,

re:
> trying to get the sliders and parameters to update, without success. Just get programming errors so far.

I took a look in _PowerConeSpiralGOOD16.js and it looks like to get your sliders to update dynamically you will need to adjust your event loop.

Currently on _PowerConeSpiralGOOD16.js line 572 you've got:

if ( dlg.event == 'aValue' || dlg.event == 'bValue' || dlg.event == 'zOff' || dlg.event == 'wcValue' || dlg.event == 'startAngle' || dlg.event == 'rangeAngle' || dlg.event == 'radiusAdj' || dlg.event == 'aspect' || dlg.event == 'radial' || dlg.event == 'transverse' || dlg.event == 'flat' || dlg.event == 'numpoints'|| dlg.event == 'closedTip' || dlg.event == 'Preset' )

Make it also look for slider id values in there as well, like also look for dlg.event == 'aSlider' in addition to dlg.event == 'aValue'.

Hope that helps!

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10608.10 In reply to 10608.9 
Thank you very very much Michael.

I'll try the changes tonight after work.

I also noticed that about line 33, function Update(...,...,...,obj)
that I have "obj" instead of "powerConeSpiral"
the "obj" isn't used, so seems to be superfluous???
Changing the "obj" to "powerConeSpiral" just caused an error...

- Brian

On other scripts, like eggOvoid, with your helpful preset code, the sliders worked fine, without the changes.
So I do not understand...
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10608.11 In reply to 10608.10 
Hi Brian,

re:
> On other scripts, like eggOvoid, with your helpful preset code, the sliders worked fine, without the changes.
> So I do not understand...

I checked _EggOvoid2.js from http://moi3d.com/forum/index.php?webtag=MOI&msg=10525.1 and in its event loop it is looking for Ui events of both the numeric input field and also the sliders, on line 150 of _EggOvoid2.js it has this:

if ( dlg.event == 'LValue' || dlg.event == 'BValue' || dlg.event == 'wValue' || dlg.event == 'DValue' || dlg.event == 'numpoints' || dlg.event == 'Lslider' || dlg.event == 'Bslider' || dlg.event == 'wslider' || dlg.event == 'Dslider' || dlg.event == 'Build' )

These were missing in _PowerCoenSpiralGOOD16.js, there you only were looking for UI events for the numeric input controls and not events from the sliders, that's what was different.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10608.12 In reply to 10608.11 
Thank you Michael.

I should have been more careful with blithely copying and modifying code.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10608.13 
Which is faster?
How much faster?

Method 1:
Apex point.
50 calculated cross-section profiles, 4 * 50 numpoints each. 50 arc lengths.
Loft of said point and 50 profiles.
1 baseline for flow.
1 3D logarithmic spiral for flow.
Flow to 3D logarithmic spiral.

Method 2:
Apex point.
1 calculated cross-section profile, 4 * 50 numpoints total.
49 more profiles, scaled from profile 1. 49 + 1 arc lengths.
Loft
1 baseline for flow.
1 3D logarithmic spiral target for flow.
Flow to 3D logarithmic spiral.

Method 3:
Apex point End.
1 calculated cross-section profile, 4 * 50 numpoints total.
1 calculated scaling rail curve, 50 calculated arc lengths.
1 3D logarithmic spiral, as sweep rail.
One Rail Sweep along the 3D logarithmic spiral, with the scaling rail.
Well, not sure just how the scaling rail would work. Flow would still be needed maybe, or not?


A more quickly calculated cross-section profile? (Something from Max?)
Reducing Slider parameter decimals from 3 to 2 or 1.

- Brian

EDITED: 7 Mar 2022 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10608.14 
Here is alpha version 19.
The sliders work. Delay is roughly 1/4 to 1/3 second for one modification.
Reduced decimals of parameters to 1 or 2, from 3.
Reduced numpoints to 40, from 50.
Inner flat is working, but is on wrong side. (An easy fix, as per arcloop script.)
The log spiral preset looks a little strange. Has a variable thickness, not a curve.

- Brian

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  TOM (SIRTOM)
10608.15 In reply to 10608.14 
Well done and respect for this nice little addon the the huge toolbox of MOI !!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  bemfarmer
10608.16 In reply to 10608.15 
Thank you SirTom.

When I get some time, I may try some speedups on forming the profiles.

Last night I read about how whiskers follow euler spiral curves :-) (No script planned for whiskers.)
The math guys should have tested log spirals?

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All