Home Reference Source

Function

Static Public Summary
public
public

addColor(resources: *, defaultColor: *)

Add color to the visual resources in the list that do not have color assigned yet

public

align(link: {source: Vector3, target: Vector3}, obj: Object3D, reversed: boolean)

Align an object along its axis (link)

public

angle(v1: Vector3, v2: Vector3): number

Compute the angle between two 3d vectors

public

bezierSemicircle(startV: Vector3, endV: Vector3): CubicBezierCurve3

Create a cubic Bezier curve resembling a semicircle

public

boundToPolygon(link: {source: Vector2, target: Vector2}, boundaryLinks: Array)

Force link ends to stay inside of a polygon (reset coordinates to the intersection point)

public

boundToRectangle(point: Vector2, min: {x: number, y: number}, max: {x: number, y: number})

Pushes a point inside of a rectangle on a plane

public

Convert color string to hex

public

commonTemplate(lyph1: *, lyph2: *): *

Determines whether two lyphs have a common supertype

public

copyCoords(target: *, source: *)

Copy coordinates from source object to target

public

createMeshWithBorder(shape: Shape, params: Object): Mesh

Create a 3d object with border

public

d3Layer(inner: *, outer: *, params: *): THREE.Mesh

Draws layer of a lyph in 3d.

public

d3Lyph(outer: *, params: *): *

public

direction(source: Vector3, target: Vector3): null

Create a vector between two 3d points

public

extractCoords(source: Object): Vector3

Create a vector from an object that contains coordinate fields x, y, and z

public

findResourceByID(eArray: *, e: *): * | void | T

Finds a resource object in the parent group given an object or an ID

public

geometryDifference(smallGeom: *, largeGeom: *, params: *): *

Computes difference between two geometries

public

getBoundingBox(mesh: Mesh): Box3

Get bounding box for a mesh geometry

public

getCenterOfMass(points: Array<Vector3>): Vector3

Return the center of mass given a set of control points

public

getCenterPoint(mesh: Mesh): Vector3

Find coordinates of the central point of the given mesh

public

getClassName(spec: *): *

Extracts class name from the schema definition

public

getPoint(curve: *, s: *, t: *, offset: *): *

Get a point on a curve

public

getRefs(spec: *): *

Returns a list of references in the schema type specification

public

isClassAbstract(clsName: *)

Indicates whether schema class definition is abstract

public

isInRange(from: *, to: *, angle: *): boolean

Checks that the angle is between given angles

public

layerShape(inner: Array, outer: Array): Shape

Create lyph layer shape

public

lyphShape(params: Array): Shape

Create lyph shape

public

mergeGenResource(group: *, parentGroup: *, resource: *, prop: *)

Add a given resource to a given group and a parent group if it does not exist

public

mergeGenResources(group: *, parentGroup: *, lnk,trg, lyph: *)

public

mergedGeometry(tube: *, cupTop: *, cupBottom: *, offset: *): Geometry | SEA3D.Geometry | * | THREE.Geometry

Helper function to produce a merged layer geometry given a tube shape and two cups representing open or closed borders

public

rectangleCurve(startV: Vector3, endV: Vector3): CurvePath<Vector> | CurvePath

Create a curve path resembling a semi-rectangle with rounded corners

Static Public

public ForceEdgeBundling(): * source

Return:

*

public addColor(resources: *, defaultColor: *) source

Add color to the visual resources in the list that do not have color assigned yet

Params:

NameTypeAttributeDescription
resources *

list of resources

defaultColor *

optional default color

public align(link: {source: Vector3, target: Vector3}, obj: Object3D, reversed: boolean) source

Align an object along its axis (link)

Params:

NameTypeAttributeDescription
link {source: Vector3, target: Vector3}

link between two points

obj Object3D

three.js visual object to align alone the line

reversed boolean
  • optional
  • default: false

indicates whether the object should be aligned in reversed direction

public angle(v1: Vector3, v2: Vector3): number source

Compute the angle between two 3d vectors

Params:

NameTypeAttributeDescription
v1 Vector3

first vector

v2 Vector3

second vector

Return:

number

computed angle between the given vectors

public bezierSemicircle(startV: Vector3, endV: Vector3): CubicBezierCurve3 source

import {bezierSemicircle} from 'open-physiology-viewer/src/three/utils.js'

Create a cubic Bezier curve resembling a semicircle

Params:

NameTypeAttributeDescription
startV Vector3

start coordinates

endV Vector3

end coordinates

Return:

CubicBezierCurve3

cubic Bezier curve

public boundToPolygon(link: {source: Vector2, target: Vector2}, boundaryLinks: Array) source

import {boundToPolygon} from 'open-physiology-viewer/src/three/utils.js'

Force link ends to stay inside of a polygon (reset coordinates to the intersection point)

Params:

NameTypeAttributeDescription
link {source: Vector2, target: Vector2}

link between two points

boundaryLinks Array

links representing sides of a polygon

public boundToRectangle(point: Vector2, min: {x: number, y: number}, max: {x: number, y: number}) source

import {boundToRectangle} from 'open-physiology-viewer/src/three/utils.js'

Pushes a point inside of a rectangle on a plane

Params:

NameTypeAttributeDescription
point Vector2

point coordinates

min {x: number, y: number}

minimal coordinate values

max {x: number, y: number}

maximal coordinate values

public colorStr2Hex(str: string): number source

import {colorStr2Hex} from 'open-physiology-viewer/src/three/utils.js'

Convert color string to hex

Params:

NameTypeAttributeDescription
str string

string with color

Return:

number

color hex

public commonTemplate(lyph1: *, lyph2: *): * source

import {commonTemplate} from 'open-physiology-viewer/src/three/utils.js'

Determines whether two lyphs have a common supertype

Params:

NameTypeAttributeDescription
lyph1 *
lyph2 *

Return:

*

public copyCoords(target: *, source: *) source

Copy coordinates from source object to target

Params:

NameTypeAttributeDescription
target *
source *

public createMeshWithBorder(shape: Shape, params: Object): Mesh source

import {createMeshWithBorder} from 'open-physiology-viewer/src/three/utils.js'

Create a 3d object with border

Params:

NameTypeAttributeDescription
shape Shape

object shape

params Object
  • optional
  • default: {}

object and border material params

Return:

Mesh

3d object with child object that models its border

public d3Layer(inner: *, outer: *, params: *): THREE.Mesh source

Draws layer of a lyph in 3d. Closed borders are drawn as cylinders because sphere approximation is quite slow

Params:

NameTypeAttributeDescription
inner *

= [$thickness, $height, $radius, $top, $bottom], where: $thickness is axial border distance from the rotational axis $height is axial border height $radius is the radius for the circle for closed border $top is a boolean value indicating whether top axial border is closed $bottom is a boolean value indicating whether bottom axial border is closed

outer *

= [thickness, height, radius, top, bottom], where thickness is non-axial border distance from the rotational axis height is non-axial border height radius is the radius for the circle for closed border top is a boolean value indicating whether top non-axial border is closed bottom is a boolean value indicating whether bottom non-axial border is closed

params *

object material params

Return:

THREE.Mesh

a mesh representing layer (tube, bag or cyst)

Example:

d3Layer([ layer.width * i + 1,       layer.height, layer.width / 2, ...layer.border.radialTypes],
        [ layer.width * (i + 1) + 1, layer.height, layer.width / 2, ...layer.border.radialTypes], layer.material);

public d3Lyph(outer: *, params: *): * source

Params:

NameTypeAttributeDescription
outer *
params *

Return:

*

public direction(source: Vector3, target: Vector3): null source

Create a vector between two 3d points

Params:

NameTypeAttributeDescription
source Vector3

source coordinates

target Vector3

target coordinates

Return:

null

public extractCoords(source: Object): Vector3 source

import {extractCoords} from 'open-physiology-viewer/src/three/utils.js'

Create a vector from an object that contains coordinate fields x, y, and z

Params:

NameTypeAttributeDescription
source Object

object with fields x, y, and z

Return:

Vector3

3d vector

public findResourceByID(eArray: *, e: *): * | void | T source

import {findResourceByID} from 'open-physiology-viewer/src/model/utils.js'

Finds a resource object in the parent group given an object or an ID

Params:

NameTypeAttributeDescription
eArray *
e *

Return:

* | void | T

public geometryDifference(smallGeom: *, largeGeom: *, params: *): * source

import {geometryDifference} from 'open-physiology-viewer/src/three/utils.js'

Computes difference between two geometries

Params:

NameTypeAttributeDescription
smallGeom *

inner geometry

largeGeom *

outer geometry

params *

material parameters

Return:

*

public getBoundingBox(mesh: Mesh): Box3 source

import {getBoundingBox} from 'open-physiology-viewer/src/three/utils.js'

Get bounding box for a mesh geometry

Params:

NameTypeAttributeDescription
mesh Mesh

triangular polygon mesh based object

Return:

Box3

bounding box for the mesh geometry

public getCenterOfMass(points: Array<Vector3>): Vector3 source

import {getCenterOfMass} from 'open-physiology-viewer/src/three/utils.js'

Return the center of mass given a set of control points

Params:

NameTypeAttributeDescription
points Array<Vector3>

control points

Return:

Vector3

coordinates of the center of mass

public getCenterPoint(mesh: Mesh): Vector3 source

import {getCenterPoint} from 'open-physiology-viewer/src/three/utils.js'

Find coordinates of the central point of the given mesh

Params:

NameTypeAttributeDescription
mesh Mesh

three.js mesh object

Return:

Vector3

coordinates of the mesh center

public getClassName(spec: *): * source

import {getClassName} from 'open-physiology-viewer/src/model/utils.js'

Extracts class name from the schema definition

Params:

NameTypeAttributeDescription
spec *

schema definition

Return:

*

public getPoint(curve: *, s: *, t: *, offset: *): * source

Get a point on a curve

Params:

NameTypeAttributeDescription
curve *

THREE.js curve

s *

start point at the curve

t *

stop point atthe curve

offset *

curve length fraction to find a point at (e.g., 0.25, 0.5, 0.75, etc.)

Return:

*

coordinates of a point on a curve

public getRefs(spec: *): * source

Returns a list of references in the schema type specification

Params:

NameTypeAttributeDescription
spec *

schema definition

Return:

*

list of references

public isClassAbstract(clsName: *) source

import {isClassAbstract} from 'open-physiology-viewer/src/model/utils.js'

Indicates whether schema class definition is abstract

Params:

NameTypeAttributeDescription
clsName *

public isInRange(from: *, to: *, angle: *): boolean source

Checks that the angle is between given angles

Params:

NameTypeAttributeDescription
from *

start of the range

to *

end of the range

angle *

current angle

Return:

boolean

public layerShape(inner: Array, outer: Array): Shape source

Create lyph layer shape

Params:

NameTypeAttributeDescription
inner Array

preceding (inner) lyph border shape parameters (@see lyphShape)

outer Array

current (outer) lyph border shape parameters

Return:

Shape

lyph layer shape (rectangle with or without rounded corners depending on its topology)

public lyphShape(params: Array): Shape source

Create lyph shape

Params:

NameTypeAttributeDescription
params Array

lyph border shape parameters (thickness and height, corner radius, and boolean values to mark radial border topology: "false" for open and "true" for closed)

Return:

Shape

lyph shape (rectangle with or without rounded corners depending on its topology)

public mergeGenResource(group: *, parentGroup: *, resource: *, prop: *) source

import {mergeGenResource} from 'open-physiology-viewer/src/model/utils.js'

Add a given resource to a given group and a parent group if it does not exist

Params:

NameTypeAttributeDescription
group *

a group to add resources to

parentGroup *

parent group

resource *

resource

prop *

property in the group

public mergeGenResources(group: *, parentGroup: *, lnk,trg, lyph: *) source

import {mergeGenResources} from 'open-physiology-viewer/src/model/utils.js'

Params:

NameTypeAttributeDescription
group *

a group to add resources to

parentGroup *

parent group

lnk,trg, lyph *
  • optional

link, target node, conveyed lyph

public mergedGeometry(tube: *, cupTop: *, cupBottom: *, offset: *): Geometry | SEA3D.Geometry | * | THREE.Geometry source

import {mergedGeometry} from 'open-physiology-viewer/src/three/utils.js'

Helper function to produce a merged layer geometry given a tube shape and two cups representing open or closed borders

Params:

NameTypeAttributeDescription
tube *

core layer tube

cupTop *

top border

cupBottom *

bottom border

offset *

distance to shift cups wrt the tube center

Return:

Geometry | SEA3D.Geometry | * | THREE.Geometry

public rectangleCurve(startV: Vector3, endV: Vector3): CurvePath<Vector> | CurvePath source

import {rectangleCurve} from 'open-physiology-viewer/src/three/utils.js'

Create a curve path resembling a semi-rectangle with rounded corners

Params:

NameTypeAttributeDescription
startV Vector3

start coordinates

endV Vector3

end coordinates

Return:

CurvePath<Vector> | CurvePath

curve path