All Projects → ebassi → Graphene

ebassi / Graphene

Licence: mit
A thin layer of graphic data types

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Graphene

glm
OpenGL Mathematics (GLM)
Stars: ✭ 6,667 (+2387.69%)
Mutual labels:  vector, matrix, mathematics, simd
Math Php
Powerful modern math library for PHP: Features descriptive statistics and regressions; Continuous and discrete probability distributions; Linear algebra with matrices and vectors, Numerical analysis; special mathematical functions; Algebra
Stars: ✭ 2,009 (+649.63%)
Mutual labels:  matrix, vector, mathematics
Mathematics for Machine Learning
Learn mathematics behind machine learning and explore different mathematics in machine learning.
Stars: ✭ 28 (-89.55%)
Mutual labels:  vector, matrix, mathematics
SCNMathExtensions
Math extensions for SCNVector3, SCNQuaternion, SCNMatrix4
Stars: ✭ 32 (-88.06%)
Mutual labels:  vector, matrix, simd
Libxsmm
Library for specialized dense and sparse matrix operations, and deep learning primitives.
Stars: ✭ 518 (+93.28%)
Mutual labels:  matrix, vector, simd
Cgmath
A linear algebra and mathematics library for computer graphics.
Stars: ✭ 773 (+188.43%)
Mutual labels:  matrix, vector, simd
Cglm
📽 Highly Optimized Graphics Math (glm) for C
Stars: ✭ 887 (+230.97%)
Mutual labels:  matrix, vector, simd
Ugm
Ubpa Graphics Mathematics
Stars: ✭ 178 (-33.58%)
Mutual labels:  matrix, simd, mathematics
sparse
Sparse matrix formats for linear algebra supporting scientific and machine learning applications
Stars: ✭ 136 (-49.25%)
Mutual labels:  vector, matrix
LinAlg
实现一个线性代数库,为Python写扩展。《程序猿的数学3 线性代数》读后笔记
Stars: ✭ 17 (-93.66%)
Mutual labels:  vector, matrix
GenericTensor
The only library allowing to create Tensors (matrices extension) with custom types
Stars: ✭ 42 (-84.33%)
Mutual labels:  vector, matrix
Mathematics for Machine Learning
Notes and step-by-step exercises resolution to aid students learning the base math for machine learning. Content summed up from the the course from the Imperial London College in Coursera.
Stars: ✭ 44 (-83.58%)
Mutual labels:  matrix, mathematics
nmu
neg4n's mathematics utilities
Stars: ✭ 17 (-93.66%)
Mutual labels:  vector, mathematics
mir-glas
[Experimental] LLVM-accelerated Generic Linear Algebra Subprograms
Stars: ✭ 99 (-63.06%)
Mutual labels:  matrix, simd
Tensor
A library and extension that provides objects for scientific computing in PHP.
Stars: ✭ 146 (-45.52%)
Mutual labels:  vector, matrix
matrixgl
Yet another matrix library for WebGL
Stars: ✭ 25 (-90.67%)
Mutual labels:  vector, matrix
Turbo-Transpose
Transpose: SIMD Integer+Floating Point Compression Filter
Stars: ✭ 50 (-81.34%)
Mutual labels:  matrix, simd
JOLI.jl
Julia Operators LIbrary
Stars: ✭ 14 (-94.78%)
Mutual labels:  vector, matrix
matlib
Matrix Functions for Teaching and Learning Linear Algebra and Multivariate Statistics, http://friendly.github.io/matlib/
Stars: ✭ 55 (-79.48%)
Mutual labels:  vector, matrix
Swiftish
A fully generic Swift vector & matrix library
Stars: ✭ 17 (-93.66%)
Mutual labels:  vector, matrix

Graphene

A thin layer of types for graphic libraries

Linux Build MSVC Build MSYS2 Build Coverage Status License: MIT

When creating graphic libraries you most likely end up dealing with points and rectangles. If you're particularly unlucky, you may end up dealing with affine matrices and 2D transformations. If you're writing a graphic library with 3D transformations, though, you are going to hit the jackpot: 4x4 matrices, projections, transformations, vectors, and quaternions.

Most of this stuff exists, in various forms, in other libraries, but it has the major drawback of coming along with the rest of those libraries, which may or may not be what you want. Those libraries are also available in various languages, as long as those languages are C++; again, it may or may not be something you want.

For this reason, I decided to write the thinnest, smallest possible layer needed to write a canvas library; given its relative size, and the propensity for graphics libraries to have a pun in their name, I decided to call it Graphene.

This library provides types and their relative API; it does not deal with windowing system surfaces, drawing, scene graphs, or input. You're supposed to do that yourself, in your own canvas implementation, which is the whole point of writing the library in the first place.

Dependencies

Graphene has minimal dependencies.

Graphene contains optimizations for speeding up vector operations; those optimizations are optional, and used only if both Graphene was compiled with support for them and if the system you're running on has them. Currently, Graphene supports the following platform-specific fast paths:

  • Streaming SIMD Extensions (SSE) 2
  • Optionally using SSE 4.1
  • ARM NEON
  • GCC vector extensions

In the remote case in which none of these optimizations are available, Graphene will fall back to a naive scalar implementation.

Graphene can, optionally, provide types for integrating with GObject properties and signals, as well as introspection information for its use with other languages through introspection-based bindings.

Installation

In order to build and install Graphene you will need development tools and the headers of the dependencies. You will also need:

First of all, clone the Git repository:

$ git clone https://github.com/ebassi/graphene
$ cd graphene

Then run:

$ meson _build    # on Windows, it may be "meson.py"
$ cd _build
$ ninja test
# ninja install

It is possible, when building Graphene, to disable specific optimizations by using configuration options:

  • -Dsse2=false - will disable the SSE2 fast paths
  • -Darm_neon=false - will disable the ARM NEON fast paths
  • -Dgcc_vector=false - will disable the GCC vector intrinsics

If you don't plan on generating introspection data, use -Dintrospection=disabled when configuring Graphene; similarly, if you don't plan on using GObject with Graphene, use -Dgobject_types=false. Disabling GObject types will also automatically disable generating introspection data.

You can explicitly disable building the test suite and the benchmark suite, using the -Dtests=false and -Dbenchmarks=false configuration switches respectively. The tests suite depends on µTest; if it is not available at configuration time, tests will be disabled automatically.

Building on Windows

Graphene supports the Microsoft Visual C compiler 2017 and later versions.

Graphene also supports the MSYS2 toolchain.

When using MSYS2, it's recommended to have an up to date installation; in order to build Graphene you will need to use the pacman command to install the necessary build dependencies first:

$ pacman -S base-devel
$ pacman -S python3
$ pacman -S mingw-w64-x86_64-meson	# only MINGW64 target
$ pacman -S mingw-w64-i686-meson	# only MINGW32 target

For the optional support for GObject types, introspection, and documentation, you will need to install additional dependencies:

$ pacman -S gtk-doc                 # optional
$ pacman -S mingw-w64-x86_64-glib2  # optional, MINGW64 target only
$ pacman -S mingw-w64-i686-glib2    # optional, MINGW32 target only
$ pacman -S glib2 glib2-devel       # optional, MSYS target only

After installing all dependencies, you can now clone the Graphene repository locally, and follow the build instructions above.

Please note that on some MSYS2 installations the Meson binary may be called meson.py.

Documentation

Release notes

The release notes are available on the Graphene wiki.

Available types

Graphene provides common types needed to handle 3D transformations:

Graphene also provides its low-level SIMD vector and matrix types, which are used to implement the API above.

All types can be placed on the stack, but provide allocation/free functions for working on the heap as well. The contents of all structure types, unless noted otherwise, should be considered private, and should never be accessed directly.

The full API reference for Graphene is available online.

License

Graphene is released under the terms of the MIT/X11 license.

See the license file for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].