Vector, matrix and geometry math JavaScript

Related tags

Animations sylvester
Overview

Sylvester

Vector and Matrix math for JavaScript. See the website for documentation.

Development

Sylvester is built using wake and tested with jstest. Tests should run on all target platforms, including browsers, Node and other JS runtimes.

Install the build tools:

$ npm install

To build the library from source:

$ npm run build

To test, run using various JS binaries and open the tests in the browser:

$ JS=(v8 node spidermonkey rhino narwhal ringo)
$ for js in "${JS[@]}"; do echo "$js" ; $js test/console.js ; echo $? ; done

$ cscript.exe test/console.js # on Windows

$ open test/browser.html

To view the website locally:

$ bundle exec staticmatic preview site

To build the static files for the website:

$ bundle exec staticmatic build site

License

(The MIT License)

Copyright (c) 2007-2015 James Coglan

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • handling 'null' entries

    handling 'null' entries

    Hi, I m having some trouble with 'null' values within a matrix. Is there a way to handle such entries? it would be great to keep them, and not replace these entries by another (numerical) value.

    example: a = [[1,2],[3,4],[null,5]] $M(a) should deliver sth like: [1 2 3 4 null 5]

    but actually builds a matrix like this: [1 2 3 4]

    best, johsh

    opened by johsh 2
  • Doc link on Sylvester site broken

    Doc link on Sylvester site broken

    Just a heads up on the http://sylvester.jcoglan.com Sylvester site the link you have for the documentation (http://sylvester.jcoglan.com/docs) is broken.

    Thanks for an awesome script!

    opened by jewelsjacobs 2
  • Update src/matrix.js

    Update src/matrix.js

    mathlab has zeros and ones methods. I added an Init function that takes a value for matrix initialization.

    For this version, it is just a value that will be used to init the matrix. If you prefer, we can dynamically check if v is a function. In this case Random can be implemented using: Init(n,m, Math.random); I have done the same to vector but as I don't master github. I am not sure you'll get things right.

    opened by fkhbgm 2
  • Issue with isAntiparallelTo(vector) documentation

    Issue with isAntiparallelTo(vector) documentation

    Reading the api documentation for vector, under isAntiparallelTo() method it says: "Returns true iff vector’s direction is exactly opposed to that of the receiver, that is, if the angle between them is π." Wouldn't exactly opposite be π/2?

    opened by justinmaccreery 2
  • Are you still looking for a new maintainer?

    Are you still looking for a new maintainer?

    I'll do it. I'm currently maintaining a node port with some additional functionality (QR, LU decompositions and SVD)

    https://github.com/NaturalNode/node-sylvester

    opened by chrisumbel 2
  • rubygem requirement

    rubygem requirement

    I had problems building the code. Rake complained: "No such file to load -- packr", even after a

    gem install packr
    

    Including the rubygem requirement fixed this issue for me.

    opened by dvberkel 2
  • Broken link on http://sylvester.jcoglan.com/

    Broken link on http://sylvester.jcoglan.com/

    The link that has this exact text is broken: "the API documentation"

    There is another link to the docs that works tho. Thanks for all your hard work!

    opened by esromneb 1
  • Problem in LineintersectionWith

    Problem in LineintersectionWith

    Am I something wrong in below?

    LineA : (1,3)(2,9), LineB : (1,6)(2,6) , Correct intersection Point should be (1.5, 6)

    var a = sv.Line.create([1,3],[2,9]); var b = sv.Line.create([1,6],[2,6],); console.log('intersectionWith : ', a.intersectionWith(b)); But it result intersectionWith : [3.000000000000011, 12.000000000000052, 0] intersects : true pointClosestTo : [3.000000000000011, 12.000000000000052, 0] reflectionIn : { anchor: [-0.800000000000003, 3.600000000000001, -1.1617635945578294e-16], direction: [0.41216786985544684, 0.9111079228383558, 1.2601095422223854e-17] }

    opened by leejoo71 1
  • global j in toRightTriangular in v 0.1.3

    global j in toRightTriangular in v 0.1.3

    HI,

    I have been using Sylvester as it is posted on the website v 0.1.3. The Unit testing framework I am using reported a global variable "j".

    I tracked it down to the function "toRightTriangular" where "j" is used without being declared.

    This seems already to have been fixed on the repository, but I am new to GIT, and don't know how to get the latest version.

    Thanks Jacob

    opened by Eh2406 1
  • Rotation on both axis at the same time

    Rotation on both axis at the same time

    Is something like this correct ? Matrix.RotationX(value).add(Matrix.RotationY(value)); How would i go about if i wanted to get the rotation on both axis by a given value ?

    opened by piatra 1
  • docs: add rotation matrix as part of the .rotate argument for Vector

    docs: add rotation matrix as part of the .rotate argument for Vector

    Hello. First of all, thanks for this awesome library. I noticed that in the source code, Vector.prototype.rotate also can take in a rotation matrix aside from just an angle in radians. Was thinking if it could also be added in the documentation.

    Let me know what you think. Thank you.

    opened by briwa 0
  • Can you add Vector.to2D?

    Can you add Vector.to2D?

    I'm working in 2D only but Line.pointClosestTo returns 3D vector with z being 0, can you add Vector.to2D() function that would drop third element of a vector, right now there is Vector.to3D which adds zero, this would remove it. It is problem because when I want to use it later:

    Vector.create([2, 0]).subtract(Vector.create([1, 0, 0])) - returns null

    In order to make it work I need to use temp variable: var t = Vector.create([1, 0, 0]); t = Vector.create([t[0], t[1]]); Vector.create([2, 0]).subtract(t);

    Which is unwieldy but more importantly cannot be chained.

    opened by hikikomori82 0
  • Update to ES6/npm

    Update to ES6/npm

    Someone has put Sylvester into a handy npm module: sylvester-es6. It's only a matter a time when the two versions diverge and the documentation no longer matches. Maybe it's time for a major update with incorporation of ES6, NPM and other relevant JS tools. I'm currently using sylvester-es6 for this.

    opened by stassop 0
  • How to scale the X axis for Polygon?

    How to scale the X axis for Polygon?

    Hello expert,

    I have discovered the function "Polygon.prototype.scale(k, point)" always scale up/down the polygon in all directions (including X, Y, Z). However, I'd like to scale the polygon in X direction.

    Could you please give me a few of algorithm suggestions?

    opened by stuartZhang 0
  • Expect a up-to-date API doc

    Expect a up-to-date API doc

    Hello expert,

    The existing API online documentation (http://sylvester.jcoglan.com/docs.html) is out of date. Therefore, the latest docs update is desirable.

    opened by stuartZhang 4
Javascript and SVG odometer effect library with motion blur

SVG library for transitioning numbers with motion blur JavaScript odometer or slot machine effect library for smoothly transitioning numbers with moti

Mike Skowronek 793 Dec 27, 2022
🐿 Super easy and lightweight(<3kb) JavaScript animation library

Overview AniX - A super easy and lightweight javascript animation library. AniX is a lightweight and easy-to-use animation library with excellent perf

anonymous namespace 256 Sep 19, 2022
Slickscroll - A Lightweight JavaScript library for quick and painless momentum & parallax scrolling effects.

Slickscroll is a JavaScript library that makes momentum & parallax scrolling quick and painless View Demo: slickscroll.musabhassan.com Momentum Scroll

Musab Hassan 33 Dec 28, 2022
Animate Plus is a JavaScript animation library focusing on performance and authoring flexibility

Animate Plus Animate Plus is a JavaScript animation library focusing on performance and authoring flexibility. It aims to deliver a steady 60 FPS and

Benjamin De Cock 5.9k Jan 2, 2023
JavaScript animation engine

anime.js JavaScript animation engine | animejs.com Anime.js (/ˈæn.ə.meɪ/) is a lightweight JavaScript animation library with a simple, yet powerful AP

Julian Garnier 44k Dec 30, 2022
A lightweight JavaScript library for creating particles

particles.js A lightweight JavaScript library for creating particles. Demo / Generator Configure, export, and share your particles.js configuration on

Vincent Garreau 26.7k Jan 8, 2023
Accelerated JavaScript animation.

Velocity beta NPM: npm install velocity-animate@beta Docs https://github.com/julianshapiro/velocity/wiki IMPORTANT: The velocityjs.org documentation r

Julian Shapiro 17.2k Jan 5, 2023
GreenSock's GSAP JavaScript animation library (including Draggable).

GSAP (GreenSock Animation Platform) Professional-grade animation for the modern web GSAP is a robust JavaScript toolset that turns developers into ani

GreenSock 15.5k Jan 8, 2023
Javascript library to create physics-based animations

Dynamics.js Dynamics.js is a JavaScript library to create physics-based animations To see some demos, check out dynamicsjs.com. Usage Download: GitHub

Michael Villar 7.5k Jan 6, 2023
CSS3 backed JavaScript animation framework

Move.js CSS3 JavaScript animation framework. About Move.js is a small JavaScript library making CSS3 backed animation extremely simple and elegant. Be

Sloth 4.7k Dec 30, 2022
GreenSock's GSAP JavaScript animation library (including Draggable).

GSAP (GreenSock Animation Platform) Professional-grade animation for the modern web GSAP is a robust JavaScript toolset that turns developers into ani

GreenSock 15.4k Jan 5, 2023
Pure CSS (no JavaScript) implementation of Android Material design "ripple" animation

Pure CSS (no JavaScript) implementation of Android Material design "ripple" animation

Mladen Plavsic 334 Dec 11, 2022
simple JavaScript library to animate texts

Animated Texts Hi, this library is a simple javascript text animator Properties force type: number default: 300 start_delay_time type: number default:

Cristóvão 4 Jan 11, 2022
Tiny Javascript tweening engine.

Weeee.js Tiny Javascript tweening engine. Homepage Usage Step 1: npm install --save weeee.js Step 2: import Weeee from 'weeee.js'; const example = ne

Ivan Bogachev 3 Nov 30, 2022
Nebula is a lightweight (1kb compressed) JavaScript library that creates beautiful universe animations.

Nebula is a lightweight JavaScript library for creating beautiful universe animations. Including configurable Stars, Nebulas, Comets, Planets and Suns. Compatible with SSR

Florian DE LA COMBLE 34 Nov 25, 2022
Javascript version of the Move language compiler, supports compiling Move code into Move bytecode in the browser.

move-js Javascript version of the move language compiler, supports compiling Move code into move bytecode in the browser. Features Compiling move pack

Starcoin 13 Dec 20, 2022
Create scroll-based animation without JavaScript

Trigger JS Create scroll-based animation without JavaScript. Sometimes we want to update the CSS style of an HTML element based on the scroll position

Trigger JS 1.1k Jan 4, 2023
Matteo Bruni 4.7k Jan 4, 2023
It's a presentation framework based on the power of CSS3 transforms and transitions in modern browsers and inspired by the idea behind prezi.com.

impress.js It's a presentation framework based on the power of CSS3 transforms and transitions in modern browsers and inspired by the idea behind prez

impress.js 37k Jan 2, 2023