Results 1 to 7 of 7

Math Help - Figuring angle of a 2D trapezoid as if it were a 2D square

  1. #1
    Newbie
    Joined
    May 2010
    Posts
    4

    Figuring angle of a 2D trapezoid as if it were a 2D square

    I've been programming simple programs for quite a while now. I've been playing this game called Couronne, it's a cue stick based game like billiards. It's played on a perfectly square board although the camera angle makes it look like a trapezoid. You start by placing your ring on the back line of the board, click and drag to aim with the cue, then release to shoot the ring. Here's a screenshot of the game http://img706.imageshack.us/img706/6264/couronnei.png In that screen shot, it's the other player's turn. When it's my turn, I place the ring on the back red line to shoot.

    I've been trying to write a program to draw a straight line from my cue stick to the opposite side of the board, reflect off of the back wall, and come back to my side of the board. So I know where exactly my ring will go after hitting the wall. The problem I'm facing is, I don't know the formula for the angle. It's a square board, but to the eye, it looks like a trapezoid because the camera angle. I was wondering if there's a way to figure out the angle of the camera? I was also wondering how I could figure out the angle for the line to reflect off of the back wall. I was also wondering if the angle would have to change the further from the center of the line you get. When you play the game and you put the piece on the line at the right and pull back the cue, it's not straight up and down because of the angle of the camera, so it's harder to judge the angle when you're shooting further from the center. Is there a way I could work around that?

    I would greatly appreciate it if you could help me out.
    Thank you,
    Eedis
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    May 2010
    Posts
    4
    Any help would be greatly appreciated...
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    May 2010
    Posts
    27
    bear with me, it's a complex problem

    I don't think you have to take into consideration the view for the game?
    You should separate functionality like game and view in your code.

    The viewport may draw lines to coordinates placed by the Couronne game. ok?
    so in order to make a line in the view of a player, you make an invisible shot tracking the ring. And you draw a line in the viewport with these coordinates, made by an invisible simulation of a shot.

    would that work?
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    May 2010
    Posts
    4
    Well, I couldn't really make a mock simulation of the shot without knowing the angle formula in the first place.

    I guess I could make get it to read which two pixels the line begins and ends and possibly figure every possible angle in the game. If I did that, it'd use A LOT of CPU and it'd be way to robust and complex.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Junior Member
    Joined
    May 2010
    Posts
    27
    hmm, I thought you had made the game already? Sometimes its hard to pull the 3d coordinates from the game engine so you take the screen/viewport coordinates instead.

    I really think you should use a 3d engine for this. the angle of the cue stick will be your least problem I can assure you.

    what about depth for example? If a ring is placed closer to the view than another? how will you calculate if a ring drops in a hole? how will you calculate ring interaction? Are those questions already answered?
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Newbie
    Joined
    May 2010
    Posts
    4
    I think you've misunderstood. I have not created the game, I apologize for the misunderstanding. It's an online game that can be found here www.shockplay.com. I'm simply trying to write a program to draw a line on the screen for the game.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Junior Member
    Joined
    May 2010
    Posts
    27
    Can't you simulate it in a regular square and use the coordinates of the line as proportionals for the coordinates in the trapezoid? i.e. point A hits at 4/10 of the right line, B at 2/3 of the back line etc... and then you move those results over to the trapezoids lines.

    One problem might be the distance to the center of the square. For some camera settings, half distance is not the perceived half distance but something else. And if you look in the drawing you can see that the distance from half the table is shorter to the back of the table than it is to the front. Since the sides are straight I assume the effect to be proportional.
    Attached Thumbnails Attached Thumbnails Figuring angle of a 2D trapezoid as if it were a 2D square-screenshot_02.jpg  
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. square based pyramid angle
    Posted in the Trigonometry Forum
    Replies: 4
    Last Post: December 10th 2010, 05:49 PM
  2. Help figuring out Probabilities:
    Posted in the Statistics Forum
    Replies: 5
    Last Post: February 3rd 2009, 02:02 AM
  3. Figuring out PMF's. HELP!
    Posted in the Advanced Statistics Forum
    Replies: 3
    Last Post: September 28th 2008, 03:04 PM
  4. need help for figuring out equation
    Posted in the Pre-Calculus Forum
    Replies: 1
    Last Post: November 13th 2007, 08:48 PM
  5. figuring out the age
    Posted in the Math Topics Forum
    Replies: 4
    Last Post: July 6th 2006, 02:11 PM

Search Tags


/mathhelpforum @mathhelpforum