## net.aerith.misao.util Class MapFunction

```java.lang.Object
|
+--net.aerith.misao.util.MapFunction
```

public class MapFunction
extends java.lang.Object

The `MapFunction` represents a function to convert (x,y) position into (x',y') on another system. It consists of (x,y) position on another system where the (0,0) position will be mapped, the magnification ratio and the rotational angle.

The mapping calculation is:

```     (x', y') = r * R_angle (x, y) + (x0, y0)
```
when r represents ratio, R_angle represents rotation by angle in the anti-clockwise direction when the positive directions of (x,y) are to the right and to the top, and (x0, y0) represents the position where the (0,0) will be mapped.

 Field Summary `protected static double` `acceptable_angle`           The acceptable accuracy of angle. `protected static double` `acceptable_ratio`           The acceptable accuracy of ratio. `protected  double` `angle`           The rotational angle in the anti-clockwise direction. `protected  Position` `base_position`           The position where (0,0) will be mapped. `protected  double` `ratio`           The magnification ratio.

 Constructor Summary `MapFunction()`           Constructs a default `MapFunction`, which maps onto the same system. ```MapFunction(Triangle triangle1, Triangle triangle2)```           Constructs a `MapFunction` to map the specified first triangle into the second triangle. `MapFunction(java.util.Vector pair_list)`           Constructs a `MapFunction` to map the first position of the specified pair list into the second position of the specified pair list. ```MapFunction(java.util.Vector pair_list, DistortionField df)```           Constructs a `MapFunction` to map the first position of the specified pair list into the second position of the specified pair list.

 Method Summary ` double` `getAngle()`           Gets the rotational angle. ` java.lang.String` `getOutputString()`           Returns a string representation of the state of this object. ` double` `getRatio()`           Gets the magnification ratio. ` MapFunction` `inverse()`           Gets the inverse function of this map function. ` Position` `map(Position position)`           Maps a position into the (x,y) on the another system.

 Methods inherited from class java.lang.Object ```, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait```

 Field Detail

### base_position

`protected Position base_position`
The position where (0,0) will be mapped.

### ratio

`protected double ratio`
The magnification ratio.

### angle

`protected double angle`
The rotational angle in the anti-clockwise direction.

### acceptable_ratio

`protected static final double acceptable_ratio`
The acceptable accuracy of ratio.

### acceptable_angle

`protected static final double acceptable_angle`
The acceptable accuracy of angle.
 Constructor Detail

### MapFunction

`public MapFunction()`
Constructs a default `MapFunction`, which maps onto the same system.

### MapFunction

`public MapFunction(java.util.Vector pair_list)`
Constructs a `MapFunction` to map the first position of the specified pair list into the second position of the specified pair list.
Parameters:
`pair_list` - the list of pairs of (x,y) positions.

### MapFunction

```public MapFunction(java.util.Vector pair_list,
DistortionField df)```
Constructs a `MapFunction` to map the first position of the specified pair list into the second position of the specified pair list.
Parameters:
`pair_list` - the list of pairs of (x,y) positions.
`df` - the distortion field.

### MapFunction

```public MapFunction(Triangle triangle1,
Triangle triangle2)
throws java.lang.ArithmeticException```
Constructs a `MapFunction` to map the specified first triangle into the second triangle.
Parameters:
`triangle1` - the first triangle.
`triangle2` - the second triangle.
Throws:
java.lang.ArithmeticException - if the two triangles are not similar.
 Method Detail

### map

`public Position map(Position position)`
Maps a position into the (x,y) on the another system.
Parameters:
`position` - the (x,y) on the source system.
Returns:
the position on the another system.

### inverse

`public MapFunction inverse()`
Gets the inverse function of this map function.
Returns:
the inverse function of this map function.

### getRatio

`public double getRatio()`
Gets the magnification ratio.
Returns:
the magnification ratio.

### getAngle

`public double getAngle()`
Gets the rotational angle.
Returns:
the rotational angle.

### getOutputString

`public java.lang.String getOutputString()`
Returns a string representation of the state of this object.
Returns:
a string representation of the state of this object.