Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (741)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (823)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  elliptic trigonometry problem  (Read 2810 times)
0 Members and 1 Guest are viewing this topic.
Offline Mordan

Junior Devvie

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


please consider this figure

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
Offline 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')


also sometimes look for simple location, instead of advanced math articles Smiley

"Experience is what you get when you did not get what you wanted"
Offline 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 Smiley

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

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline 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 Smiley

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.
Offline 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?

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.

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"
Offline 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.

thx for your time.
Offline 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"
Offline pjt33

« JGO Spiffy Duke »

Medals: 40
Projects: 4
Exp: 7 years

« Reply #7 - Posted 2011-06-26 07:35:49 »

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

xxMrPHDxx (21 views)
2017-11-21 16:21:00

xxMrPHDxx (14 views)
2017-11-21 16:14:31

xxMrPHDxx (16 views)
2017-11-21 16:10:57

Ecumene (114 views)
2017-09-30 02:57:34

theagentd (150 views)
2017-09-26 18:23:31

cybrmynd (260 views)
2017-08-02 12:28:51

cybrmynd (250 views)
2017-08-02 12:19:43

cybrmynd (247 views)
2017-08-02 12:18:09

Sralse (260 views)
2017-07-25 17:13:48

Archive (881 views)
2017-04-27 17:45:51
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51 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‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!