Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (552)
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 1492 times)
0 Members and 1 Guest are viewing this topic.
Offline Mordan

Junior Member





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

Hello,

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

http://www.wseas.us/e-library/transactions/mathematics/2009/32-411.pdf
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
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"
Offline Mordan

Junior Member





« 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 Member





« 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?

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

Junior Member





« 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
« 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.

CopyableCougar4 (22 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (25 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (26 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (41 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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
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!