Last updated

API / geotoolkit3d / scene / surface / contour / Triangle / Triangle

Class: Triangle

contour.Triangle.Triangle

Contour triangle class.
This class calculates the center point on isoline, triangle normal, and length of isoline intercepted an arbitrary triangle in 3D space.

Example

a                                a-------b
/ \                                \     /
e1 /---\ e2      elevation           e1 \---/ e2
/_____\                                \ /
b       c                                c

Table of contents

Constructors
Methods

Contents

Constructors

new Triangle(a, b, c, elevation, sorted)

new Triangle(a?, b?, c?, elevation?, sorted?)

Constructor for the Triangle utility. It is advised to reuse the class instead of creating a new one for each calculation. Triangle values and properties are optional and can be set later using setProperties().

Parameters

Name Type Description
Optional anumber[]the first vertex
Optional bnumber[]the second vertex
Optional cnumber[]the third vertex
Optional elevationnumberthe elevation that cross the triangle
Optional sortedbooleantrue if vertices are sorted in ascending by elevation
Methods

getClassName

getClassName(): string

Returns

string


getIntersectedLength

getIntersectedLength(): number

Return the intersected length between isoline and triangle

Returns

number

length


getLeftIntersection

getLeftIntersection(): number[]

Return the left intersected point in array

Returns

number[]

leftIntersection


getLeftIntersectionPoint

getLeftIntersectionPoint(): Vector3

Return the left intersected point in THREE.Vector3

Returns

Vector3

v3


getNormal

getNormal(): Vector3

Return the normal of this triangle

Returns

Vector3

normal


getPoint

getPoint(): Vector3

Return the middle point of intersected isoline in triangle

Returns

Vector3

point


getRightIntersection

getRightIntersection(): number[]

Return the right intersected point in array

Returns

number[]

rightIntersection


getRightIntersectionPoint

getRightIntersectionPoint(): Vector3

Return the right intersected point in THREE.Vector3

Returns

Vector3

v3


getSortedVertices

getSortedVertices(): Vector3[]

Return sorted vertices from highest to lowest elevation in an array

Returns

Vector3[]

vertices


isIntersectElevation

isIntersectElevation(): boolean

Returns if this triangle intersect the given elevation.

Returns

boolean


isLineIntersection

isLineIntersection(): boolean

Returns if the intersection between this triangle ad the given elevation form a line.

Returns

boolean


isVerticesValid

isVerticesValid(): boolean

Returns if this triangle is made of points made of real numbers.

Returns

boolean


reset

reset(): void

Reset the properties of this triangle

Returns

void


setProperties

setProperties(a, b, c, elevation, sorted?): void

Set triangle's properties such as vertices and elevation

Parameters

Name Type Description
anumber[]the first vertex
bnumber[]the second vertex
cnumber[]the third vertex
elevationnumberthe elevation that cross the triangle
Optional sortedbooleantrue if the given vertices are already sorted in ascending order by elevation

Returns

void


getClassName

Static getClassName(): string

Returns

string