mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-09 21:31:51 +09:00
Former-commit-id: 1647fa32ef6894bd7db44f741f07c2f4dcdf9054 Former-commit-id: 0e5810dcfbe1fd59b13e7cabe9f1e93c5542da2d
72 lines
1.5 KiB
Java
72 lines
1.5 KiB
Java
package org.newdawn.slick.geom;
|
|
|
|
import org.newdawn.slick.geom.Shape;
|
|
import org.newdawn.slick.geom.Transform;
|
|
|
|
/**
|
|
* A single point shape
|
|
*
|
|
* @author Kova
|
|
*/
|
|
public class Point extends Shape
|
|
{
|
|
/**
|
|
* Create a new point
|
|
*
|
|
* @param x The x coordinate of the point
|
|
* @param y The y coordinate of the point
|
|
*/
|
|
public Point(float x, float y)
|
|
{
|
|
this.x = x;
|
|
this.y = y;
|
|
checkPoints();
|
|
}
|
|
|
|
/**
|
|
* @see org.newdawn.slick.geom.Shape#transform(org.newdawn.slick.geom.Transform)
|
|
*/
|
|
public Shape transform(Transform transform)
|
|
{
|
|
float result[] = new float[points.length];
|
|
transform.transform(points, 0, result, 0, points.length / 2);
|
|
|
|
return new Point(points[0], points[1]);
|
|
}
|
|
|
|
/**
|
|
* @see org.newdawn.slick.geom.Shape#createPoints()
|
|
*/
|
|
protected void createPoints()
|
|
{
|
|
points = new float[2];
|
|
points[0] = getX();
|
|
points[1] = getY();
|
|
|
|
maxX = x;
|
|
maxY = y;
|
|
minX = x;
|
|
minY = y;
|
|
|
|
findCenter();
|
|
calculateRadius();
|
|
}
|
|
|
|
/**
|
|
* @see org.newdawn.slick.geom.Shape#findCenter()
|
|
*/
|
|
protected void findCenter()
|
|
{
|
|
center = new float[2];
|
|
center[0] = points[0];
|
|
center[1] = points[1];
|
|
}
|
|
|
|
/**
|
|
* @see org.newdawn.slick.geom.Shape#calculateRadius()
|
|
*/
|
|
protected void calculateRadius()
|
|
{
|
|
boundingCircleRadius = 0;
|
|
}
|
|
} |