SkPoint Struct Reference

#include <SkPoint.h>

List of all members.

Public Member Functions

void set (SkScalar x, SkScalar y)
void iset (int32_t x, int32_t y)
void iset (const SkIPoint &p)
SkScalar length () const
bool normalize ()
bool setNormalize (SkScalar x, SkScalar y)
bool setLength (SkScalar length)
bool setLength (SkScalar x, SkScalar y, SkScalar length)
void scale (SkScalar scale, SkPoint *dst) const
void scale (SkScalar value)
void rotateCW (SkPoint *dst) const
void rotateCW ()
void rotateCCW (SkPoint *dst) const
void rotateCCW ()
void negate ()
SkPoint operator- () const
void operator+= (const SkPoint &v)
void operator-= (const SkPoint &v)
bool equals (SkScalar x, SkScalar y) const

Static Public Member Functions

static SkScalar Length (SkScalar x, SkScalar y)
static SkScalar Distance (const SkPoint &a, const SkPoint &b)
static SkScalar DotProduct (const SkPoint &a, const SkPoint &b)
static SkScalar CrossProduct (const SkPoint &a, const SkPoint &b)

Public Attributes

SkScalar fX
SkScalar fY

Friends

bool operator== (const SkPoint &a, const SkPoint &b)
bool operator!= (const SkPoint &a, const SkPoint &b)
SkPoint operator- (const SkPoint &a, const SkPoint &b)
SkPoint operator+ (const SkPoint &a, const SkPoint &b)

Detailed Description

Definition at line 122 of file SkPoint.h.


Member Function Documentation

static SkScalar SkPoint::CrossProduct ( const SkPoint a,
const SkPoint b 
) [inline, static]

Returns the cross product of a and b, treating them as 2D vectors

Definition at line 280 of file SkPoint.h.

static SkScalar SkPoint::Distance ( const SkPoint a,
const SkPoint b 
) [inline, static]

Returns the euclidian distance between a and b

Definition at line 268 of file SkPoint.h.

static SkScalar SkPoint::DotProduct ( const SkPoint a,
const SkPoint b 
) [inline, static]

Returns the dot product of a and b, treating them as 2D vectors

Definition at line 274 of file SkPoint.h.

bool SkPoint::equals ( SkScalar  x,
SkScalar  y 
) const [inline]

Returns true if the point's coordinates equal (x,y)

Definition at line 235 of file SkPoint.h.

void SkPoint::iset ( const SkIPoint p  )  [inline]

Set the point's X and Y coordinates by automatically promoting p's coordinates to SkScalar values.

Definition at line 139 of file SkPoint.h.

void SkPoint::iset ( int32_t  x,
int32_t  y 
) [inline]

Set the point's X and Y coordinates by automatically promoting (x,y) to SkScalar values.

Definition at line 131 of file SkPoint.h.

static SkScalar SkPoint::Length ( SkScalar  x,
SkScalar  y 
) [static]

Returns the euclidian distance from (0,0) to (x,y)

SkScalar SkPoint::length (  )  const [inline]

Return the euclidian distance from (0,0) to the point

Definition at line 146 of file SkPoint.h.

void SkPoint::negate (  )  [inline]

Negate the point's coordinates

Definition at line 205 of file SkPoint.h.

bool SkPoint::normalize (  ) 

Set the point (vector) to be unit-length in the same direction as it currently is, and return its old length. If the old length is degenerately small (nearly zero), do nothing and return false, otherwise return true.

void SkPoint::operator+= ( const SkPoint v  )  [inline]

Add v's coordinates to the point's

Definition at line 221 of file SkPoint.h.

SkPoint SkPoint::operator- (  )  const [inline]

Returns a new point whose coordinates are the negative of the point's

Definition at line 212 of file SkPoint.h.

void SkPoint::operator-= ( const SkPoint v  )  [inline]

Subtract v's coordinates from the point's

Definition at line 228 of file SkPoint.h.

void SkPoint::rotateCCW (  )  [inline]

Rotate the point counter-clockwise by 90 degrees, writing the answer back into the point.

Definition at line 201 of file SkPoint.h.

void SkPoint::rotateCCW ( SkPoint dst  )  const

Rotate the point counter-clockwise by 90 degrees, writing the answer into dst. It is legal for dst == this.

void SkPoint::rotateCW (  )  [inline]

Rotate the point clockwise by 90 degrees, writing the answer back into the point.

Definition at line 191 of file SkPoint.h.

void SkPoint::rotateCW ( SkPoint dst  )  const

Rotate the point clockwise by 90 degrees, writing the answer into dst. It is legal for dst == this.

void SkPoint::scale ( SkScalar  value  )  [inline]

Scale the point's coordinates by scale, writing the answer back into the point.

Definition at line 181 of file SkPoint.h.

void SkPoint::scale ( SkScalar  scale,
SkPoint dst 
) const

Scale the point's coordinates by scale, writing the answer into dst. It is legal for dst == this.

void SkPoint::set ( SkScalar  x,
SkScalar  y 
) [inline]

Set the point's X and Y coordinates

Definition at line 126 of file SkPoint.h.

bool SkPoint::setLength ( SkScalar  x,
SkScalar  y,
SkScalar  length 
)

Set the point (vector) to have the specified length in the same direction as (x,y). If the vector (x,y) has a degenerate length (i.e. nearly 0) then return false and do nothing, otherwise return true.

bool SkPoint::setLength ( SkScalar  length  ) 

Scale the point (vector) to have the specified length, and return that length. If the original length is degenerately small (nearly zero), do nothing and return false, otherwise return true.

bool SkPoint::setNormalize ( SkScalar  x,
SkScalar  y 
)

Set the point (vector) to be unit-length in the same direction as the x,y params. If the vector (x,y) has a degenerate length (i.e. nearly 0) then return false and do nothing, otherwise return true.


Friends And Related Function Documentation

bool operator!= ( const SkPoint a,
const SkPoint b 
) [friend]

Definition at line 241 of file SkPoint.h.

SkPoint operator+ ( const SkPoint a,
const SkPoint b 
) [friend]

Returns a new point whose coordinates are the sum of a's and b's (a + b)

Definition at line 256 of file SkPoint.h.

SkPoint operator- ( const SkPoint a,
const SkPoint b 
) [friend]

Returns a new point whose coordinates are the difference between a's and b's (a - b)

Definition at line 248 of file SkPoint.h.

bool operator== ( const SkPoint a,
const SkPoint b 
) [friend]

Definition at line 237 of file SkPoint.h.


Member Data Documentation

Definition at line 123 of file SkPoint.h.

Definition at line 123 of file SkPoint.h.


The documentation for this struct was generated from the following file:

Generated on Tue Oct 20 11:03:42 2009 for Skia by  doxygen 1.6.1