SC2Mapster.com Wiki

SC2 API / Functions / PointWithOffsetPolar

PointWithOffsetPolar

point PointWithOffsetPolar(point base, fixed radius, fixed angle);

Create a new point translated by (radius, angle) in polar notation

Parameters

point b

Base point

fixed radius

Radius

fixed angle

Angle in degrees

Return value

point - New point defined by base translated by (radius * cos(angle in radian), radius * sin(angle in radian))

Examples

Example #1: Sample Usage
point p = Point(0, 0);
point t = PointWithOffsetPolar(ref, 1.41421356237, 45);
// t is Point(1, 1)

// Note: 1.41421356237 is sqrt(2)
Example #2: Recode
point PointWithOffsetPolar(point p, fixed radius, fixed angle) {
  return Point(PointX(p) + radius * cos(DegToRad(angle)),
               PointX(p) + radius * sin(DegToRad(angle)));
}
// Note: It requires PointX, PointY, sin, cos, DegToRad
// http://www.sc2mapster.com/assets/basic-mathematic-functions/

You must login to post a comment. Don't have an account? Register to get one!

Facts

Date created
Mar 12, 2010
Last updated
Jul 31, 2010

Authors