Polar (com.robertpenner.utils.Polar)

com.robertpenner.utils.Polar
class Polar

The Polar class converts between polar and cartesian coordinate systems.

Availability:

ActionScript 2.0; Flash Player 6

Method summary

Method Description
cartesianToPolar(x:Number, y:Number) : Object

Converts a point from cartesian to polar coordinates.

cartesianToPolarPts(p:Object) : Object

Converts a point from cartesian to polar coordinates.

polarToCartesian(r:Number, t:Number) : Object

Converts a point from polar to cartesian coordinates.

polarToCartesianPts(p:Object) : Object

Converts a point from polar to cartesian coordinates.

cartesianToPolar(x:Number, y:Number) : Object

Usage


var polarPoint:Object = Polar.cartesianToPolar (3, 4);
trace (polarPoint.r);
trace (polarPoint.t);

Parameters

x:Number - The x value of the point.

y:Number - The y value of the point.

Returns

Returns the radius and theta of the point in a point object.

Description

Converts a point from cartesian to polar coordinates.


cartesianToPolarPts(p:Object) : Object

Usage


var cartesianPoint:Object = {x:3, y:4};
var polarPoint:Object = Polar.cartesianToPolarPts (cartesianPoint);
trace (polarPoint.r);
trace (polarPoint.t);

Parameters

p:Object - The point, with x and y properties, to convert.

Returns

Returns the radius and theta of the point in a point object.

Description

Converts a point from cartesian to polar coordinates.


polarToCartesian(r:Number, t:Number) : Object

Usage


var cartesianPoint:Object = Polar.polarToCartesian (5, 90);
trace (cartesianPoint.x);
trace (cartesianPoint.y);

Parameters

r:Number - The radius of the point.

t:Number - The theta of the point.

Returns

Returns the x and y values of the point in a point object.

Description

Converts a point from polar to cartesian coordinates.


polarToCartesianPts(p:Object) : Object

Usage


var polarPoint:Object = {r:5, t:90};
var cartesianPoint:Object = Polar.polarToCartesianPts (polarPoint);
trace (cartesianPoint.x);
trace (cartesianPoint.y);

Parameters

p:Object - The point, with r and t properties, to convert.

Returns

Returns the x and y values of the point in a point object.

Description

Converts a point from polar to cartesian coordinates.