Google Answers Logo
View Question
 
Q: Plotting an oval ( No Answer,   0 Comments )
Question  
Subject: Plotting an oval
Category: Computers
Asked by: michaelo1966-ga
List Price: $2.00
Posted: 16 Aug 2006 18:31 PDT
Expires: 15 Sep 2006 18:31 PDT
Question ID: 756825
Given a 2D oval with origin x,y and x radius of xr and y radius of yr
what is the equation to plot the individual points of the permiter?

Clarification of Question by michaelo1966-ga on 16 Aug 2006 18:33 PDT
Whoops -- forgot something -- want to know the point also given an
angle.  So if original is x, y and x radius is xr and y radius is yr
and angle is a (0-360) what is the x/y location of the permiter?

Clarification of Question by michaelo1966-ga on 17 Aug 2006 07:43 PDT
OK -- I answered my own question but thought I'd post here.  Maybe I
get my own $2?  Or if I stumble into a time machine I'll be that much
more likely to pass geometry.

Answer:

/*
 * Oval is object with properties:
 *   x = x center
 *   y = y center
 *   xr = x radius
 *   yr = y radius
 */
function getOvalPoint(oval:Object, angle:Number, offset:Number):Point
{
  if(offset==undefined){ offset = 0; }
	
  var radians:Number = degreesToRadians(angle);	
  var px:Number = oval['x'] + Math.cos(radians) * (oval['rx']+offset);
  var py:Number = oval['y'] + Math.sin(radians) * (oval['ry']+offset);	
	
  return new Point(px, py);
}
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy