T
- Type of point, currently can be Node or Vertpublic abstract class PointsList<T extends PointsList<T>> extends Object
This abstract class contains basic properties of points and provides method for moving across the list. Points in list are numbered from 1 and list can be looped. There is one special node called head that indicates beginning of the list (and its end if the list is looped). PointList is assumed to be infinite long and may not be looped.
Modifier and Type | Field and Description |
---|---|
protected boolean |
head
Indicate if this point is head.
|
protected T |
next
Next point in list, null if no other point.
|
protected ExtendedVector2d |
normal
Normal vector.
|
protected ExtendedVector2d |
point
x,y co-ordinates of the point.
|
protected double |
position
Normalized position on list.
|
protected T |
prev
Previous point in list, null if no other point.
|
protected ExtendedVector2d |
tan
tangent vector.
|
protected int |
tracknumber
ID number of point, unique across list.
|
Constructor and Description |
---|
PointsList()
Default constructor, assumes that first point is created on list with ID = 1.
|
PointsList(double xx,
double yy,
int t)
Creates point with given ID and coordinates.
|
PointsList(int t)
Create point with given ID.
|
PointsList(PointsList<?> src)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
void |
freeze()
Freeze Point.
|
double |
getCurvatureLocal()
Evaluate local curvature of T related to previous, this and next T.
|
T |
getNext()
Get next node in chain (previous if not clockwise).
|
ExtendedVector2d |
getNormal()
Gets the normal.
|
ExtendedVector2d |
getPoint()
Gets the point.
|
double |
getPosition()
Get normalised position of node.
|
T |
getPrev()
Get previous node in chain (next if not clockwise).
|
ExtendedVector2d |
getTangent()
Gets the tangent.
|
int |
getTrackNum()
Gets the track num.
|
double |
getX()
point getter.
|
double |
getY()
point getter.
|
int |
hashCode() |
boolean |
isFrozen()
Getter to frozen field.
|
boolean |
isHead()
Checks if is head.
|
static void |
randDirection()
Set direction of list.
|
static void |
setClockwise(boolean b)
Sets the clockwise.
|
void |
setHead(boolean t)
Set head marker to current node.
|
void |
setNext(T n)
Adds next (or previous if not clockwise) Node to list.
|
void |
setNormal(double x,
double y)
Sets the normal.
|
void |
setPosition(double position)
Set normalised position of node.
|
void |
setPrev(T n)
Adds previous (or next if not clockwise) Node to list.
|
void |
setTrackNum(int b)
Sets the track num.
|
void |
setX(double x)
Set X space co-ordinate.
|
void |
setY(double y)
Set Y space co-ordinate.
|
String |
toString() |
void |
unfreeze()
Unfreeze Point.
|
void |
updateNormale(boolean inner)
Updates the normal (must point inwards).
|
protected transient T extends PointsList<T> prev
protected transient T extends PointsList<T> next
protected ExtendedVector2d point
protected ExtendedVector2d normal
updateNormale(boolean)
and implicitly by
Shape.updateNormals(boolean)
from Shape during
serialization and deserialization and changing the shape of Shapeprotected ExtendedVector2d tan
protected boolean head
protected int tracknumber
protected double position
0 - beginning , 1 - end of the list according to Shape perimeter. Set by com.github.celldynamics.quimp.Shape.setPositions() and called before and after serialise and on Shape writing.
public PointsList()
public PointsList(int t)
Caller should care about correct numbering of points
t
- ID of pointpublic PointsList(PointsList<?> src)
Previous or next points are not copied
src
- Source Pointpublic PointsList(double xx, double yy, int t)
Caller should care about correct numbering of points
xx
- x coordinate of pointyy
- y coordinate of pointt
- ID of pointpublic double getX()
public double getY()
public void setX(double x)
x
- coordinatepublic void setY(double y)
y
- coordinatepublic static void setClockwise(boolean b)
b
- the new clockwisepublic ExtendedVector2d getPoint()
public int getTrackNum()
public ExtendedVector2d getNormal()
public ExtendedVector2d getTangent()
public double getPosition()
public void setPosition(double position)
position
- the position to setpublic boolean isHead()
public void setNormal(double x, double y)
x
- the xy
- the ypublic void setTrackNum(int b)
b
- the new track numpublic void setHead(boolean t)
Warning
Only one Node in Snake can be head
t
- true if current node is head, false otherwiseShape.setHead(int)
,
Snake
public T getPrev()
public T getNext()
public void setPrev(T n)
n
- Node to addpublic void setNext(T n)
n
- Node to addpublic void updateNormale(boolean inner)
inner
- innerpublic static void randDirection()
public void freeze()
public void unfreeze()
public boolean isFrozen()
public double getCurvatureLocal()
Copyright © 2002–2019 Department of Computer Science, Warwick University. All rights reserved.