public class Tile extends Object
Constructor and Description |
---|
Tile(double width,
double height,
Model model)
Constructor
|
Tile(float width,
float height,
Model model)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
addConnectedTile(Tile t)
Add a
Tile to the set of connected tiles. |
boolean |
addMatch(PointMatch match)
Add one match.
|
boolean |
addMatches(Collection<PointMatch> more)
Add more
PointMatch es. |
void |
connect(Tile o,
Collection<PointMatch> matches)
connect two tiles by a set of point correspondences
re-weighs the point correpondences
We set a weigh of 1.0 / num_matches to each correspondence to equalize
the connections between tiles during minimization.
|
boolean |
diceBetterModel(int max_num_tries,
float scale)
randomly dice new model until the error is smaller than the old one
|
void |
fitModel()
Update the transformation
Model . |
ArrayList<Tile> |
getConnectedTiles() |
double |
getDistance() |
double |
getError() |
float |
getHeight() |
ArrayList<PointMatch> |
getMatches() |
Model |
getModel() |
float[] |
getWC() |
float |
getWidth() |
static ArrayList<ArrayList<Tile>> |
identifyConnectedGraphs(Collection<Tile> tiles)
Identify the set of connected graphs that contains all given tiles.
|
boolean |
intersects(Tile t)
Check if the
Tile intersects another. |
boolean |
isInside(float[] point)
Check if a point that is given in world coordinates is inside the tile.
|
boolean |
removeConnectedTile(Tile t)
|
void |
resetConnectedTiles() |
void |
resetMatches() |
void |
resetTile() |
void |
update()
Apply the current
Model to all local point coordinates. |
void |
updateByStrength(float amount)
Apply the current
Model to all local point coordinates by weight. |
public Tile(float width, float height, Model model)
public final float getWidth()
public final float getHeight()
public float[] getWC()
public final Model getModel()
public final ArrayList<PointMatch> getMatches()
public final void resetMatches()
public final void resetConnectedTiles()
public final void resetTile()
public final boolean addConnectedTile(Tile t)
t
- the new Tile
.public final boolean removeConnectedTile(Tile t)
t
- the Tile
to be removed.public final double getError()
public final double getDistance()
public final boolean addMatches(Collection<PointMatch> more)
PointMatch
es.more
- the PointMatch
es to be added.public final boolean addMatch(PointMatch match)
match
- the PointMatch
to be added.public final void update()
Model
to all local point coordinates.
Update average transfer error.public final void updateByStrength(float amount)
Model
to all local point coordinates by weight.
Update average transfer error.public final boolean diceBetterModel(int max_num_tries, float scale)
max_num_tries
- maximal number of tries before returning false (which means "no better model found")scale
- strength of shakingpublic final void fitModel() throws NotEnoughDataPointsException
Model
. That is, fit it to the
current set of PointMatch
es.NotEnoughDataPointsException
public final void connect(Tile o, Collection<PointMatch> matches)
o
- matches
- public static final ArrayList<ArrayList<Tile>> identifyConnectedGraphs(Collection<Tile> tiles)
tiles
- public final boolean isInside(float[] point) throws Exception
point
- Exception
public final boolean intersects(Tile t) throws Exception
Tile
intersects another.
TODO: The intersection test checks for the eight corners of both tiles
only. This implies, that the transformation is linear and invertable.
!!!!This is wrong:
+-+ +-----+
| | | |
+-+-+-+ | +-+ |
| | | | | | | |
+-+-+-+ | +-+ |
| | | |
+-+ +-----+
Test for edge intersections and points: If only one single edge of
this intersects with one of t both tiles intersect.Copyright © 2015–2021 Fiji. All rights reserved.