Skip to content

Commit

Permalink
Updated Readme and version number
Browse files Browse the repository at this point in the history
  • Loading branch information
HexagonNico committed Jun 28, 2024
1 parent e09705a commit faf186b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
39 changes: 38 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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

Expand Down

0 comments on commit faf186b

Please sign in to comment.