Skip to content

Commit

Permalink
Merge pull request #1 from holomorfo/matrix-refactor
Browse files Browse the repository at this point in the history
[p5.js 2.0] Matrix move to math folder
  • Loading branch information
holomorfo authored Oct 12, 2024
2 parents d54e31f + 1b8b713 commit dec0bd3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ import './webgl/material';
import './webgl/p5.Camera';
import './webgl/p5.DataArray';
import './webgl/p5.Geometry';
import './webgl/p5.Matrix';
import './math/p5.Matrix';
import './webgl/p5.Quat';
import './webgl/p5.RendererGL.Immediate';
import './webgl/p5.RendererGL';
Expand Down
26 changes: 26 additions & 0 deletions src/math/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,32 @@ function math(p5, fn){
return new p5.Vector(x, y, z);
}
};

/**
* Creates a new <a href="#/p5.Matrix">p5.Matrix</a> object.
*
* A matrix is a mathematical concept that is useful in many fields, including
* computer graphics. In p5.js, matrices are used to perform transformations
* on shapes and images.
*
* @method createMatrix
* @return {p5.Matrix} new <a href="#/p5.Matrix">p5.Matrix</a> object.
*
* @example
* <div>
* <code>
* function setup() {
* createCanvas(100, 100);
* let matrix = createMatrix();
* console.log(matrix);
* describe('Logs a new p5.Matrix object to the console.');
* }
* </code>
* </div>
*/
fn.createMatrix = function (...args) {
return new p5.Matrix(...args);
};
}

export default math;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/webgl/p5.RendererGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import libtess from 'libtess'; // Fixed with exporting module from libtess
import './p5.Shader';
import './p5.Camera';
import Renderer from '../core/p5.Renderer';
import './p5.Matrix';
import '../math/p5.Matrix';
import './p5.Framebuffer';
import { MipmapTexture } from './p5.Texture';

Expand Down
File renamed without changes.

0 comments on commit dec0bd3

Please sign in to comment.