class public staticVJS.geometries. slice
Source: geometries/
new slice(halfDimensions, center, orientation, position, direction)
It is typically used for creating an irregular 3D planar shape given a box and the cut-plane.
Demo: https://fnndsc.github.io/vjs#geometry_slice
Example
// Define box to be sliced
var halfDimensions = new THREE.Vector(123, 45, 67);
var center = new THREE.Vector3(0, 0, 0);
var orientation = new THREE.Vector3(
new THREE.Vector3(1, 0, 0),
new THREE.Vector3(0, 1, 0),
new THREE.Vector3(0, 0, 1)
);
// Define slice plane
var position = center.clone();
var direction = new THREE.Vector3(-0.2, 0.5, 0.3);
// Create the slice geometry & materials
var sliceGeometry = new VJS.geometries.slice(halfDimensions, center, orientation, position, direction);
var sliceMaterial = new THREE.MeshBasicMaterial({
'side': THREE.DoubleSide,
'color': 0xFF5722
});
// Create mesh and add it to the scene
var slice = new THREE.Mesh(sliceGeometry, sliceMaterial);
scene.add(slice);
Parameters
Name | Type | Optional | Description |
---|---|---|---|
halfDimensions |
THREE.Vector3 |
|
Half-dimensions of the box to be sliced. |
center |
THREE.Vector3 |
|
Center of the box to be sliced. |
orientation |
Array of THREE.Vector3 |
|
Orientation of the box to be sliced. (might not be necessary..?) |
position |
THREE.Vector3 |
|
Position of the cutting plane. |
direction |
THREE.Vector3 |
|
Cross direction of the cutting plane. |