Documentation Index
- BSplineCurve
A curve evaluator object for a B-spline (basis spline) curve. - BSplineSurface
A surface evaluator object for a B-spline (basis spline) surface, whose edges are made up of B-spline curves. - Curve
A curve evaluator object for a parametric curve. - CurveBuilder
An evaluator of curve evaluator objects for generating vertex attributes for a curve. - Global Members
- GraphicsPath
Represents a two-dimensional path. - H3DU
This is a library with classes and methods that were formerly in the Public Domain HTML 3D Library. - MathUtil
A collection of math functions for working with vectors, matrices, quaternions, and other mathematical objects of interest to three-dimensional graphics programming. - MeshBuffer
Obsolete: It is planned to render this class obsolete and rely on three.js’s BufferGeometry. - Meshes
Contains methods that create meshes of various geometric shapes and solids, such as cubes, cylinders, and spheres. - PiecewiseCurve
A curve evaluator object for a curve made up of one or more individual curves. - ShapeGroup
Obsolete: It is intended to render this class obsolete and rely on three.js. - Surface
A surface evaluator object for a parametric surface. - SurfaceBuilder
An evaluator of surface evaluator objects for generating vertex attributes for a surface. - Transform
Obsolete: It is intended to render this class obsolete and rely on three.js. - module:extras/camera
Theextras/camera.js
module. - module:extras/camera.Camera
A class for controlling the projection and view of a 3D scene, in the nature of an abstract “camera”. - module:extras/camera.InputTracker
A class for tracking key press, mouse, touch, and mouse wheel events. - module:extras/createwasher
Theextras/createwasher.js
module. - module:extras/curvetube
Theextras/curvetube.js
module. - module:extras/curvetube.CurveTube
A surface evaluator object for a tube extruded from a parametric curve. - module:extras/derivedcurves
Additional curve evaluator and surface evaluator objects. - module:extras/evaluators
Theextras/evaluators.js
module. - module:extras/evaluators.Roulette
A curve evaluator object for a curve drawn by a curve that rolls along another curve whose position is fixed. - module:extras/evaluators.SurfaceOfRevolution
A surface evaluator object for a surface of revolution, which results by revolving a two-dimensional curve around an axis. - module:extras/fourierknot
Theextras/fourierknot.js
module. - module:extras/gradients
Theextras/gradients.js
module. - module:extras/matrixstack
Theextras/matrixstack.js
module. - module:extras/matrixstack.MatrixStack
This class implements a stack of 4 × 4 transformation matrices. - module:extras/meshes/arrow
Theextras/meshes/arrow.js
module. - module:extras/meshes/contourlines
Theextras/meshes/contourlines.js
module. - module:extras/meshes/convex
Theextras/meshes/convex.js
module. - module:extras/meshes/createfloor
Theextras/meshes/createfloor.js
module. - module:extras/meshes/drawingtoy
Generates curves similar to those possible using commercially available drawing toys containing gear-toothed rings and wheels. - module:extras/meshes/drawingtoy.DrawingToy
Generates curves similar to those possible using commercially available drawing toys containing gear-toothed rings and wheels. - module:extras/meshes/gearmesh
Theextras/meshes/gearmesh.js
module. - module:extras/meshes/pathtomesh
Theextras/meshes/pathtomesh.js
module. - module:extras/meshes/polyhedra
Theextras/meshes/polyhedra.js
module. - module:extras/meshes/polyhedra.Polyhedra
Contains helper methods for generating the five platonic solids and other polyhedra. - module:extras/meshes/raypick
Theextras/meshes/raypick.js
module. - module:extras/meshes/starfield
Theextras/meshes/starfield.js
module. - module:extras/meshes/starfield.StarField
TODO: Not documented yet. - module:extras/meshes/stl
Theextras/meshes/stl.js
module. - module:extras/meshes/text
Theextras/meshes/text.js
module. - module:extras/meshes/text.TextFont
Represents a bitmap font, which supports drawing two-dimensional text. - module:extras/moresurfaces
Theextras/moresurfaces.js
module. - module:extras/moresurfaces.KleinBottle
Surface evaluator object for the Klein surface, also known as the “Klein bottle”. - module:extras/moresurfaces.MoebiusStrip
Surface evaluator object for a Möbius strip. - module:extras/pathutil
Theextras/pathutil.js
module. - module:extras/randompolygon
Contains a method to generate a simple polygon at random. - module:extras/shaders/checkerboardshader
Theextras/shaders/checkerboardshader.js
module. - module:extras/shaders/colormatrixshader
Theextras/shaders/colormatrixshader.js
module. - module:extras/shaders/fragmentshaderlib
Theextras/shaders/fragmentshaderlib.js
module. - module:extras/shaders/horgradshader
Horizontal gradient shader. - module:extras/shaders/kernelmatrixshader
Theextras/shaders/kernelmatrixshader.js
module. - module:extras/shaders/marbleshader
Theextras/shaders/marbleshader.js
module. - module:extras/shaders/marbleshader2
Theextras/shaders/marbleshader2.js
module. - module:extras/shaders/mirrorshader
Theextras/shaders/mirrorshader.js
module. - module:extras/shaders/pixelateshader
Theextras/shaders/pixelateshader.js
module. - module:extras/shaders/radgradshader
Theextras/shaders/radgradshader.js
module. - module:extras/shaders/skysphereshader
Theextras/shaders/skysphereshader.js
module. - module:extras/shaders/stripesbackshader
Theextras/shaders/stripesbackshader.js
module. - module:extras/shaders/sunburstbackshader
Theextras/shaders/sunburstbackshader.js
module. - module:extras/shaders/vignetteshader
Theextras/shaders/vignetteshader.js
module. - module:extras/shaders/warpshader
Theextras/shaders/warpshader.js
module. - module:extras/shaders/waterpaintshader
Theextras/shaders/waterpaintshader.js
module. - module:extras/shaders/waveshader
Theextras/shaders/waveshader.js
module. - module:extras/shaders/woodshader
Theextras/shaders/woodshader.js
module. - module:extras/starpolygon
Theextras/starpolygon.js
module. - module:extras/superellipsoid
Theextras/superellipsoid.js
module. - module:extras/superellipsoid.Supershape
TODO: Not documented yet. - module:extras/superellipsoid.Supertoroid
TODO: Not documented yet. - module:extras/torusknot
Theextras/torusknot.js
module. - module:extras/torusknot.TorusKnot
A curve evaluator object for a torus knot or torus-knot-like curve.
Tutorials
- The “Camera” and Geometric Transforms
- Graphics Filters
- Older Version History
- Library Overview
- Creating Shapes
- Parametric Curves and Parametric Surfaces
Read Me
Geometry Utilities
Download source code: ZIP file
This is a public-domain library with classes and methods that were formerly in the Public Domain HTML 3D Library. Classes and methods that involved WebGL, shaders, or a 3D scene graph were removed, to make this library much more general-purpose. In any case, maintaining a 3D scene graph, textures, materials, and shaders is not trivial and is better handled by established 3D engines, such as three.js. The classes and methods remaining in this library don't assume the existence of a 3D rendering pipeline such as WebGL or OpenGL ES, or even the existence of an HTML DOM, and are thus more easily portable to other programming languages.
(Speaking of OpenGL ES, there are some things supported by some implementations that are strictly not necessary, since they can be implemented with shaders and clever mesh construction. These things include line primitives, triangle fans, triangle strips, and built-in antialiasing.)
API documentation is found at: https://peteroupc.github.io/html3dutil or https://github.com/peteroupc/html3dutil/blob/master/doc/index.md.
The file "h3du_min.js" is a minified single-file version of the library. Include it in your HTML as follows:
<script type="text/javascript" src="h3du_min.js"></script>
Source Code and Building
Source code is available in the project page.
To build, you will need a Java runtime environment and a JavaScript environment
that supports npm
.
- Put
compiler.jar
(the JAR file for the Closure Compiler) in thebuild
directory. - Install JSDoc and
rollup
vianpm
. - Run
npm run-script build
. This will generate the documentation and compile the library's source code into files calledh3du_min.js
andh3du_module.js
.
Overview and Demos
For detailed instructions on using this library and a summary of the library's features, visit:
https://peteroupc.github.io/html3dutil/tutorial-overview.html
Currently, the demos are not expected to work, since a project is in progress to convert the creation of meshes by this library to three.js.
History
See the history page to find information about what has changed in this library.
Possible Later Improvements
- Support "deg", "grad", "rad", and "turn" in CSS color hue parsing
About
Any copyright to this work is released to the Public Domain. In case this is not possible, this work is also licensed under the Unlicense: https://unlicense.org/