Results 1 to 2 of 2

Thread: Rhombus inside Rectangle : testing coordinates

  1. #1
    Oct 2008

    Rhombus inside Rectangle : testing coordinates

    Hi, I am building a web game, and I came across a small issue you might help me with:

    I have a rhombus inside a rectangle, and some random coordinates inside the rectangle. I have to test if these coordinates are inside the rhombus or outside of it. That’s it!

    I know everything about the rectangle and rhombus (angles & length)
    I could devise an ugly switch case to determine this, but I was wondering if they’re wasn’t a better (and faster ) approach to this problem.
    Attached Thumbnails Attached Thumbnails Rhombus inside Rectangle : testing coordinates-rombo.gif  
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Senior Member pankaj's Avatar
    Jul 2008
    New Delhi(India)
    Consider centre of the rectangle as origin and let the diagonals of the rhombus lie along the x-axis and the y-axis.The coordinates of the vertices of the rhombus are A(\frac{-d}{2},0),D(0,\frac{-D}{2}),C(\frac{d}{2},0), B(0,\frac{D}{2}).

    The cartesian equations of the sides AD,DC,CB, BA are respectively





    When we substitute (0,0) in the LHS of the above equations we get -1 i.e. a negative quantity is obtained in all the four cases.Therefore all points inside the rhombus when substituted in the LHS of the above equations must yield a negative quantity.

    Hope this helps.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Rectangle and Rhombus
    Posted in the Algebra Forum
    Replies: 3
    Last Post: Oct 8th 2011, 10:02 AM
  2. Replies: 2
    Last Post: Jun 25th 2011, 01:21 PM
  3. Replies: 6
    Last Post: Jun 2nd 2011, 05:56 PM
  4. Replies: 3
    Last Post: Nov 8th 2010, 07:16 PM
  5. Rhombus - Rectangle
    Posted in the Geometry Forum
    Replies: 1
    Last Post: Oct 31st 2010, 05:40 PM

Search Tags

/mathhelpforum @mathhelpforum