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

commonMain.adjust.extensions.TangentAngle.kt Maven / Gradle / Ivy

There is a newer version: 0.4.5-alpha6
Show newest version
package org.openrndr.extra.shapes.adjust.extensions

import org.openrndr.extra.shapes.adjust.ContourAdjusterVertex
import org.openrndr.extra.shapes.vertex.ContourVertex
import kotlin.math.acos

val ContourVertex.angleBetweenTangents: Double
    get() {
        return if (tangentIn != null && tangentOut != null) {
            acos(tangentIn!!.normalized.dot(tangentOut!!.normalized))
        } else {
            0.0
        }
    }

val ContourAdjusterVertex.angleBetweenTangents: Double
    get() {
        return ContourVertex(contourAdjuster.contour, segmentIndex()).angleBetweenTangents
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy