geomerative
public class RPoint extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
float |
x
The x coordinate of the point.
|
float |
y
The y coordinate of the point.
|
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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 subtract a vector from 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.
|
public float x
public float y
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 ofpublic 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 multiplypublic RPoint cross(RPoint p)
p
- the vector to perform the cross product withpublic float norm()
public float sqrnorm()
public float angle(RPoint p)
p
- the vector relative to which we want to evaluate the anglepublic float dist(RPoint p)
p
- the vector relative to which we want to evaluate the distancepublic void print()
Geomerative by Ricard Marxer, http://www.ricardmarxer.com/geomerative/