We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Ellipse (again)

Anonymous
Not applicable
Hello,
Today I was informed by Tom Waltz that using the MUL2 command
in a 2D script on a command that draws a circle such as CIRCLE2
does not make a true ellipse but an approximation.
I did a search on GDL TALK using the key word "ellipse"
and found a post by Alex Schamenek the text of which follows.

-------------------------------------------------------------------------------------
"Okay, now I really need to create an ellipse. I know you can fake one by using
MUL2 with a circle, but when you explode a stretched object, anything round gets
faceted. So I can't just use a MUL2 statement to convert a circle into an
ellipse.

So PLEASE Graphisoft!!! Provide a way for us script an ellipse, without MUL
transformations!!!!"
-------------------------------------------------------------------------------------

I don't know how many scripts by many different people
I have seen that use either the 3D command MUL or
the 2D command MUL2 to change a circular object or figure into an elliptical shape.
So I am not the ownly one that thought that using a MUL command
on a circular shape produced an elliptical shape.

The Cartesian formula for an ellipse is
"x" squared over "a" squared plus "y" squared over "b" squared equals one

I have used this formula to find the the x and y coordinates
for points along elliptical curves in several GDL scripts.

I am not mathematical enough to write a formula that
describes the resultant shape of a circle whose "Y" coordinate values
for all points has been multiplied by some factor and then
compare this formula with the Cartesian formula to see if
they are equivalent.

Does any one have more information on these issues ?

If what happens when a circular shape is distorted
using a Mul command does not produce an ellipse then
what does it produce and what is the difference between it
and a true ellipse ?

Or, said another way, does anyone know how to write a formula that
describes the resultant shape of a circle whose "Y" coordinate values
for all points have been multiplied by some factor ?

Thank you,
Peter Devlin
14 REPLIES 14
LiHigh
Newcomer
Peter, the formula you have is the answer you're looking for!

the scripts shall look like this:

--------------------------------------------------
a0=a/2
b0=b/2
c=SQR(a0^2-b0^2)

DIM x_pos[],y_pos[]

n=20
delta_x=a/n

FOR u=1 TO 2
FOR i=1 TO n+1

x_pos=a0-delta_x*(i-1)

y_pos=SQR((1-(x_pos^2)/a0^2)*b0^2)

hotspot2 x_pos,y_pos

NEXT i
MUL2 1,-1
NEXT u
---------------------------------------------------------------------------
Howard Phua

Win 10, Archicad 19 INT
Anonymous
Not applicable
Hello LiHigh,
Thank you for posting back.
It is going to take me a while to understand your script
because, as I said, I am not very mathematical.

I'm going to copy your script into the 2D script of a new object
and see if I can figure it out.

Do you know whether a circular shape operated on
by a MUL command produces a true ellipse or some other shape ?

Thank you,
Peter Devlin
Anonymous
Not applicable
Hello LiHigh,
I think I understand your script now.
I have written something quite similar
using the ellipse formula except I did not use an array
but used put and get and drew the ellipse as lines segments.
I used a much larger "n" value to make the arc look smoother.

Using the ellipse formula to draw an ellipse does not answer
the question about whether an ellipse drawn by MULing a circle
is the same shape (meaning a true ellipse).

Thank you,
Peter Devlin
Anonymous
Not applicable
Peter,

I don't have a proof for it, but intuitively it seems to me that the mul statement should produce a true ellipse. Since an ellipse is just a circle viewed obliquely it makes sense to me that this would be equivalent to a uniform distortion along one axis. There may even be a simple geometric proof for this but I am too tired to think about it right now.
LiHigh
Newcomer
Peter wrote:
Hello LiHigh,
I think I understand your script now.
I have written something quite similar
using the ellipse formula except I did not use an array
but used put and get and drew the ellipse as lines segments.
I used a much larger "n" value to make the arc look smoother.

Using the ellipse formula to draw an ellipse does not answer
the question about whether an ellipse drawn by MULing a circle
is the same shape (meaning a true ellipse).

Thank you,
Peter Devlin
Oh! sorry, I tought you're talking about the formula.

I think ellipse drawn by MULing a circle
is infact a true ellipse.


You can double check by adding a equal-size stretched circle to the above script.
Howard Phua

Win 10, Archicad 19 INT
Frank Beister
Moderator
You can proof, if ArchiCAD aproximates an ellipse (if there is a need to approxiamte), by drawing it with the mul2 command and overlay it by hotspots. As you can see with e.g. theEllipse object it is the same.

If you use openGL for the 2D-views: I have mentioned some aberrations if you zoom in a very large scale.
If you explode an ellipse object the resulting segment lines (!) can't be a true ellipse, but if you draw the ellipse inside the script not by mul2 but by the formula it wouldn't be even correct as proper object.

There was a long thread about the ellipse issue on german GDL Talk. It was for creating true elliptical shapes with prism_ without the mul command. We tried to appriximate with arcs. This works not bad. Not really exact, but very less points than the iterative way with polylines. (For this the EllipsePro object was written for. A case study.)

My advice: Use MUL and MUL2. 😉
MHO: Tom fails here. 😉
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
MUL is the way.

Link. "If the major and minor axes are equal, the ellipse is a circle. Shall we define an ellipse as a distorted circle, then, or the circle as a special case of the ellipse? Either one would be reasonable and useful."
James Murray

Archicad 27 • Rill Architects • macOS • OnLand.info
Anonymous
Not applicable
Hello to you all and thank you for your interest.

There seems to be a consensus here that
using the MUL commands on a circular element
results in a true ellipse.

I have done the test of placing an instance of an object
that draws an ellipse by MULing a circle and then making
an ellipse with the circle tool with the same dimensions
as the object and it appears that the two exactly coincide.

That they appear to be the same, to me, does not prove
that they are indeed the same.

I wish I could figure out a way of writing a formula/equation
that mimics what happens when distance values along
one axis have a multiplication factor applied to them.
Or, more satisfying to me, Matthew's suggestion
of a geometric proof.

I wish I could read German so I could read the
discussion Frank referred to. It sounds fascinating.

It appears that, for the moment, we have a consensus
but not a proof.

I thank you all for your interest and commentary.
Peter Devlin
This guy points out, when you cut a cone with a plane you always get an ellipse, and if you use a plane perpendicular to the axis you get a circle, therefore a circle is an ellipse.

This looks like a proof. "In other words, an ellipse is the projection of a circle." Step by step from ellipse equation to circle equation.

Interesting.
James Murray

Archicad 27 • Rill Architects • macOS • OnLand.info