Java-Gaming.org Hi !
 Featured games (83) games approved by the League of Dukes Games in Showcase (522) Games in Android Showcase (127) games submitted by our members Games in WIP (589) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
Pages: [1]
 ignore  |  Print
 elliptic trigonometry problem  (Read 1563 times) 0 Members and 1 Guest are viewing this topic.
Mordan

Junior Devvie

 « Posted 2011-06-17 16:41:08 »

Hello,

b is known
a is known
a' is known

find b' and alpha

I have been banging my head for one hour and can't find it. need to give it some rest.

knowing a', I need to find the point M's y coordinate.

I have been looking at this pdf but that was too much for me

http://www.wseas.us/e-library/transactions/mathematics/2009/32-411.pdf
namrog84

JGO Ninja

Medals: 46
Projects: 4

Keep programming!

 « Reply #1 - Posted 2011-06-17 17:02:02 »

The equation for an ellipse is
x2/a2 + y2/b2 = 1

So lets assume in this case a' = x and b' = y
in this case

I believe the answer would be
y = sqrt( (1-x2/a2)*b2 )

I believe the calculation for the angle would then be arctan(y/x) = arctan(b'/a')

-----------------

http://en.wikipedia.org/wiki/Ellipse#Polar_form_relative_to_center
http://en.wikipedia.org/wiki/Ellipse#Mathematical_definitions_and_properties

"Experience is what you get when you did not get what you wanted"
Mordan

Junior Devvie

 « Reply #2 - Posted 2011-06-18 17:03:38 »

i'm surprised there is no cosine in the formula.

but that's great.

thx man

for alpha it sure is easy once you know a' and b'.

Mordan

Junior Devvie

 « Reply #3 - Posted 2011-06-19 11:22:33 »

got another problem

consider again the figure above

this time

b' is known (V2)
a-a' is know (V1)

The trick is that a is not know, nor is a'! We only know the distance between them.

Find a and b

I'm not sure there is a single solution. I guess there will be a formula of b against a.

From the equation x2/a2 +  y2/b2 = 1

I have (a-V1)2/a2 + V22/b2=1

if k = (a-V1)2/a2

b = V2 / sqrt( 1-k )

So here I have formula of b against a but when I draw it on screen it doesn't work.

The idea is knowing M point and its opposite N, draw an elliptic Arc through those 2 points and point a. but center of ellipse is not know.
namrog84

JGO Ninja

Medals: 46
Projects: 4

Keep programming!

 « Reply #4 - Posted 2011-06-20 02:33:22 »

when you say
a-a'  do you mean a and a' are known or only distance between them?

edit:
Unknowns:  b and a, a', alpha angle
Knowns:  b'  the distance between a and a'

I will look around and see what I can find, but that might be too many unknowns.
For each unknown, you need another equation.

editv2:
just curious, what exactly is this for or how is it going to be implemented in a game? it can be really sketchy/rough. I am just curious.  As this is quite a few number of unknowns.

"Experience is what you get when you did not get what you wanted"
Mordan

Junior Devvie

 « Reply #5 - Posted 2011-06-25 19:01:06 »

hey thx for asking. I still haven't managed to do that one.

It is for drawing shapes of leaves. A simply ellipse does not look like a leaf.

So let's say I want a leaf with 10 pixels on the left, 15 pixels on the right (for a total of 25 pixels in width). Leaf is say 100 pixel in length/height.

I decided to model half a leaf as an ellipse cut by a vertical line.

This is what I do for drawing half a leaf

I know the top point of the leaf. topX,topY (can be modeled as point M in figure)
I know the bottom pointer of the leaf, botX,botY

In my case topX=botX. I will do rotations later if needed.

I know that the distance between a and a' in the above image is 10 pixels for the left part.

Once I know a and b of the ellipse, I draw the ellipse correctly offsetted and clipping on the area of half the leaf, it draws the left half of the leave.

It does not matter if there is an unknown. This unknown can be made a parameter for the leaf creation and put into the equation.

I just need this ellipse equation that goes through

(topX,topY) (topX, botY) (vertical line) and (topX + 10, MiddlePointer Between TopY and BotY). This last point is the (Distance(a,a') in the model)

that's for one part. the other part is similar except the other way around.

all I managed to do is draw half a real ellipse and not a truncated one. so maybe I don't model the problem correctly.

namrog84

JGO Ninja

Medals: 46
Projects: 4

Keep programming!

 « Reply #6 - Posted 2011-06-25 19:57:39 »

yeah, I can understand now.  I am sorry I couldn't be more help though.  It started to get out of my ability.

Don't give up though, just keep at it,  try different solutions though. I am sure you'll find one that works

edit: although I am sure its not what you originally wanted to do.  But one possible solution would be to manually draw or enter in solid numbers for a curved polygon or curved line of some sort.  Then just simply make an equation that scales/morphs that line for random/different leaves. At different points along a curved line.

It could also be made to scale/vary the entire size of the leaf and pattern while still holding true to a certain "leaf" look

"Experience is what you get when you did not get what you wanted"
pjt33
 « Reply #7 - Posted 2011-06-26 07:35:49 »

If you're interested in procedurally generating leaf shapes, you might find http://algorithmicbotany.org/papers/ interesting.
Pages: [1]
 ignore  |  Print

You cannot reply to this message, because it is very, very old.

 Add your game by posting it in the WIP section, or publish it in Showcase. The first screenshot will be displayed as a thumbnail.
 trollwarrior1 (26 views) 2014-11-22 12:13:56 xFryIx (69 views) 2014-11-13 12:34:49 digdugdiggy (48 views) 2014-11-12 21:11:50 digdugdiggy (42 views) 2014-11-12 21:10:15 digdugdiggy (36 views) 2014-11-12 21:09:33 kovacsa (60 views) 2014-11-07 19:57:14 TehJavaDev (64 views) 2014-11-03 22:04:50 BurntPizza (62 views) 2014-11-03 18:54:52 moogie (77 views) 2014-11-03 06:22:04 CopyableCougar4 (77 views) 2014-11-01 23:36:41
 theagentd 29x basil_ 27x BurntPizza 23x Riven 19x Spasi 18x princec 17x HeroesGraveDev 16x KevinWorkman 13x SHC 11x kpars 11x Grunnt 10x gouessej 10x Nate 9x Longarmx 9x CopyableCougar4 8x LiquidNitrogen 8x
 Understanding relations between setOrigin, setScale and setPosition in libGdx2014-10-09 22:35:00Definite guide to supporting multiple device resolutions on Android (2014)2014-10-02 22:36:02List of Learning Resources2014-08-16 10:40:00List of Learning Resources2014-08-05 19:33:27Resources for WIP games2014-08-01 16:20:17Resources for WIP games2014-08-01 16:19:50List of Learning Resources2014-07-31 16:29:50List of Learning Resources2014-07-31 16:26:06
 java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org