From faf186b8ce44f6457e02540cac33df6d1c82e380 Mon Sep 17 00:00:00 2001 From: Nico Date: Fri, 28 Jun 2024 17:33:43 +0200 Subject: [PATCH] Updated Readme and version number --- Readme.md | 39 ++++++++++++++++++++++++++++++++++++++- build.sbt | 4 ++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 707ec01..bdad80e 100644 --- a/Readme.md +++ b/Readme.md @@ -10,10 +10,47 @@ GeomLib is an extension of [VecMatLib](https://github.com/ScalaMath/VecMatLib) f All operations in GeomLib are designed to **not** modify the object on which the operation is invoked to respect the principles of purity and immutability of functional programming. All classes are written in Scala, but are designed to be completely interoperable with Java. +All methods with symbolic names have an alias for better interoperability with java. ## Geometry and shapes -TODO: Add description here +GeomLib offers a representation for primitive 2D and 3D shapes useful for collision detection algorithms and graphics rendering such as Rectangles, Circles, Spheres and Axis-Aligned Bounding Boxes. + +Scala example: + +```scala +val rect1 = Rect2(2.0f, 1.0f, 4.0f, 3.0f) +val rect2 = Rect2(3.0f, 2.0f, 5.0f, 4.0f) +if(rect1.intersects(rect2)) { + // ... +} +``` + +Java example: + +```java +Rect2 rect1 = new Rect2(2.0f, 1.0f, 4.0f, 3.0f); +Rect2 rect2 = new Rect2(3.0f, 2.0f, 5.0f, 4.0f); +if(rect1.intersects(rect2)) { + // ... +} +``` + +GeomLib can also be used together with [VecMatLib](https://github.com/ScalaMath/VecMatLib) to represent geometric transformations. + +```scala +val transform = Mat3x4f.translation(x, y, z) * Mat4f.rotation(x, y, z) * Mat4f.scaling(x, y, z) +val plane = Plane(0.0f, 1.0f, 0.0f, 2.0f) +val transformedPlane = transform * plane +``` + +```java +var transform = Mat3x4f.translation(x, y, z) + .multiply(Mat4f.rotation(x, y, z)) + .multiply(Mat4f.scaling(x, y, z)); +var plane = new Plane(0.0f, 1.0f, 0.0f, 2.0f); +var transformedPlane = plane.transform(transform); +``` ## Multithreading diff --git a/build.sbt b/build.sbt index 0818f6f..2df4a34 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ // Project info name := "GeomLib" homepage := Some(url("https://github.com/ScalaMath/GeomLib")) -version := "1.0-SNAPSHOT" +version := "1.0" description := "A Scala library for geometry and primitive shapes" // Organization info organization := "io.github.scalamath" @@ -17,7 +17,7 @@ crossPaths := false libraryDependencies += "io.github.scalamath" % "vecmatlib" % "3.1" // Scala test dependency -libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.18" % Test +libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.19" % Test // Junit test dependency libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test