public class Int2 extends Object implements EuclidConstants
C_AMP, C_APOS, C_ATSIGN, C_BACKSLASH, C_BACKSPACE, C_CARET, C_COLON, C_COMMA, C_DEL, C_DOLLAR, C_EQUALS, C_FORMFEED, C_HASH, C_LANGLE, C_LBRAK, C_LCURLY, C_LSQUARE, C_MINUS, C_NBSP, C_NEWLINE, C_NL, C_PERCENT, C_PERIOD, C_PIPE, C_PLUS, C_POUND, C_QUERY, C_QUOT, C_RANGLE, C_RBRAK, C_RCURLY, C_RETURN, C_RSQUARE, C_SEMICOLON, C_SHRIEK, C_SLASH, C_SPACE, C_STAR, C_TAB, C_TILDE, C_UNDER, EPS, F_S, NONWHITEPUNC, NONWHITEPUNC0, NONWHITEPUNC0REGEX, ONE_THIRD, PUNC, S_AMP, S_APOS, S_ATSIGN, S_BACKSLASH, S_CARET, S_COLON, S_COMMA, S_DOLLAR, S_EMPTY, S_EQUALS, S_FORMFEED, S_HASH, S_LANGLE, S_LBRAK, S_LCURLY, S_LSQUARE, S_MINUS, S_NEWLINE, S_NL, S_PERCENT, S_PERIOD, S_PIPE, S_PLUS, S_POUND, S_QUERY, S_QUOT, S_RANGLE, S_RBRAK, S_RCURLY, S_RETURN, S_RSQUARE, S_SEMICOLON, S_SHRIEK, S_SLASH, S_SPACE, S_STAR, S_TAB, S_TILDE, S_UNDER, S_WHITEREGEX, TWO_THIRDS, U_S, WHITESPACE| Constructor and Description |
|---|
Int2()
constructor.
|
Int2(Int2 r)
copy constructor
|
Int2(int x,
int y)
constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
set to 0, 0
|
Int2 |
decrementX()
subtracts 1 from x value.
|
Int2 |
decrementY()
subtracts 1 from y value.
|
int |
dotProduct(Int2 r)
get dot product
|
int |
elementAt(int elem)
get either value; counts from ZERO
|
boolean |
equals(Object obj) |
double |
getEuclideanDistance(Int2 int2) |
static Int2 |
getInt2(Real2 xy2)
cast a Real2 into an Int2.
|
double |
getManhattanDistance(Int2 int2) |
Int2 |
getMidPoint(Int2 p)
point midway between 'this' and 'p'
|
int |
getX()
get X value
|
int |
getY()
get Y value
|
int |
hashCode() |
Int2 |
incrementX()
adds 1 to x value.
|
Int2 |
incrementY()
adds 1 to y value.
|
static boolean |
isEqual(Int2 xy0,
Int2 xy1)
compares two Int2s.
|
boolean |
isEqualTo(Int2 r)
is equal to.
|
Int2 |
multiplyBy(int f)
multiply a point by a scalar
|
void |
negative()
multiply both components by minus one MODIFIES 'this'
|
Int2 |
plus(Int2 r2)
add two points to give vector sum
|
void |
setX(int xx)
set x.
|
void |
setY(int yy)
set y.
|
void |
sortAscending()
sorts x and y so that x <= y
|
void |
sortDescending()
sorts x and y so that x >= y
|
Int2 |
subtract(Int2 r2)
subtract two points to give vector difference
|
void |
swap()
swaps the x and y values
|
String |
toString()
to string.
|
public Int2()
public Int2(int x,
int y)
x - y - public Int2(Int2 r)
r - public static Int2 getInt2(Real2 xy2)
xy2 - public void swap()
public void sortAscending()
public void sortDescending()
public void clear()
public void setX(int xx)
xx - public void setY(int yy)
yy - public boolean isEqualTo(Int2 r)
r - public Int2 plus(Int2 r2)
r2 - public Int2 subtract(Int2 r2)
r2 - public void negative()
public Int2 multiplyBy(int f)
f - public int getX()
public int getY()
public int elementAt(int elem)
throws EuclidRuntimeException
elem - EuclidRuntimeExceptionpublic Int2 getMidPoint(Int2 p)
p - public int dotProduct(Int2 r)
r - public double getEuclideanDistance(Int2 int2)
public double getManhattanDistance(Int2 int2)
public Int2 incrementX()
public Int2 decrementX()
public Int2 incrementY()
public Int2 decrementY()
Copyright © 1994–2024 Peter Murray-Rust. All rights reserved.