ShapeJS Preview Developer Documentation

Browse the ShapeJS Documentation below.

Welcome to the tech preview of ShapeJS. Please note that as this is a preview, geometry generation and API functionality has not yet been fully tested and confirmed to guarantee generation of printable geometry.

Overview

ShapeJS provides a powerful system for generating 3D printable objects via a simple Javascript program. The functionality of ShapeJS is based on a representation of three dimensional objects via voxels on 3 dimensional regular grid.

Roughly speaking the value of each voxel represents the percent of this voxel volume occupied by the shape. More precisely speaking the voxel value is appropriately normalized limited range signed distance function - distance from voxel center to the shape surface. That value is represented internally by default with 8 bit precision which is equivalent to 256 different levels. This more precise representation greatly enhances the quality of generated objects in comparison with more traditional binary values of 0 and 1. The gain in quality is similar to those of grayscale image over black and white image of the same resolution.

The voxel based representation gives ShapeJS greater flexibility in shape generation over traditional representation via triangle meshes. It is similar to advantages 2D raster graphics has over 2D vector graphics. Vector graphics is great for drawing diagrams and raster graphics is on practice the tool of choice for anything else.

The way to fill the voxel grid is to create an object with DataSource interface, which can calculate signed distance function for each point in space. This object is fed to an instance of GridMaker which controls the calculations. The distance function calculations may be very complex task for complex object. But this calculation can be simplified by composing complex object from many simpler one using several simple operations.

There are several predefined simple object like Sphere,Box, Cylinder and Cone. More complex methods include functionality to convert 2D image to a 3D embossed object using ImageBitmap object and importing user provided 3D object using load() function.

The real power of volume sculpting is in the flexibility of combining and transforming objects represented as distance function. There are usual boolean operations on objects which include Union, Intersection, Subtraction, Complement.

There is a flexible set of transformations which can be applied to any DataSource object. Transformations include standard 3D linear transformations like rotation, translation, scale, reflection. Flexibility of using volume based data allows to use arbitrary non linear transformation among those are RingWrap, SphereInversion, FriezeSymmetry, WalPaperSymmetry, ReflectionSymmetry. Several simple transformations can be composed into more complex transformation using CompositeTransform. A transformation can be applied to any DataSource object via its setTransform() method.

ShapeJS Scripts

ShapeJS Scripts are Javascript programs over top the AbFab3D Voxel library. All standard Javascript functionality is supported. In particular we use the Rhino Scripting engine in Java. You can find the project documentation here: Rhino Documentation

Below is a simple ShapeJS program.

function main(args){  // this script will make a sphere

    var radius = 5*MM;        // radius of sphere 5 millimeters
    var voxelSize = 0.1*MM;   // size of grid voxel
    var gw = radius*1.1;      // make the grid size a little larger to have some clearance 
  
    var grid = createGrid(-gw,gw,-gw,gw,-gw,gw,voxelSize); // create the grid 
  
    var maker = new GridMaker();            // create instance of grid maker
    maker.setSource(new Sphere(radius));    // gives GridMaker object to work on 
    maker.makeGrid(grid);                   // GridMaker fills the grid with data 

    return grid;   // return the grid for final processing 
}

Click Simple Sphere to run this example.

All vss scripts should have function main(args). This function is executed by the ShapeJS scripting engine. It is possible to pass arbitrary arguments (including uploaded files ) to the main(args), but we will explain this later.

Unit of length in ShapeJS is meters. To avoid awkward numbers there are few useful conversion constants MM=0.001 for millimeters, IN=0.0254 for inches.

The primary object of ShapeJS script is a volumetric grid. The result of executing main(args)should be a grid filled with scene data. The scripting engine converts the grid returned by main() into a traditional triangle mesh which is sent back to the browser and displayed in the 3D view.

The grid is created via this function:
grid = createGrid(xmin, xmax, ymin, ymax, zmin, zmax, voxelSize);

Here the xmin, xmax ... are the physical bounds of grid in the space. They define minimal and maximal coordinates where the final shape will be located. The last parameter voxelSize is the size of grid voxel. It defines the resolution of volume rendering. A Voxel size of 0.1 millimeter corresponds to the printing resolution of most 3D printers in 2013. This parameter greatly affects speed of all calculations and the best approach is to keep it larger (0.2mm or 0.3mm) during script development and set to printer resolution only at the final stage.

The primary tool of ShapeJS is GridMaker. GridMaker fills the grid voxels with values calculated by objects called DataSource. Sphere is one of several prebuilt data sources. Users can also create new DataSource objects directly in their script.

Calling maker.makeGrid(grid) does the actual calculations of the grid. Returning that grid from main initiates the ShapeJS engine conversion of grid data into a triangle mesh which is returned to browser.

Controlling parameter of output mesh

There are few variables which allow user to control behavior of volume sculpting engine.

meshSmoothingWidth Width of gaussian smoothing of the grid before conversion to traingle mesh. The width is given relative the grid voxel size. Default value is 0.5.

meshErrorFactor is maximal errod allowed during mesh decimation (reducing mesh complexity). It is given relative to voxel size. default value is 0.5. Smaller value greatly increase the resultng mesh complexity.

meshMinPartVolume allows to filter out sand size particles from the resulting mesh. All parts of volume less than meshMinPartVolume are discarded. This volume is specified in meters3. Default value is 1*MM3 (one cubic millimeter).

meshMaxPartsCount specifies the maximum number of parts to save. The n largest parts are kept. By default all parts are retained.

Examples

Boolean Operations

In this example we'll show a powerful modeling technique creating objects by using boolean algebra. Many objects can be described by adding and subtracting primitive shapes from them. In this example we create a cool doodad by subtracting a 3D cross from a sphere. Try the example here: Boolean Example

function cross3D(size, thickness){
  var union = new Union();
  var boxX = new Box(0,0,0,size,thickness, thickeness);
  var boxY = new Box(0,0,0,thickeness, size, thickeness);
  var boxZ = new Box(0,0,0,thickeness, thickeness,size);
  union.add(boxX);
  union.add(boxY);
  union.add(boxZ);
  return union;
}

function main(args) {
  var size = args[0];
  var thickness = args[1];
  var grid = createGrid(-16*MM,16*MM,-16*MM,16*MM,-16*MM,16*MM,0.1*MM);
  var diff = new Subtraction(new Sphere(15*MM), cross3D(size, thickness));
  var maker = new GridMaker();
  maker.setSource(diff);
  maker.makeGrid(grid);
  return grid;
}

This script takes two parameters, the size of the cross and its thickness. The 3D cross is created by unioning together 3 boxes. The boxes are aligned in the x,y and z planes. The source for the grid is the Subtraction of a Sphere and the result of the cross3D function.

Image Popping

One of the nice features of using Voxel grids is the ability to use 2D raster image data. In this example we'll take an image and turn it into a 3D object. Here we use an ImageBitMap source and give it a physical size. We'll place this object on both sides to create a mirror image.

Notice we changed the voxelSize in this example from the typical .1mm default. When dealing with greyscale images you'll likely want higher resolution to get smooth transitions between heights.

Run the example here: Image Popper
var voxelSize = 0.05*MM;

function makePart(path, width, height, thickness){
  var img = new ImageBitmap(path, width, height, thickness);
  img.setBaseThickness(0.0);
  img.setVoxelSize(voxelSize);
  img.setBlurWidth(2*voxelSize);
  img.setImagePlace(ImageBitmap.IMAGE_PLACE_BOTH);
  return img;
}

function main(args) {
  var image = args[0];
  var x = 10*MM;
  var y = 22*MM;
  var z = 3*MM;
  dest = createGrid(-x,x,-y,y,-z,z,voxelSize);
  var th = 2*MM;
  var width = 12*MM;
  var height = 40*MM;
  var img = makePart(image, width, height, th);
  var maker = new GridMaker();
  maker.setSource(img);
  maker.makeGrid(dest);
  return dest;
}

The ImageBitMap may have optional solid base. In this case we set base thickness to be 0, which in effect eliminates the base. The base thickness is given as fraction of the ImageBitMap object thickness. For example, setBaseThickness(0.4) will make ImageBitMap base thickness equal to (0.4*thickness) and the thickness of image will be reduces to 0.6*thickness;

Another useful method of ImageBitMap is setBlurWidth(blurWidth). The blurWidth is given in physical units and should normally be of the same size as voxelSize. The blurring eliminates sharp edges in the image.

Creating your own Creators

The underlying engine for the web examples can be used in your own Javascript creator. Once you have a script you like then we'd encourage you to make a user-interface that's more specific and easier to use. Once you have the parameters ready then you can use a REST call to execute_pipeline that will generate the 3D model. With this model you can easily use the rest of the Shapeways API to store the models, get pricing and add your own markup to the models.

Custom DataSource

You can create your own DataSource inside ShapeJS scripts. A DataSource must implement the getDataValue function. This function will evaluate the data source at a pnt. This function should return signed distance to the objects surface. Signed distance is positive for exterior points, negative for interior points and zero at the surface. To obtain high quality surface the signed distance funtion should be properly normalized to voxel size. See example for a Sphere:
    importPackage(Packages.abfab3d.util);

    var radius;

    var Sphere = {
       getDataValue : function(pnt, data) {
          var x = pnt.v[0];
          var y = pnt.v[1];
          var z = pnt.v[2];

          var vs = pnt.getScaledVoxelSize();

          var r = r = Math.sqrt(x*x + y*y + z*z);
          data.v[0] = MathUtil.step10(r, radius, vs);

          return DataSource.RESULT_OK;
       }
    }

    function main(args){
       radius = 5*MM
       var a = radius*1.1;
       var voxelSize = 0.1*MM;

       var dest = createGrid(-a,a,-a,a,-a,a,voxelSize);

       var maker = new GridMaker();
       maker.setSource(Sphere);
       maker.makeGrid(dest);

       return dest;
    }
 

Javascript Functions

ShapeJS has global helper functions accessible from your script.
createGrid
Create a voxel grid
createGrid(sx,sy,sz,voxelSize)
Create a grid of given size and resolution.
double sx x size of grid
double sy y size of grid
double sz z size of grid
double voxelSize The size of each voxel.
load
Load a 3D mesh into a grid. Currently supports ASCII and BINARY STL files.
Grid load(filename)
Returns a grid from the 3D mesh. Uses the default voxelSize of 0.1mm
String filename The name of file to load
Grid load(filename,voxelSize)
Returns a grid from the 3D mesh. Uses the given voxelSize
String filename The name of the file to load
double voxelSize The size of voxels to use
load(filename,grid)
Returns a grid from the 3D mesh. Uses the given voxelSize
String filename The name of the file to load
Grid grid The grid to load the result into. Will overwrite filled areas with model data, unfilled areas will not be changed. The grid must be large enough to contain the object.

Java Objects

Specific Java objects are exposed to the scripts. This section lists the objects exposed and provides links to their Javadoc.

Math

The java.lang.Math class is available. This is where you will find the typical min,max,sin,cos functions. Please see the posted Javadoc for complete details. Java6 Javadoc

An example usage is:
function trigCalcs(radius,angle){
    var circ = 2 * Math.PI * radius;
    var sin = Math.sin(angle);
    var max = Math.max(radius,10);
}
Data Sources
Box
Solid box of given size
Box(cx,cy,cz,sx,sy,sz)
Box with given center and size
double cx x coordinate of center
double cy y coordinate of center
double cz z coordinate of center
double sx x size
double sy y size
double sz z size
Box(sx,sy,sz)
Box with 0,0,0 center and given size
double sx x size
double sy y size
double sz z size
Box(size)
Box with 0,0,0 center and given size
Vector3d size Size vector
setSize(sx,sy,sz)
Set the size of the box
double sx x size
double sy y size
double sz z size
setSize(size)
Set the size of the box
Vector3d size Size vector
setCenter(cx,cy,cz)
Set the center of the box
double cx
double cy
double cz
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
Complement
Boolean complement. The datasource is the opposite of the input.
Complement(source)
Complement of the given datasource.
DataSource source object to which the complement is generated
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
Cone
Cone with point at apex, axis along given direction and given half angle. This Cone goes infinitely in the axis direction.
Cone()
Cone(apex,axis,angle)
Cone with point at given center, axis along given direction and given half angle. This Cone goes infinitely in the axis direction.
Vector3d apex Top of the cone
Vector3d axis Direction of cone
double angle Half angle to subtend
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
Cylinder
Cylinder with given ends and radius
Cylinder(v0,v1,radius)
Cylinder which starts at point V0 and ands at point V1
Vector3d v0 Starting position
Vector3d v1 Ending position
double radius Radius of cylinder
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
DataSourceGrid
DataSource interface to Grid. This object shall be used if one want to use generated grid as a general shape.
DataSourceGrid(grid)
constructs DataSoure from the given grid
AttributeGrid grid
DataSourceGrid(grid,maxAttributeValue)
AttributeGrid grid
int maxAttributeValue
DataSourceGrid(grid,bounds,maxAttributeValue)
AttributeGrid grid
double[] bounds
int maxAttributeValue
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
DataTransformer
Transform a data source. This provides a transformable wrapper over top a data source.
DataTransformer()
setSource(ds)
DataSource ds
initialize()
getDataValue(pnt,data)
Vec pnt
Vec data
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
ImageBitmap
Makes embossed image from given 2D image file. The shape fits into a box of the specified size. The image is placed parallel to the xy plane. The bounding box is centered at origin.

The image may be placed in 3 different places: on top side, on bottom side and on both sides.

The style of image may be emboss or engrave.

The image can by tiled (repeated) in both x and y directions

ImageBitmap()
ImageBitmap(imagePath,sx,sy,sz)
ImageBitmap with given image path and size
String imagePath
double sx
double sy
double sz
setBaseThickness(baseThickness)
Sets thickness of the solid base relative to the bounding box thickness
double baseThickness thickenss of solid base relative to the thickness of the bounding box. Default value is 0.
setImageType(type)
set options to image embossing type
int type Type ot the image. Possible values ImageBitmap.IMAGE_TYPE_EMBOSS, ImageBitmap.IMAGE_TYPE_ENGRAVE. Default value ImageBitmap.IMAGE_TYPE_EMBOSS
setImagePlace(place)
set options to place the image
int place of the image. Possible values: ImageBitmap.IMAGE_PLACE_TOP, ImageBitmap.IMAGE_PLACE_BOTTOM, ImageBitmap.IMAGE_PLACE_BOTH Default ImageBitmap.IMAGE_PLACE_TOP
setUseGrayscale(value)
set option to use grayscale
boolean value if true grayscale componenent of the will be used, if false iumage will be converted into black and white. the black and white option is useful if one want to have image shape with sharp vertical walls.
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
Intersection
Intersection of multiple data sources
Intersection()
Intersection(ds1,ds2)
DataSource ds1
DataSource ds2
add(ds)
add items to set of data sources
DataSource ds
initialize()
getDataValue(pnt,data)
calculates intersection of all values
Vec pnt
Vec data
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
Plane
Plane with with given external normal and distance from the origin the shape is half space bounded by that plane. plane normal is pointing outside of that half space
Plane()
Plane(normal,dist)
Plane is defined via external normal and distance along normal from origin.
Vector3d normal The normal to the plane
double dist The distance to the plane
Plane(normal,pointOnPlane)
Plane is defined via external normal and a point, which lies in the plane
Vector3d normal The normal to the plane
Vector3d pointOnPlane the point on the plane
Plane(pnt0,pnt1,pnt2)
Plane is defined via 3 points, which lie in the plane. External normal points into direction from which points pnt0, pnt1, pnt2 look oriented counter clock wise
Vector3d pnt0 point in the plane
Vector3d pnt1 point in the plane
Vector3d pnt2 point in the plane
Plane(nx,ny,nz,dist)
Plane is defined via components of normal and distance from origin
double nx x component of normal
double ny y component of normal
double nz z component of normal
double dist distance from plane to origin
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
Ring
ring in XZ plane
Ring(radius,thickness,ymin,ymax)
makes ring centered at orign with possible differetn offsets in y directions
double radius
double thickness
double ymin
double ymax
Ring(innerRadius,thickeness,width)
makes ring centered at orign
double innerRadius
double thickeness
double width
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
Sphere
Sphere with given location and radius.
If radius is positive the shape is interior of the sphere, if radius is negative - the shape is exterior of the sphere.
Sphere()
Sphere(radius)
sphere with given radius centered at origin
double radius
Sphere(center,radius)
sphere with given center and radius
Vector3d center
double radius
Sphere(cx,cy,cz,radius)
sphere with given center and radius
double cx
double cy
double cz
double radius
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
Subtraction
Boolean difference between two data sources
Subtraction(shape1,shape2)
shape which is result of subtracting shape2 from shape1
DataSource shape1
DataSource shape2
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
Text
makes 3D text shape from text string

Text is oriented parallel to xy plane. The bounding box is centered at origin

Text(text,fontName,sx,sy,sz,voxelSize)
String text the string to convert intoi 3D text
String fontName name of font to be used for 3D text
double sx width of the 3D text bounding box
double sy height of the 3D text bounding box
double sz thickness of 3D text bounding box
double voxelSize size of voxel used for text rasterizetion
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
Torus
Torus centered at given point with axis parallel to z-axis
Torus(center,Rout,Rin)
Vector3d center - location of torus center
double Rout - outer radius of torus
double Rin - innter radius of torus
Torus(Rout,Rin)
torus centered at origin
double Rout - outer radius of torus
double Rin - innter radius of torus
Torus(cx,cy,cz,Rout,Rin)
double cx - x component of center
double cy - y component of center
double cz - z component of center
double Rout - outer radius of torus
double Rin - innter radius of torus
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
Union
Union of multiple data sources. It can create union
Union()
Create empty union. Use add() method to add arbitrary number of shapes to the union.
Union(shape1,shape2)
union of two shapes
DataSource shape1
DataSource shape2
add(shape)
add item to union.
DataSource shape item to add to union of multiple shapes
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
VolumePatterns
VolumePatterns()
VolumePatterns.Balls
VolumePatterns.Balls(period,radius)
double period
double radius
getDataValue(pnt,data)
Vec pnt
Vec data
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
VolumePatterns.CubicGrid
VolumePatterns.CubicGrid(period,radius)
double period
double radius
getDataValue(pnt,data)
Vec pnt
Vec data
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
VolumePatterns.Gyroid
approximation to Gyroid
VolumePatterns.Gyroid()
VolumePatterns.Gyroid(period,thickness)
double period
double thickness
setPeriod(value)
double value
setThickness(value)
double value
setLevel(value)
double value
setVoxelScale(voxelScale)
double voxelScale
setOffset(offsetX,offsetY,offsetZ)
double offsetX
double offsetY
double offsetZ
initialize()
getDataValue(pnt,data)
Vec pnt
Vec data
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
VolumePatterns.GyroidGradient
approximation to Gyroid
VolumePatterns.GyroidGradient()
VolumePatterns.GyroidGradient(period,thickness,pos,str)
double period
double thickness
Vector3d pos
double str
setPeriod(value)
double value
setThickness(value)
double value
setLevel(value)
double value
setOffset(offsetX,offsetY,offsetZ)
double offsetX
double offsetY
double offsetZ
initialize()
getDataValue(pnt,data)
Vec pnt
Vec data
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
VolumePatterns.Lidinoid
VolumePatterns.Lidinoid(period,thickness)
double period
double thickness
getDataValue(pnt,data)
Vec pnt
Vec data
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
VolumePatterns.SchwarzPrimitive
Schwarz Primitive as defined here: http://en.wikipedia.org/wiki/Schwarz_minimal_surface#Schwarz_P_.28.22Primitive.22.29
VolumePatterns.SchwarzPrimitive(period,thickness)
double period
double thickness
getDataValue(pnt,data)
Vec pnt
Vec data
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
VolumePatterns.SchwarzDiamond
Schwarz Diamond as defined here: http://en.wikipedia.org/wiki/Schwarz_minimal_surface#Schwarz_P_.28.22Primitive.22.29
VolumePatterns.SchwarzDiamond(period,thickness)
double period
double thickness
setVoxelScale(voxelScale)
double voxelScale
initialize()
getDataValue(pnt,data)
Vec pnt
Vec data
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
VolumePatterns.ScherkSecondSurface
Scherk Second Surface as defined here: http://en.wikipedia.org/wiki/Scherk_surface
VolumePatterns.ScherkSecondSurface(period,thickness)
double period
double thickness
getDataValue(pnt,data)
Vec pnt
Vec data
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
VolumePatterns.Enneper
Enneper Surface as describe here: http://en.wikipedia.org/wiki/Enneper_surface
VolumePatterns.Enneper(period,thickness)
double period
double thickness
getDataValue(pnt,data)
Vec pnt
Vec data
setTransform(transform)
Transform the data source
VecTransform transform General transformation to apply to the object before it is rendered
Transformations
CompositeTransform
Arbitrary long chain of transformation to be applied to the shape.
CompositeTransform()
add(transform)
add transform to the chain of transforms
VecTransform transform
FriezeSymmetry
Makes transformations to reproduce Frieze Symmetry patterns
FriezeSymmetry()
FriezeSymmetry(type,domainWidth)
Frieze Symmetry wih specified type and domain width
int type the symetry type
Possible values are
  • FriezeSymetry.FRIEZE_II
  • FriezeSymetry.FRIEZE_IX
  • FriezeSymetry.FRIEZE_IS
  • FriezeSymetry.FRIEZE_SII
  • FriezeSymetry.FRIEZE_22I
  • FriezeSymetry.FRIEZE_2SI
  • FriezeSymetry.FRIEZE_S22I
double domainWidth width of the fundamental domain
PlaneReflection
Reflection in a plane
PlaneReflection(normal)
Plane via origin is defined via external normal.
Vector3d normal
PlaneReflection(normal,pointOnPlane)
Plane is defined via external normal and point on plane
Vector3d normal
Vector3d pointOnPlane
ReflectionSymmetry

Makes transformations for reflection symmetry group generated by reflections in planes and invesions in spheres.

The fundamental domain of the group is represented as intersection of half spaces and spheres.

The generators of the group are reflections and inversions in the sides of the fundamental domain

It can be used to generate reflection groups in various geometries. See also artice on invesive geomety.

ReflectionSymmetry()
Reflection symmetry with empty fundamental domain
ReflectionSymmetry(fundamentalDomain)
Reflection symmetry with specified fundamental domain
ReflectionGroup.SPlane[] fundamentalDomain
setGroup(fundamentalDomain)
sets the fundamental fomain of the group
ReflectionGroup.SPlane[] fundamentalDomain
setMaxCount(count)
set max count of reflection to be used in group generation. Default value is 100.
int count
getPlane(normal,distance)
makes plane defined via external normal and distance from origin.
Vector3d normal external unit normal to the plane. The extenal normal points outiside of the half space used for fundamental domain definition.
double distance Distance from plane to origin. Distance may be positive or negative.
getSphere(center,radius)
makes sphere defined via center and radius
Vector3d center sphere center
double radius
  • if radius is positive - the interior of sphere is used
  • if radius is negative - the exterior of sphere is used
RingWrap

Wraps band in XZ plane about a cylinder of given radius. Cylinder axis in parallel to Y axis.

The diagram below is oriented with Y axis toward user.

RingWrap()
RingWrap(r)
Ring wrap with given radius
double r
setRadius(r)
set radius of the wrap
double r
Rotation
performs rotation about given axis
Rotation()
identity rotation
Rotation(axis,angle)
rotation with given axis and angle. Angle is measure in radians.
Vector3d axis
double angle rotation angle is measured in radians
Rotation(axis,angle,center)
rotation with given axis, angle and center. Angle is measure in radians.
Vector3d axis
double angle rotation angle is measured in radians
Vector3d center
Scale
performs scaling by given factor
Scale()
identity transform
Scale(s)
uniform scaling
double s uniform scaling factor
Scale(sx,sy,sz)
non uniform scaling
double sx x axis scaling factor
double sy y axis scaling factor
double sz z axis scaling factor
SphereInversion

performs inversion in a sphere of given center and radius

See inversion in a sphere.

SphereInversion()
Creates default sphere which interchanges upper half space and unit ball
SphereInversion(center,radius)
Inversion in a sphere of given center and radius
Vector3d center
double radius
Translation
Performs translation in space
Translation()
identity transform
Translation(tx,ty,tz)
translation to given point
double tx x component of translation
double ty y component of translation
double tz z component of translation
WallpaperSymmetry

Makes transformations to reproduce 17 two dimensional wallpaper symmetry patterns. See Wallpaper Group. Traditional wallpaper patterns are two dimensional. However these tranformations are acting in three dimension.

The diagram below shows the shapes of fundamental domain used for each of 17 groups.

WallpaperSymmetry()
default constructor with default symmetry type WallpaperSymmetry.WP_S2222;
WallpaperSymmetry(symmetryType)
constructor with given symmetry type
int symmetryType possible values are
  • WallpaperSymmetry.WP_O
  • WallpaperSymmetry.WP_XX
  • WallpaperSymmetry.WP_SX
  • WallpaperSymmetry.WP_SS
  • WallpaperSymmetry.WP_632
  • WallpaperSymmetry.WP_S632
  • WallpaperSymmetry.WP_333
  • WallpaperSymmetry.WP_S333
  • WallpaperSymmetry.WP_3S3
  • WallpaperSymmetry.WP_442
  • WallpaperSymmetry.WP_S442
  • WallpaperSymmetry.WP_4S2
  • WallpaperSymmetry.WP_2222
  • WallpaperSymmetry.WP_22X
  • WallpaperSymmetry.WP_22S
  • WallpaperSymmetry.WP_S2222
  • WallpaperSymmetry.WP_2S22
WallpaperSymmetry(symmetryType,width,height)
constructor with given symmetry type and size of fundamental domain
int symmetryType possible values see above
double width width of fundamental domain
double height height of fundamental domain
setDomainWidth(width)
double width width of fundamental domain.
setDomainHeight(height)
double height height of fundamental domain (if used).
setMaxCount(maxCount)
int maxCount
setDomainSkew(skew)
double skew skew parameter of fundamental domain (if used)