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. - BufferAccessor
A vertex attribute object. - 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. - H3DU.TextFont
Represents a bitmap font, which supports drawing two-dimensional text. - H3DU.TextureAtlas
A texture atlas specifies the location and size of images within a single texture. - MathUtil
A collection of math functions for working with vectors, matrices, quaternions, and other mathematical objects. - MeshBuffer
A geometric mesh in the form of buffer objects. - 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. - Promise
A promise holds a value to be resolved in the future. - Semantic
Contains constants for assigning semantics to vertex attributes found in mesh buffers and to data that is uniform throughout a particular geometry draw call. - Shape
An object that associates a geometric mesh (the shape of the object) with a transformation matrix (which defines the object's position and size). - ShapeGroup
Represents a grouping of shapes. - Surface
A surface evaluator object for a parametric surface. - SurfaceBuilder
An evaluator of surface evaluator objects for generating vertex attributes for a surface. - Transform
A class offering a convenient way to set a transformation from one coordinate system to another. - module:extras/arrow
Theextras/arrow.js
module. - 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/checkerboardshader
Theextras/checkerboardshader.js
module. - module:extras/colormatrixshader
Theextras/colormatrixshader.js
module. - module:extras/contourlines
Theextras/contourlines.js
module. - module:extras/convex
Theextras/convex.js
module. - module:extras/createfloor
Theextras/createfloor.js
module. - 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/drawingtoy
Generates curves similar to those possible using commercially available drawing toys containing gear-toothed rings and wheels. - module:extras/drawingtoy.DrawingToy
Generates curves similar to those possible using commercially available drawing toys containing gear-toothed rings and wheels. - 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/fragmentshaderlib
Theextras/fragmentshaderlib.js
module. - module:extras/gearmesh
Theextras/gearmesh.js
module. - module:extras/gradients
Theextras/gradients.js
module. - module:extras/horgradshader
Theextras/horgradshader.js
module. - module:extras/kernelmatrixshader
Theextras/kernelmatrixshader.js
module. - module:extras/marbleshader
Theextras/marbleshader.js
module. - module:extras/marbleshader2
Theextras/marbleshader2.js
module. - module:extras/matrixstack
Theextras/matrixstack.js
module. - module:extras/matrixstack.MatrixStack
This class implements a stack of 4x4 transformation matrices. - module:extras/mirrorshader
Theextras/mirrorshader.js
module. - 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/pixelateshader
Theextras/pixelateshader.js
module. - module:extras/polyhedra
Theextras/polyhedra.js
module. - module:extras/polyhedra.Polyhedra
Contains helper methods for generating the five platonic solids and other polyhedra. - module:extras/radgradshader
Theextras/radgradshader.js
module. - module:extras/randompolygon
Contains a method to generate a simple polygon at random. - module:extras/raypick
Theextras/raypick.js
module. - module:extras/skysphereshader
Theextras/skysphereshader.js
module. - module:extras/starfield
Theextras/starfield.js
module. - module:extras/starfield.StarField
TODO: Not documented yet. - module:extras/starpolygon
Theextras/starpolygon.js
module. - module:extras/stl
Theextras/stl.js
module. - module:extras/stripesbackshader
Theextras/stripesbackshader.js
module. - module:extras/sunburstbackshader
Theextras/sunburstbackshader.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/text
Theextras/text.js
module. - module:extras/tga
Theextras/tga.js
module. - module:extras/torusknot
Theextras/torusknot.js
module. - module:extras/torusknot.TorusKnot
A curve evaluator object for a torus knot or torus-knot-like curve. - module:extras/vignetteshader
Theextras/vignetteshader.js
module. - module:extras/warpshader
Theextras/warpshader.js
module. - module:extras/waterpaintshader
Theextras/waterpaintshader.js
module. - module:extras/waveshader
Theextras/waveshader.js
module. - module:extras/woodshader
Theextras/woodshader.js
module.
Tutorials
- The "Camera" and Geometric Transforms
- Color Strings
- Graphics Filters
- H3DU's Math Functions
- Older Version History
- Matrix Details
- Library Overview
- Creating Shapes
- Parametric Curves and Parametric Surfaces
Read Me
Geometry Utilities
Download source code: ZIP file
If you like this software, consider donating to me at this link: http://peteroupc.github.io/
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
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. https://creativecommons.org/publicdomain/zero/1.0/