Class: Phantom

Phantom()

Includes all data regarding a Phantom and methods to modify its appareance.

Constructor

new Phantom()

Properties:
Name Type Default Description
fibers Object Contains all objects for Fiber definition and representation.
Properties
Name Type Description
source Array.<FiberSource> FiberSource for each fiber bundle.
tube Array.<FiberTube> FiberTube for each fiber bundle. Must have same index as source
skeleton Array.<FiberSkeleton> FiberSkeleton for each fiber bundle. Must have same index as source
isotropicRegions Object Contains all objects for Isotropic Region definition and representation.
Properties
Name Type Description
source Array.<IsotropicRegionSource> IsotropicRegionSource for each region bundle.
sphere Array.<IsotropicRegion> IsotropicRegion for each region bundle. Must have same index as source
highlightOpacity Number 0.1 The base opacity for fading meshes in the scene. Over 1.
highlightColor THREE.Color null The color to be taken by highlighted objects. By default, null, thus color does not change.
Source:

Methods

(static) addAsSkeleton(scene)

Adds all Phantom bundles to given scene in a Skeleton form with faded tubes.
Will render.
Parameters:
Name Type Description
scene THREE.Scene Scene in which the Phantom will be added to.
Source:

(static) addCP(fiberindex, cpbefore)

Adds a new Control Point to a specified Fiber in the Phantom.
No position is specified; control point is added over the trajectory in between two existing control points.
Will render.
Parameters:
Name Type Description
fiberindex Number Index of the fiber in which the control point is to be added to.
cpbefore Number Index of the control point in which the new one is to be added after.
Source:

(static) addFiber(fiber, parametersopt, replaceindexopt)

Adds a Fiber to the Phantom, by creating their FiberTube and FiberSkeleton.
Parameters:
Name Type Attributes Description
fiber FiberSource Fiber to be added to the Phantom.
parameters Object <optional>
Optional object containing different optional parameters. Those parameters may be the ones to be specified in classes FiberTube and FiberSkeleton constructor.
If only nbElements is defined, sets the rest of those parameters by itself, looking at the constant meshConstraints.
Properties
Name Type Attributes Description
nbElements Number <optional>
Number of elements to feature in the whole Phantom. This allows the function to limit by itself the amout of segments present in the scene. Configurable via constant meshConstraints.
Only taken into account if any parameter regarding segments is defined.
replaceindex Number <optional>
If specified, replaces the Fiber yet present in this same index.
Source:

(static) addIsotropicRegion(region, parametersopt)

Adds a Fiber to the Phantom, by creating their IsotropicRegion.
Parameters:
Name Type Attributes Description
region IsotropicRegionSource Fiber to be added to the Phantom.
parameters Object <optional>
Optional object containing different optional parameters. Those parameters may be the ones to be specified in class IsotropicRegion constructor.
If only nbElements is defined, sets the rest of those parameters by itself, looking at the constant meshConstraints.
Properties
Name Type Attributes Description
nbElements Number <optional>
Number of elements to feature in the whole Phantom. This allows the function to limit by itself the amout of segments present in the scene. Configurable via constant meshConstraints.
Only taken into account if any parameter regarding segments is defined.
Source:

(static) addSkeleton(scene)

Adds all Phantom bundles to given scene in a Skeleton form.
Will render.
Parameters:
Name Type Description
scene THREE.Scene Scene in which the Phantom will be added to.
Source:

(static) addToScene(scene)

Adds all Phantom bundles to given scene.
Will render.
Parameters:
Name Type Description
scene THREE.Scene Scene in which the Phantom will be added to.
Source:

(static) cpHighlight(fiberindex, controlpointindex, mode) → {THREE.MeshBasicMaterial}

Overlays a colored slightly bigger sphere over a control point. Used for the user focusing in this element.
Will render.
Parameters:
Name Type Description
fiberindex Number Index of the fiber containing the control point to highlight.
controlpointindex Number Index of the control point to highlight.
mode String Highlight mode:
  • 'red': Red color. This is the only one not be removed by THREE.Scene.removeCPHighlight unless specified.
  • 'blue': Blue color.
  • 'green': Green color. This one is 90% the size to avoid bad rendering in clashes with the orthers.
Source:
Returns:
The highlight mesh
Type
THREE.MeshBasicMaterial

(static) export() → {String}

Parses Fibers and Isotropic Regions in the Phantom and returns a parsed, indented string.
The JSON is fully compatible with Phantomas. Name string is used as name for property in JSON file. Uppercase, spaces and non-alphanumeric characters are removed. In case two elements share the same name, numeric values will be added at the end.
Information from fibers:
  • Control points
  • Tangents
  • Radius
  • Color
Information from Isotropic Regions:
  • Center
  • Radius
  • Color
Source:
Returns:
Parsed variable ready for pushing to download.
Type
String

(static) fadeAll(opacityopt)

Fades all bundles to given opacity.
Will render.
Parameters:
Name Type Attributes Default Description
opacity Number <optional>
Phantom.highlightOpacity Opacity to fade to (over 1)
Source:

(static) fiberHighlight(n)

Fades all but the given fiber. Highlight opacity cannot be specified.
Will render.
Parameters:
Name Type Description
n Number Index of the fiber to highlight.
Source:

(static) newFiber()

Creates a new blank fiber in the scene.
The fiber features two points in X axis with phantom's radius distance.
Will render.
Source:

(static) newIsotropicRegion()

Creates a new blank isotropic region in the scene.
The isotropic region will be centered in the scene and have 1/5 of phantom's radius as radius.
Will render.
Source:

(static) radius() → {Number}

Provides the radius of the Phantom, understood as the distance from the center to the most distant bundle.
Source:
Returns:
Radius of the Phantom.
Type
Number

(static) regionHighlight(n)

Fades all but the given region. Highlight opacity cannot be specified.
Will render.
Parameters:
Name Type Description
n Number Index of the region to highlight.
Source:

(static) removeCP(fiberindex, cp)

Removes an existing Control Point of a specified Fiber in the Phantom.
Will render.
Parameters:
Name Type Description
fiberindex Number Index of the fiber in which the control point is to be removed.
cp Number Index of the control point to be removed.
Source:

(static) resetColors()

Resets color of all bundles. Important when unhighlighting with highlightColor being defined.
Will render.
Source:

(static) revealSkeleton(scene, n)

Adds Phantom to the scene and fades all by adding a Skeleton fiber to a given fiber. This fiber's tube will feature twice the default opacity for making the user stay focus.
Will render.
Parameters:
Name Type Description
scene THREE.Scene Scene in which the Phantom will be added to.
n Number Index of the fiber to highlight.
Source:

(static) unfadeAll()

Unfades all bundles, setting opacity to 1.
Will render.
Source: