korma-shape

Mathematic library for Multiplatform Kotlin 1.3

License

License

Categories

Categories

ORM Data
GroupId

GroupId

com.soywiz.korlibs.korma
ArtifactId

ArtifactId

korma-shape-iosarm64
Last Version

Last Version

2.1.1
Release Date

Release Date

Type

Type

pom
Description

Description

korma-shape
Mathematic library for Multiplatform Kotlin 1.3
Project URL

Project URL

https://github.com/korlibs/korma
Source Code Management

Source Code Management

https://github.com/korlibs/korma

Download korma-shape-iosarm64

How to add to project

<!-- https://jarcasting.com/artifacts/com.soywiz.korlibs.korma/korma-shape-iosarm64/ -->
<dependency>
    <groupId>com.soywiz.korlibs.korma</groupId>
    <artifactId>korma-shape-iosarm64</artifactId>
    <version>2.1.1</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.soywiz.korlibs.korma/korma-shape-iosarm64/
implementation 'com.soywiz.korlibs.korma:korma-shape-iosarm64:2.1.1'
// https://jarcasting.com/artifacts/com.soywiz.korlibs.korma/korma-shape-iosarm64/
implementation ("com.soywiz.korlibs.korma:korma-shape-iosarm64:2.1.1")
'com.soywiz.korlibs.korma:korma-shape-iosarm64:pom:2.1.1'
<dependency org="com.soywiz.korlibs.korma" name="korma-shape-iosarm64" rev="2.1.1">
  <artifact name="korma-shape-iosarm64" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.soywiz.korlibs.korma', module='korma-shape-iosarm64', version='2.1.1')
)
libraryDependencies += "com.soywiz.korlibs.korma" % "korma-shape-iosarm64" % "2.1.1"
[com.soywiz.korlibs.korma/korma-shape-iosarm64 "2.1.1"]

Dependencies

compile (2)

Group / Artifact Type Version
com.soywiz.korlibs.korma : korma-iosarm64 jar 2.1.1
org.jetbrains.kotlin : kotlin-stdlib-common jar 1.5.0

Project Modules

There are no modules declared in this project.

Korma

Korma

Korma is a Mathematical Library mostly focused on geometry for Multiplatform Kotlin 1.3

Build Status Maven Version Discord

Support korma

If you like korma, or want your company logo here, please consider becoming a sponsor ★,
in addition to ensure the continuity of the project, you will get exclusive content.

Info:

It includes structures for Points and Matrices (2D and 3D), Typed Angles, Rectangles, BoundsBuilder, Anchors, Vector graphics with Bezier curves support and Context2D-like API for building vectors, Interpolation facilities, Easing, Triangulation, BinPacking and Path Finding in Bidimensional arrays and Triangulated Spatial Meshes.

Full Documentation: https://korlibs.soywiz.com/korma/

Some samples:

val vector = VectorPath {
    // Here we can use moveTo, lineTo, quadTo, cubicTo, circle, ellipse, arc...
    rect(0, 0, 100, 100)
    rect(300, 0, 100, 100)
}.triangulate().toString()
// "[[Triangle((0, 100), (100, 0), (100, 100)), Triangle((0, 100), (0, 0), (100, 0))], [Triangle((300, 100), (400, 0), (400, 100)), Triangle((300, 100), (300, 0), (400, 0))]]"

// Angles
val angle = 90.degrees
val angleInRadians = angle.radians

// Matrices
val a = Matrix(2, 1, 1, 2, 10, 10)
val b = a.inverted()
assertEquals(identity, a * b)

// Rectangle + ScaleMode + Anchor
assertEquals(Rectangle(0, -150, 600, 600), Size(100, 100).applyScaleMode(Rectangle(0, 0, 600, 300), ScaleMode.COVER, Anchor.MIDDLE_CENTER))

// PathFinding (Matrix)
val points = AStar.find(
    board = Array2("""
        .#....
        .#.##.
        .#.#..
        ...#..
    """) { c, x, y -> c == '#' },
    x0 = 0,
    y0 = 0,
    x1 = 4,
    y1 = 2,
    findClosest = false
)
println(points)
// [(0, 0), (0, 1), (0, 2), (0, 3), (1, 3), (2, 3), (2, 2), (2, 1), (2, 0), (3, 0), (4, 0), (5, 0), (5, 1), (5, 2), (4, 2)]

// PathFinding (Shape)
assertEquals(
    "[(10, 10), (100, 50), (120, 52)]",
    (Rectangle(0, 0, 100, 100).toShape() + Rectangle(100, 50, 50, 50).toShape()).pathFind(
        IPoint(10, 10),
        IPoint(120, 52)
    ).toString()
)

Usage with gradle:

def kormaVersion = "1.9.1"

repositories {
    maven { url "https://dl.bintray.com/korlibs/korlibs" }
}

dependencies {
    // For multiplatform projects
    implementation "com.soywiz.korlibs.korma:korma:$kormaVersion"
    
    // For JVM/Android only
    implementation "com.soywiz.korlibs.korma:korma-jvm:$kormaVersion"
    // For JS only
    implementation "com.soywiz.korlibs.korma:korma-js:$kormaVersion"
}

// Additional funcionality using Clipper and poly2try code (with separate licenses):
// - https://github.com/korlibs/korma/blob/master/korma-shape/LICENSE
dependencies {
    implementation "com.soywiz.korlibs.korma:korma-shape:$kormaVersion"
}

// settigs.gradle
enableFeaturePreview('GRADLE_METADATA')
com.soywiz.korlibs.korma
Kotlin cORoutine Libraries for fullstack development - https://bintray.com/korlibs/korlibs - https://github.com/korlibs

Versions

Version
2.1.1
2.0.9