User Tag List

Page 2 of 2 FirstFirst 1 2
Results 11 to 16 of 16

Thread: ellipse x,y math

  1. #11
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: ellipse x,y math

    I installed MMF just to try your example! (Which is very nicely coded I must say =D)

    So u is the more like the tilt amount (shear factor) rather than the tilt angle. However, it is related to the angle (I think u = Tan B, where B is your angle of tilt).

    Also, I should point out that I constructed it so that you always get ellipses with the same *area*, not same dimensions. If you wanted the same dimensions, then just instead of a shear you apply a rotation, which is

    x -> x Cos(B) - y Sin(B)
    y -> x Sin(B) + y Cos(B)

    (Obviously this will have the same area as well, but it is still a different effect, as it doesn't cause it to be squished out. It depends what you want.)

    This gives you #2, actually, which doesn't seem to work at all. Hm..

  2. #12
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: ellipse x,y math

    Ah! I see your mistake! In #2, it shouldn't be:

    X = originX( "temp" ) + ((radiusX( "temp" )*Cos(15)*Cos(Angle( "temp" ))) - (radiusY( "temp" )*Sin(15)*Sin(Angle( "temp" ))))
    Y = originY( "temp" ) + ((radius[color:#CC0000]X[/color]( "temp" )*Cos(15)*Sin(Angle( "temp" ))) + (radius[color:#990000]Y[/color]( "temp" )*Sin(15)*Cos(Angle( "temp" ))))

    It should be:

    X = originX( "temp" ) + ((radiusX( "temp" )*Cos(15)*Cos(Angle( "temp" ))) - (radiusY( "temp" )*Sin(15)*Sin(Angle( "temp" ))))
    Y = originY( "temp" ) + ((radius[color:#FF0000]Y[/color]( "temp" )*Cos(15)*Sin(Angle( "temp" ))) + (radius[color:#FF0000]X[/color]( "temp" )*Sin(15)*Cos(Angle( "temp" ))))

    So let's just prove this. We have X = a Cos(t) , Y = b Sin (t) and then we transform it by the mapping given in the last post (the proof of that you can find on the Internet, search for the 'rotation matrix' or repost). This gives us:

    X-final = X Cos(B) - Y Sin(B) = a Cos(t) Cos(B) - b Sin(t) Sin(B)
    Y-final = X Sin(B) + Y Cos(B) = a Cos(t) Sin(B) + b Sin(t) Cos(B)

    And then you can add the initial X and Y values on as before.

    Here is the example updated. (I updated mine as well, although remember mine only makes sense for tilt angles between -90 and 90 degrees exclusive, as otherwise you have pressed it upon itself.)

    In general, if you ever have a set of points and you want to rotate them, just transform them according to that formula above.

    As for the difference between how I originally answered your question and the second answer (when I saw your example it is obvious what you wanted), it is worth noting that a rotated ellipse is still an ellipse, whilst a sheared one is not. (In the same way that a parallelogram is not a square) In retrospect, it is probably more natural to take 'tilt' to mean 'rotation' than 'shear', but a shear looks a little like it has been tilted in the Z-axis, if you see what I mean, and hence why I answered that =]

  3. #13
    No Products Registered

    Join Date
    Aug 2010
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: ellipse x,y math

    Many thanks for your very generous answer Jax. If you are Cam. (UK) you will likely know of a 'bear with little brain.' I also like honey :}

    Your correction to my preset #2 has resolved the problem TOTALLY. I can't recall where I got that from but my copy was correct - the original not. Your one change makes the diff.

    I think we have lift off..!..!

    I searched "ellipse rotation matrix" and have some good material - thus proving the maxim "just a matter of knowing the right question."

    many thanks

  4. #14
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: ellipse x,y math

    Or you got the draw angle and tilt angle the wrong way round in the formula. Fixing that does get you a mathematically identical result to Jax's fix though.
    Like this:
    X = originX( "temp" ) + ((radiusX( "temp" )*Cos(Angle( "temp" ))*Cos(15)) - (radiusY( "temp" )*Sin(Angle( "temp" ))*Sin(15)))
    Y = originY( "temp" ) + ((radiusX( "temp" )*Cos(Angle( "temp" ))*Sin(15)) + (radiusY( "temp" )*Sin(Angle( "temp" ))*Cos(15)))

  5. #15
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: ellipse x,y math

    Haha yes I know, Milne was indeed one of ours [smile]

    If you want to know more about the mathematical background, I can explain it properly if you'd like. I am quite keen on maths =D

  6. #16
    No Products Registered

    Join Date
    Aug 2010
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: ellipse x,y math

    thanks dynasoft
    My math is not absent - just very rusty.

    Kind of you to offer math tutoring Jax. I may pm you at a later date. Much of what I am exploring here already exists in the clickteamMovement object but both the learning and the custom control, innovation is what I like. And the fun - pooh sticks and the like ]

    thanks again - ak

Page 2 of 2 FirstFirst 1 2

Similar Threads

  1. Remove or keep the 'Ellipse' feature of the Quick Backdrop Object?
    By Anders in forum iOS Export Module Version 2.0
    Replies: 13
    Last Post: 18th October 2013, 03:21 PM
  2. Ellipse Sheild
    By Tiger in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 17th January 2013, 10:31 PM
  3. Mouvement ellipse simple
    By ladite in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 21st November 2012, 02:21 PM
  4. Question about Ellipse/Circular Movement
    By camelman in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 18th January 2009, 05:49 PM
  5. Draw Object Bug - Drawing Filled Ellipse
    By drnebula in forum File Archive
    Replies: 10
    Last Post: 19th February 2007, 05:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •