removed unnecessary class Light10B, minor fixes for LightmapRenderer

Former-commit-id: 4cddfb080cc689738d9bf308f7d08852f4c78a8b
Former-commit-id: 2354b2483f30e70862a327c1b9688a19bd1b2f66
This commit is contained in:
Song Minjae
2016-09-07 22:58:42 +09:00
parent d817c586e9
commit 9b9b65efba
31 changed files with 3718 additions and 134 deletions

View File

@@ -1,5 +1,7 @@
package net.torvald.point
import org.dyn4j.geometry.Vector2
/**
* Created by minjaesong on 16-01-15.
*/
@@ -13,4 +15,35 @@ class Point2d(var x: Double, var y: Double) : Cloneable {
this.x = x
this.y = y
}
fun set(other: Point2d) {
this.x = other.x
this.y = other.y
}
/**
* Rotate transform this point, with pivot (0, 0)
* @return new Point2d that is rotated
*/
infix fun rot(deg_delta: Double) = Point2d(
x * Math.cos(deg_delta) - y * Math.sin(deg_delta),
x * Math.sin(deg_delta) + y * Math.cos(deg_delta)
)
fun translate(other: Point2d) {
x += other.x
y += other.y
}
fun translate(tx: Double, ty: Double) {
x += tx
y += ty
}
operator fun plus(other: Point2d) = Point2d(x + other.x, y + other.y)
operator fun minus(other: Point2d) = Point2d(x - other.x, y - other.y)
operator fun times(scalar: Double) = Point2d(x * scalar, y * scalar)
operator fun times(other: Point2d) = Point2d(x * other.x, y * other.y)
operator fun div(scalar: Double) = Point2d(x / scalar, y / scalar)
operator fun div(other: Point2d) = Point2d(x / other.x, y / other.y)
fun toVector() = Vector2(x, y)
}