Third Party Library Support¶
3D Visualization¶
App3D¶
A 3D visualization application built on top of threejs
test_mesh¶
Example of a render
render¶
Render the 3D application
animate¶
Start the animation.
resize¶
Resizing of the renderer and controls
remove_meshes¶
Iterates over the meshes and removes each from the scene.
add_points¶
Create a point cloud from x, y, z coordinates and colors and radii (optional).
- Args:
- x (array-like): Array like object of x values y (array-like): Array like object of y values z (array-like): Array like object of z values colors (object): List like colors corresponding to every object radii (object): List like radii corresponding to every object
- Returns:
- points (THREE.Points): Reference to added points object
- Tip:
- By tracking the returned object, one can create animations.
- Warning:
- On a modern machine attempting to render >5 million (approximately) objects can cause a slowdown of the browser and framerate of the application.
add_spheres¶
Create a point cloud from x, y, z coordinates and colors and radii (optional).
- Args:
- x (array-like): Array like object of x values y (array-like): Array like object of y values z (array-like): Array like object of z values colors (object): List like colors corresponding to every object radii (object): List like radii corresponding to every object
- Returns:
- spheres (list): List of THREE.Mesh objects
add_lines¶
Add lines between pairs of points.
- Args:
- v0 (array): Array of first vertex in pair v1 (array): Array of second vertex x (array): Position in x of vertices y (array): Position in y of vertices z (array): Position in z of vertices colors (array): Colors of vertices
- Returns:
- linesegs (THREE.LineSegments): Line segment objects
add_lines¶
Add lines between pairs of points.
- Args:
- v0 (array): Array of first vertex in pair v1 (array): Array of second vertex x (array): Position in x of vertices y (array): Position in y of vertices z (array): Position in z of vertices colors (array): Colors of vertices
- Returns:
- linesegs (THREE.LineSegments): Line segment objects
add_wireframe¶
Create a wireframe object
flatten_color¶
set_camera¶
Set the camera in the default position and have it look at the origin.
- Args:
- kwargs: {‘x’: x, ‘y’: y, ..., ‘ox’: ox, ...}
set_camera_from_scene¶
add_scalar_field¶
Create an isosurface of a scalar field.
When given a scalar field, creating a surface requires selecting a set of vertices that intersect the provided field magnitude (isovalue). There are a couple of algorithms that do this.
add_unit_axis¶
Adds a unit length coordinate axis at the origin
march_cubes1¶
Run the marching cubes algorithm finding the volumetric shell that is smaller than the isovalue.
The marching cubes algorithm takes a scalar field and for each field vertex looks at the nearest indices (in an evenly space field this forms a cube), determines along what edges the scalar field is less than the isovalue, and creates new vertices along the edges of the field’s cube. The at each point in the field, a cube is created with vertices numbered:
4——-5/ | / |
7——-6 | | 0—-|–1 | / | / 3——-2
Field values are given for each field vertex. Edges are labeled as follows (see the lookup table below).
4o——-o o——-o
/ | / | 7 / | 6 / | 5
o——-o | o——-o | | o—-|–o | o—-|–o
- 3 | / 0 | / 1 | / | /
- o——-o o——-o
- 2
Edges 8, 9, 10, and 11 wrap around (clockwise looking from the top as drawn) the vertical edges of the cube, with 8 being the vertical edge between vertex 0 and 4 (see above).
- Note:
- Scalar fields are assumed to be in row major order (also known C style, and implies that the last index is changing the fastest).
- See Also:
- field.js
march_cubes2¶
Similar to the above but for finding positive and negative surfaces.
============ gui.js ============ Basic gui for container views.
ContainerGUI ===============