public class Domain
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
Vector2D |
centre |
double |
height |
double |
highX |
double |
highY |
double |
lowX |
double |
lowY |
double |
width |
Constructor and Description |
---|
Domain(Domain d)
Create a Domain that is a copy of another one.
|
Domain(double lowX,
double lowY,
double highX,
double highY)
Create a Domain object given the top-left and bottom-right coordinates.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double px,
double py)
See if this point is within the domain
|
boolean |
contains(Vector2D p)
See if this point is within the domain
|
boolean |
contains(Vector2D p,
double scale)
See if this point is within a box scaled by the second parameter.
|
void |
move_centre_x_by(double wx)
Move the domain centre horizontally by the world distance given.
|
void |
move_centre_x_to(double wx)
Centre the domain about the given horizontal position.
|
void |
move_centre_xy_by(double wx,
double wy)
Centre the domain about the given position.
|
void |
move_centre_xy_to(double wx,
double wy)
Centre the domain about the given world position.
|
void |
move_centre_y_by(double wy)
Move the domain centre vertically by the world distance given.
|
void |
move_centre_y_to(double wy)
Centre the domain about the given vertical position.
|
void |
setDomain_xywh(double lowX,
double lowY,
double width,
double height)
Set the domain size.
|
java.lang.String |
toString()
Return the Domain as a String
|
public double lowX
public double highX
public double lowY
public double highY
public final Vector2D centre
public double width
public double height
public Domain(double lowX, double lowY, double highX, double highY)
lowX
- lowY
- highX
- highY
- public Domain(Domain d)
d
- domain to be copiedpublic void setDomain_xywh(double lowX, double lowY, double width, double height)
lowX
- top-left x coordinatelowY
- top-left y coordinatewidth
- domain widthheight
- domain heightpublic void move_centre_xy_to(double wx, double wy)
wx
- world x positionwy
- world y positionpublic void move_centre_x_to(double wx)
wx
- world x positionpublic void move_centre_y_to(double wy)
wy
- world y positionpublic void move_centre_xy_by(double wx, double wy)
wx
- world x centre positionwy
- world y centre positionpublic void move_centre_x_by(double wx)
wx
- world x centre positionpublic void move_centre_y_by(double wy)
wy
- world y centre positionpublic boolean contains(Vector2D p)
p
- the point to testpublic boolean contains(Vector2D p, double scale)
p
- the point to testscale
- the scale of the domain to considerpublic boolean contains(double px, double py)
px
- x position of point to testpy
- position of point to testpublic java.lang.String toString()
toString
in class java.lang.Object
Processing library AI_for_2D_Games by Peter Lager. (C) 2013