All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.data2viz.path.PathAdapter.kt Maven / Gradle / Ivy

There is a newer version: 0.7.1-RC2
Show newest version
package io.data2viz.path

import kotlin.math.*

fun svgPath(): SvgPath = SvgPath()

internal const val TAU = 2 * PI
internal const val EPSILON = 1e-6
internal const val tauEpsilon = TAU - EPSILON

/**
 * Common path denominator between Canvas, SVG, JavaFX, Android
 */
interface PathAdapter {
    fun moveTo(x: Double, y: Double)
    fun lineTo(x: Double, y: Double)
    fun closePath()
    fun quadraticCurveTo(cpx: Double, cpy: Double, x: Double, y: Double)
    fun bezierCurveTo(cpx1: Double, cpy1: Double, cpx2: Double, cpy2: Double, x: Double, y: Double)
    fun arcTo(cpx: Double, cpy: Double, x: Double, y: Double, radius: Double)
    fun arc(
        centerX: Double,
        centerY: Double,
        radius: Double,
        startAngle: Double,
        endAngle: Double,
        counterClockWise: Boolean = false
    )

    fun rect(x: Double, y: Double, w: Double, h: Double)
}






© 2015 - 2024 Weber Informatics LLC | Privacy Policy