MoI discussion forum
MoI discussion forum

Full Version: EggOvoid script

Show messages:  1-20  21-25

From: bemfarmer
10 Dec 2021   [#1]
The EggOvoid script builds 3 types of egg-like profile curves, the Oviform curve, the Pyriform curve, and the Avianform curve.

Consider a hen's egg with the long axis length, parameter "L", centered along the x_axis, with the blunt end at x = -L/2, and the pointy end at x = +L/2.
Parameter "B" is the egg maximum Breadth, with B_axis parallel to the y_axis.
Parameter "w" is the distance from the B_axis to the y_axis. (shift)
Parameter "D" is the vertical Diameter of the egg, at L/4.
The default parameters approximate a hens large egg, in millimeters.
Note that by clicking on the parameter name, it's default is restored.

A universal equation for eggs has been devised. It is based upon numerous simple math operations. In the EggOvoid script, the universal equation is called "Avianform."
"D" is only used by the Avianform equation.

References:
The primary paper is pay per view, but the extensive math documentation is a free download:
https://nyaspubs.onlinelibrary.wiley.com/doi/10.1111/nyas.14680#:~:text=2-
,Conclusion,egg%20that%20exists%20in%20nature.

A preprint version is free:
https://www.biorxiv.org/content/10.1101/2020.08.15.252148v1.full.pdf
https://kar.kent.ac.uk/89257/1/Narushin%26al2020%28bioRxiv%29.pdf

The next reference is a superb, elegant summary, for the first 2 curves.
https://medium.com/predict/the-universal-equation-for-eggs-d9bbb73857a2
(The universal equation has its parts mixed up.)

The John D. Cook reference is also excellent, and brings up the failure of the "universal" equation to preserve the values of w and/or B.
https://www.johndcook.com/blog/2021/08/28/empirical-egg-formula/

The Oviform shape is an oval shaped curve.
If L=B, a half circle curve results, which revolves to a sphere.
If w=0, a half ellipse curve results, which revolves to an ellipsoid.

The Pyriform shape is a pear shaped curve. The pointy end is more cone-like.

The Avianform shape is the egg shape based upon the universal equation, and applies to the eggs of birds, as well as reptiles, dinosaurs, and perhaps other egg-layers. The Avianform equation is the only equation which uses the D parameter. To model a real egg, the measured values of D, L, B and w, might enable the universal equation to draw the actual shape of the egg, but there is the previous mentioned problem with "w" and or "B". If parameters w or D are too far out of range, the curve will not match a real egg.

Update: the full, closed profile is now created.
the profile curve can be revolved 360 degrees for a solid egg. Other curve segments could be rotated, to create other shapes, which may not be actual eggs.

https://brinsea.co.uk/latest/resource-centre/egg-sizes/

https://www.sheffield.ac.uk/news/nr/guillemot-eggs-shape-seabirds-climate-change-puffins-uk-1.799938

Next up is to gather egg lengths and images to measure the parameters in MoI, including eggs of hen, guillemot, duck, goose, etc.

Avianform parameters for Hens egg: L=62mm, B=45.5mm, w=5.74mm, D=35.6mm.
(very good fit)

Avianform parameters for Common Guillemot egg: L:82mm, B:48.74mm, w:12.08mm, d:31.8mm. (fairly good fit)

Attachments:
EggOvoid2.zip
EggOvoid2Docs.txt
GuillemotEgg03.7z
HensEggAligned04.7z


From: Death
10 Dec 2021   [#2] In reply to [#1]
Pretty Cool!
Works like a charm.
THANKS!
From: Barry-H
10 Dec 2021   [#3] In reply to [#1]
Hi Brian,
thanks Brian will have a play.
Cheers
Barry
From: Zooen
10 Dec 2021   [#4]
And it should be remembered here that it is indeed the egg which precedes the Chicken!


- Zooen
From: Marbleman
11 Dec 2021   [#5] In reply to [#4]
Thanks Brian,

Brilliant!
From: BurrMan
11 Dec 2021   [#6] In reply to [#1]
Hey Brian,
Thanks again. I have all of your scripts and commands.

Regarding this one and generating a solid, is there any information on creating a smooth result?

Meaning, your curves iteration doesn't end in tangency, and produces little dimples on the ends....

If the last 2 points on each end of the result curve were g1\linear or planar, then the revolve would be perfectly smooth.

I just don't know enough about these types of math equations to know whether looking at that changes it from an eggovoid and breaks the intent....

Anyway, just some food to the discussion...
From: bemfarmer
11 Dec 2021   [#7] In reply to [#6]
Thanks to everyone for their comments.

Hi BurrMan,
The lack of tangency is a major fault.
I had assumed all along that the ends were vertically tangent, and had written so in some preliminary documentation.
The point density at the ends seems low...

Will do some checking...

- Brian

Trimming the top and bottom curves at an endpoint with a tiny circle, and Blending, makes the ends tangent. But moves the endpoint a bit...

The biconcave script does not have this lack of tangency problem...
From: BurrMan
11 Dec 2021   [#8] In reply to [#7]
Hey Brian,
Yeah, we can get smooth.

The curve is so dense i didn't trust moving points either as i would probably just make a smooth dimple...

I just wanted to mention it in case you had missed it. It may be some type of "function" that should be added to all of your "math" scripts to get those end points tangenct.

Maybe michael can comment if he see's some type of "finishing function" that can be added for that, or if is a complex rewrite....

We can hope for some kind if "now that you have processed this curve, perform the "tangent end commit code" or something....

Anyway, i appreciate your work.
From: bemfarmer
12 Dec 2021   [#9] In reply to [#8]
Thank you BurrMan.

So with a few modest changes to the script, the ends are now tangent. (The interpcurve factory did the work.)
Also the closed curve, full profile is created.
The full profile can be revolved 360 degrees to show the solid.

Removed the bottom checkbox.
Recreated var bottom = false, for the top half of the profile, and sent the points to the interpcurve factory.
Set bottom to true, and sent the bottom points to the interpcurve factory, using --i as a countdown from (numpoints-2), down to and including 0.

I suppose an x axis revolve axis could be added, and a revolve checkbox...

Added new EggOvoid2.zip to the first post. Removed old EggOvoid.js and EggOvoid.htm.

Very happy,
- Brian
From: bemfarmer
12 Dec 2021   [#10]
A question for Michael, please.

Is there some way to create a dropdown list, somewhat like the Build menu for Lineweb, where each choice has an associated list of parameters,
which will populate the menu's below the dropdown list, (perhaps including sliders)? (Rather than having to manually enter the various default values.)

For example, choices in the Build menu are Hen or Duck, etc:

Hen, L = 62, B = 45.5, wShift = 5.7, D = 35.6.

Duck, L = 80, B = 50, wShift = 6, D = 34. (fictitious numbers)

Thank you,
Brian

(I tried some trial and error, without success.)
From: Barry-H
12 Dec 2021   [#11] In reply to [#10]
Hi Brian,
thanks for version 2
Is it possible you can update your previous Egghalf script to give tangency also.
If not no problem.
Cheers
Barry
From: BurrMan
12 Dec 2021   [#12] In reply to [#9]
Brian,
You are the man!!!
From: bemfarmer
12 Dec 2021   [#13] In reply to [#11]
Hi Barry,

The EggOvoid2 script is a modified version of the EggOvoid script.
If only the top half of the full profile is desired, the user can just trim with a line along the x axis and delete the bottom half.
This could be added to the EggOvoid2 script as a checkbox and a bit of code...

- Brian
From: Barry-H
12 Dec 2021   [#14] In reply to [#13]
Hi Brian,
I'm referring to your old (10 years ago) EggHalf script not your current versions.
Cheers
Barry
From: BurrMan
12 Dec 2021   [#15] In reply to [#14]
Hi Barry,
It must have been called something else. I dont see an "EggHalf" command from Brian.

Most likely it was called by its math name... Like "Enniper" or something. But i dont know which math curve equals an egg shape.

Do you have the old one available?
From: Michael Gibson
12 Dec 2021   [#16] In reply to [#10]
Hi Brian,

re:
> Is there some way to create a dropdown list, somewhat like the Build menu for Lineweb, where each
> choice has an associated list of parameters,
> which will populate the menu's below the dropdown list, (perhaps including sliders)?
> (Rather than having to manually enter the various default values.)

Yes, for that use a <select> element, it's this part in LineWeb.htm :

code:
			<table>
				<tr>
					<td>Build:</td>
					<td>
						<select id="Build">
							<option value="lines">Lines</option>
							<option value="polylines">Polylines</option>
							<option value="curves">Curves</option>
							<option value="points">Points</option>
						</select>
					</td>
				</tr>
			</table>


If you give the select element an id value then when it is changed it will generate a UI event of that name in the script's event loop.

Or you can also put in script code in the .htm file using an onchange="" handler, something like:

code:
        <select id="Build" onchange="moi.ui.alert( 'changed' );">


Let me know if you're still stuck on this part.

- Michael
From: Barry-H
12 Dec 2021   [#17] In reply to [#15]
Hi Burr,
the link to the script discussion http://moi3d.com/forum/index.php?webtag=MOI&msg=4489.1
Attached the script.
Cheers
Barry

Attachments:
EGG_Script2011.7z


From: bemfarmer
12 Dec 2021   [#18] In reply to [#17]
Hi Barry,

It should be possible to make the full profile, with the vertical tangents. I'll have a look later

- Brian
From: bemfarmer
12 Dec 2021   [#19] In reply to [#14]
Barry,
Here is a revised version of the 10 year old EggHalf script, renamed EggHalf2021.
It is a full closed profile, with two vertical tangents.

- Brian

Attachments:
EggHalf2021.zip


From: Barry-H
12 Dec 2021   [#20] In reply to [#19]
Hi Brian,
many thanks perfect.
It's a funny coincidence that I have been using the old script in the last few days and then you have produced a new one with more versatility (spooky).
There's a slight difference with the old script shape that I can't just replicate with the new script thus the request for the update.
Anyway again many thanks.
Barry

Show messages:  1-20  21-25