public class MTBSnakePoint2D extends Point2D.Double
Class to implement 2D snake points with a special structure: (snake points means control points of the snake, on which the snake energy is calculated and optimized) - every snake point has an old index (position) within the snake, if the point does not exists before, the old index is set to -1 by default - every snake point has a Point2D.Double object for point coordinates
Point2D.Double, Point2D.Float
Modifier and Type | Field and Description |
---|---|
protected int |
oldId
Old index (position) of the point within the snake.
|
private static long |
serialVersionUID |
x, y
Constructor and Description |
---|
MTBSnakePoint2D()
Standard constructor to create a new SnakePoint2D
|
MTBSnakePoint2D(double _x,
double _y)
Constructor to create a new SnakePoint2D with x- and y-coordinates for the
point.
|
MTBSnakePoint2D(Point2D.Double p)
Constructor to create a new SnakePoint2D from the specified Point2D.Double
object.
|
Modifier and Type | Method and Description |
---|---|
MTBSnakePoint2D |
clone()
Override java.lang.Object.clone() to create and return a copy of this
object.
|
int |
getOldId()
Get previous index of snake point from the previous snake.
|
void |
setLocation(double _x,
double _y)
Overwrites Java Point2D method.
|
void |
setLocation(double _x,
double _y,
int _oldId)
Sets the location of this SnakePoint2D to the specified double coordinates.
|
void |
setLocation(Point2D.Double p,
int _oldId)
Sets the location of this SnakePoint2D to the same coordinates as the
specified Point2D.Double object.
|
void |
setLocation(Point2D p)
Overwrites Java Point2D method.
|
void |
setOldId(int _oldId)
Set old index of current snake point within the snake.
|
getX, getY, toString
distance, distance, distance, distanceSq, distanceSq, distanceSq, equals, hashCode
private static final long serialVersionUID
protected int oldId
public MTBSnakePoint2D()
public MTBSnakePoint2D(double _x, double _y)
_x
- x-coordinate of the snake point_y
- y-coordinate of the snake pointpublic MTBSnakePoint2D(Point2D.Double p)
p
- Point2D.Double object with coordinates for new 2D snake pointpublic void setOldId(int _oldId)
_oldId
- old index of the point point in the previous snakepublic void setLocation(double _x, double _y)
setLocation
in class Point2D.Double
public void setLocation(Point2D p)
setLocation
in class Point2D
public void setLocation(Point2D.Double p, int _oldId)
p
- 2D point with new coordinates for the current 2D snake point_oldId
- old index of the point within the snakepublic void setLocation(double _x, double _y, int _oldId)
_x
- new x-coordinate of the current 2D snake point_y
- new y-coordinate of the current 2D snake point_oldId
- old index of the point within the snakepublic int getOldId()
public MTBSnakePoint2D clone()
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.