Skip to content

Commit

Permalink
updated linalg docs (#1020)
Browse files Browse the repository at this point in the history
* updated linalg docs

* add missing icon, update readme deps
  • Loading branch information
elalish authored Nov 4, 2024
1 parent 4076b14 commit 8e9bdb2
Show file tree
Hide file tree
Showing 13 changed files with 211 additions and 59 deletions.
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = Manifold
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 2.5
PROJECT_NUMBER = 3.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Readme
# About Manifold

[![codecov](https://codecov.io/github/elalish/manifold/branch/master/graph/badge.svg?token=IIA8G5HVS7)](https://codecov.io/github/elalish/manifold)
[![PyPI version](https://badge.fury.io/py/manifold3d.svg)](https://badge.fury.io/py/manifold3d)
Expand All @@ -9,7 +9,7 @@

[OpenSCAD](https://openscad.org/), [IFCjs](https://ifcjs.github.io/info/), [Grid.Space](https://grid.space/), and [OCADml](https://github.com/OCADml/OManifold) have all integrated our Manifold geometry kernel! Why? Because its reliability is guaranteed and it's 1,000 times faster than other libraries. See our [usage](https://github.com/elalish/manifold/discussions/340) and [performance](https://github.com/elalish/manifold/discussions/383) discussions for all the latest and to add your own projects & analyses.

## Manifold Frontend Sandboxes
## Frontend Sandboxes

### [ManifoldCAD.org](https://manifoldcad.org)

Expand All @@ -30,11 +30,14 @@ If you prefer Python to JS/TS, make your own copy of the example notebook above.
This is a modern C++ library that Github's CI verifies builds and runs on a variety of platforms. Additionally, we build bindings for JavaScript ([manifold-3d](https://www.npmjs.com/package/manifold-3d) on npm), Python ([manifold3d](https://pypi.org/project/manifold3d/)), and C to make this library more portable and easy to use.

Optional Dependencies (no dependencies are required anymore, but the first two are encouraged):
- [`tbb`](https://github.com/oneapi-src/oneTBB/): Intel's thread building blocks library (only when `MANIFOLD_PAR=ON`)
- [`TBB`](https://github.com/oneapi-src/oneTBB/): Intel's thread building blocks library (only when `MANIFOLD_PAR=ON`)
- [`Clipper2`](https://github.com/AngusJohnson/Clipper2): provides our 2D subsystem (only when `MANIFOLD_CROSS_SECTION=ON`)
- [`gtest`](https://github.com/google/googletest/): Google test library (only when test is enabled, i.e. `MANIFOLD_TEST=ON`)
- ['Assimp'](https://github.com/assimp/assimp): provides I/O for various 3D formats (only when `MANIFOLD_EXPORT=ON`)
- ['Pybind11](https://github.com/pybind/pybind11): provides Python bindings (only when `MANIFOLD_PYBIND=ON`)
- ['Emscripten'](https://github.com/emscripten-core/emscripten): WASM compiler that provides our JS bindings (only when `MANIFOLD_JSBIND=ON`)
- [`GTest`](https://github.com/google/googletest/): Google test library (only when test is enabled, i.e. `MANIFOLD_TEST=ON`)

## What's Here
### Overview

This library is fast with guaranteed manifold output. As such you need manifold meshes as input, which this library can create using constructors inspired by the OpenSCAD API, as well as more advanced features like smoothing and signed-distance function (SDF) level sets. You can also pass in your own mesh data, but you'll get an error status if the imported mesh isn't manifold. Various automated repair tools exist online for fixing non manifold models, usually for 3D printing.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 24 additions & 5 deletions include/manifold/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
namespace manifold {
/** @addtogroup Math
* @ingroup Core
* @brief Simple operations on scalars, quaternions, and vectors and matrices
* up to dimension 4.
* @brief Simple math operations.
* */

/** @addtogroup Scalar
* @ingroup Math
* @brief Simple scalar operations.
* @{
*/
namespace la = linalg;
Expand All @@ -48,17 +52,32 @@ constexpr double kPi = 3.14159265358979323846264338327950288;
constexpr double kTwoPi = 6.28318530717958647692528676655900576;
constexpr double kHalfPi = 1.57079632679489661923132169163975144;

/**
* Convert degrees to radians.
*
* @param x Angle in degrees.
*/
constexpr double radians(double a) { return a * kPi / 180; }

/**
* Convert radians to degrees.
*
* @param x Angle in radians.
*/
constexpr double degrees(double a) { return a * 180 / kPi; }

/**
* Performs smooth Hermite interpolation between 0 and 1 when edge0 < x < edge1.
*
* @param edge0 Specifies the value of the lower edge of the Hermite function.
* @param edge1 Specifies the value of the upper edge of the Hermite function.
* @param x Specifies the source value for interpolation.
*/
constexpr double smoothstep(double edge0, double edge1, double a) {
const double x = la::clamp((a - edge0) / (edge1 - edge0), 0, 1);
return x * x * (3 - 2 * x);
}

constexpr mat3x4 Identity3x4() { return mat3x4(mat3(la::identity), vec3(0.0)); }
constexpr mat2x3 Identity2x3() { return mat2x3(mat2(la::identity), vec2(0.0)); }

/**
* Sine function where multiples of 90 degrees come out exact.
*
Expand Down
2 changes: 1 addition & 1 deletion include/manifold/cross_section.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class CrossSection {

private:
mutable std::shared_ptr<const PathImpl> paths_;
mutable mat2x3 transform_ = Identity2x3();
mutable mat2x3 transform_ = la::identity;
CrossSection(std::shared_ptr<const PathImpl> paths);
std::shared_ptr<const PathImpl> GetPaths() const;
};
Expand Down
Loading

0 comments on commit 8e9bdb2

Please sign in to comment.