import kotlin.math.* fun Point.rotate(theta: Double) { val x0 = x val y0 = y x = x0 * cos(theta) - y0 * sin(theta) y = x0 * sin(theta) + y0 * cos(theta) } fun main() { val p = Point(1.0, 0.0) p.rotate(PI / 6) p.show() }