1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Rotating Polygons on Graph

  1. Jul 23, 2008 #1
    Okay, I am struggling severely and need some guidance by anyone who understands what's going on with this. I have to write a Java program that will take two different polygons with an angle and a pivot point. The program will determine whether the second polygon hits
    the first polygon as it (the second polygon) turns through the angle about the pivot point, and if it does, at exactly what angle and points on each polygon first contact happens.

    The formulas I have been given to determine this is as follows:

    The overall process to find point “p” is to find p= a+ λd where λ ϵ [0,1]
    To find λ use the following formula, which is basically the quadratic formula modified:

    λ=[tex]\frac{-w^Td \pm \sqrt{(w^Td)^2-d^Td(w^Tw-r^2)}}{d^Td}[/tex]

    Once you find λ, plug back into formula p= a+ λd

    To find the angle in which it collides you use this:

    Where the ∥p-c∥∥q-c∥ are the distances of p - c multiplied by the distance of q – c and
    P – the corner point that’s rotating
    Q – the contact point calculated before
    C – the pivot point
    1. The problem statement, all variables and given/known data

    2. Relevant equations

    3. The attempt at a solution
  2. jcsd
  3. Jul 23, 2008 #2
    Have you been given definitions for w, d, r, and a? I'd favor a guess that a is the pivot point, but I'm not sure about the others.

    Also, your solution for [tex]\lambda[/tex] is the solution to the equation [tex]\|\textbf{w} + \lamda \textbf{d}\|=r[/tex].
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook