|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmegamek.common.IdealHex
public class IdealHex
Represents a hex, not in the game but in an ideal coordinate system. Used for Compute.intervening() calculations and a few others. This ideal hex is 2.0 units tall. Tries to keep a cache of IdealHexes requested, as intervening() sure wants a lot of hexes sometimes.
| Field Summary | |
|---|---|
double |
cx
|
double |
cy
|
static int |
LEFT
|
static int |
RIGHT
|
static int |
STRAIGHT
|
double[] |
x
|
double[] |
y
|
| Constructor Summary | |
|---|---|
IdealHex(Coords c)
|
|
| Method Summary | |
|---|---|
static void |
ensureCacheSize(int width,
int height)
Ensures that the cache will be at least the specified dimensions. |
static IdealHex |
get(Coords coords)
Gets a hex from the cache, if it exists in the cache. |
boolean |
isIntersectedBy(double x0,
double y0,
double x1,
double y1)
Returns true if this hex is intersected by the line |
static int |
turns(double x0,
double y0,
double x1,
double y1,
double x2,
double y2)
Tests whether a line intersects a point or the point passes to the left or right of the line. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LEFT
public static final int STRAIGHT
public static final int RIGHT
public double[] x
public double[] y
public double cx
public double cy
| Constructor Detail |
|---|
public IdealHex(Coords c)
| Method Detail |
|---|
public boolean isIntersectedBy(double x0,
double y0,
double x1,
double y1)
public static int turns(double x0,
double y0,
double x1,
double y1,
double x2,
double y2)
public static void ensureCacheSize(int width,
int height)
public static IdealHex get(Coords coords)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||