|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgeomerative.RPoint
public class RPoint
RPoint is a very simple interface for creating, holding and drawing 2D points.
Field Summary | |
---|---|
float |
x
The x coordinate of the point. |
float |
y
The y coordinate of the point. |
Constructor Summary | |
---|---|
RPoint()
Create a new point at (0, 0). |
|
RPoint(double x,
double y)
|
|
RPoint(float x,
float y)
Create a new point, given the coordinates. |
|
RPoint(RPoint p)
Copy a point. |
Method Summary | |
---|---|
void |
add(RPoint p)
Use this to add a vector to this point. |
float |
angle(RPoint p)
Use this to obtain the angle between the vector and another vector |
RPoint |
cross(RPoint p)
Use this to perform a cross product of the point with another point. |
float |
dist(RPoint p)
Use this to obtain the distance between the vector and another vector |
float |
mult(RPoint p)
Use this to multiply a vector to this point. |
float |
norm()
Use this to obtain the norm of the point. |
void |
normalize()
Use this to normalize the point. |
void |
print()
|
void |
rotate(float angle)
|
void |
rotate(float angle,
float vx,
float vy)
Apply a rotation to the point, given the angle and optionally the coordinates of the center of rotation. |
void |
rotate(float angle,
RPoint v)
Apply a rotation to the point, given the angle and optionally the point of the center of rotation. |
void |
scale(float s)
Apply a scaling to the point, given a scaling factor. |
void |
scale(float sx,
float sy)
Apply a scaling to the point, given the scaling factors. |
void |
scale(RPoint s)
Apply a scaling to the point, given a scaling vector. |
float |
sqrnorm()
Use this to obtain the square norm of the point. |
void |
sub(RPoint p)
Use this to substract a vector to this point. |
void |
transform(RMatrix m)
Use this to apply a transformation to the point. |
void |
translate(float tx,
float ty)
Apply a translation to the point. |
void |
translate(RPoint t)
Apply a translation to the point. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public float x
public float y
Constructor Detail |
---|
public RPoint(float x, float y)
x
- the x coordinate of the new pointy
- the y coordinate of the new pointpublic RPoint(double x, double y)
public RPoint()
public RPoint(RPoint p)
p
- the point we wish to make a copy ofMethod Detail |
---|
public void transform(RMatrix m)
m
- the transformation matrix to be appliedpublic void translate(float tx, float ty)
tx
- the coefficient of x translationty
- the coefficient of y translationpublic void translate(RPoint t)
t
- the translation vector to be appliedpublic void rotate(float angle, float vx, float vy)
angle
- the angle of rotation to be appliedvx
- the x coordinate of the center of rotationvy
- the y coordinate of the center of rotationpublic void rotate(float angle)
public void rotate(float angle, RPoint v)
angle
- the angle of rotation to be appliedv
- the position vector of the center of rotationpublic void scale(float sx, float sy)
sx
- the scaling coefficient over the x axissy
- the scaling coefficient over the y axispublic void scale(float s)
s
- the scaling coefficient for a uniform scalingpublic void scale(RPoint s)
s
- the scaling vectorpublic void normalize()
public void sub(RPoint p)
p
- the vector to substractpublic void add(RPoint p)
p
- the vector to addpublic float mult(RPoint p)
p
- the vector to multiply
public RPoint cross(RPoint p)
p
- the vector to perform the cross product with
public float norm()
public float sqrnorm()
public float angle(RPoint p)
p
- the vector relative to which we want to evaluate the angle
public float dist(RPoint p)
p
- the vector relative to which we want to evaluate the distance
public void print()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |