public class Pixel extends Object implements Point2d, Cloneable
Modifier and Type | Field and Description |
---|---|
int |
x
The x-coordinate of this pixel
|
int |
y
The y-coordinate of this pixel
|
Constructor and Description |
---|
Pixel()
Construct a pixel at the origin
|
Pixel(int x,
int y)
Construct a pixel with the given coordinates.
|
Modifier and Type | Method and Description |
---|---|
String |
asciiHeader()
Header for ascii input.
|
byte[] |
binaryHeader()
Header for binary input.
|
Pixel |
clone() |
Pixel |
copy()
Clone the point
|
void |
copyFrom(Point2d p)
Copy the values of the given point into this point.
|
boolean |
equals(Object o) |
int |
getDimensions() |
Integer |
getOrdinate(int dimension)
Get the ordinate value for a specific dimension.
|
float |
getX() |
float |
getY() |
int |
hashCode() |
Point2d |
minus(Point2d a)
Take point point from another point such that return = this - a
|
void |
readASCII(Scanner in)
Read internal state from in.
|
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
setOrdinate(int dimension,
Number value)
Set the ordinate value for a specific dimension.
|
void |
setX(float x)
Set x coordinate of point
|
void |
setY(float y)
Set y coordinate of point
|
String |
toString() |
Pixel |
transform(Jama.Matrix transform)
Transform the point by the given matrix
|
Pixel |
transformInplace(Jama.Matrix transform)
Inplace transform the point by the given matrix.
|
void |
translate(float x,
float y)
Translate the position of the point by the given amounts
|
void |
translate(Point2d v)
Translate the position of the point by the given amounts
|
void |
writeASCII(PrintWriter out)
Write the content of this as ascii to out.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
public int x
public int y
public Pixel(int x, int y)
x
- The x-coordinate of the pixely
- The y-coordinate of the pixelpublic Pixel()
public boolean equals(Object o)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public String toString()
toString
in class Object
Object.toString()
public float getX()
getX
in interface Point2d
Point2d.getX()
public float getY()
getY
in interface Point2d
Point2d.getY()
public void setX(float x)
setX
in interface Point2d
x
- x-coordinatePoint2d.setX(float)
public void setY(float y)
setY
in interface Point2d
y
- y-coordinatePoint2d.setY(float)
public void copyFrom(Point2d p)
copyFrom
in interface Point2d
p
- The point to copy values from.Point2d.copyFrom(org.openimaj.math.geometry.point.Point2d)
public Integer getOrdinate(int dimension)
getOrdinate
in interface Coordinate
dimension
- The index of the dimension we are interested inCoordinate.getOrdinate(int)
public int getDimensions()
getDimensions
in interface Coordinate
Coordinate.getDimensions()
public void translate(float x, float y)
Point2d
public Pixel transform(Jama.Matrix transform)
Point2d
public Pixel transformInplace(Jama.Matrix transform)
transform
- the transformpublic Point2d minus(Point2d a)
Point2d
public void readASCII(Scanner in) throws IOException
ReadableASCII
readASCII
in interface ReadableASCII
in
- source to read from.IOException
- an error reading inputpublic String asciiHeader()
ReadableASCII
asciiHeader
in interface ReadableASCII
asciiHeader
in interface WriteableASCII
public void readBinary(DataInput in) throws IOException
ReadableBinary
readBinary
in interface ReadableBinary
in
- source to read from.IOException
- an error reading inputpublic byte[] binaryHeader()
ReadableBinary
binaryHeader
in interface ReadableBinary
binaryHeader
in interface WriteableBinary
public void writeASCII(PrintWriter out) throws IOException
WriteableASCII
writeASCII
in interface WriteableASCII
out
- sink to write toIOException
- an error writing to outpublic void writeBinary(DataOutput out) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
out
- sink to write toIOException
- an error writing to outpublic void translate(Point2d v)
Point2d
public void setOrdinate(int dimension, Number value)
Coordinate
setOrdinate
in interface Coordinate
dimension
- The index of the dimension we are interested invalue
- The value of the ordinate of the given dimension.