Class: Pattern

Pattern()

new Pattern()

Source:

Methods

addEdge(edge) → {number|number}

Try to ad an edges to the pattern, by looking for a triangle that is joined to it.
Parameters:
Name Type Description
edge number the id of the edge to add.
Source:
Returns:
  • -2 when egde is already owned by the pattern
    Type
    number
  • -1 when was not able to add the edge
    Type
    number

addTriangle(t) → {number}

Add triangle id to the member triangles[]
Parameters:
Name Type Description
t number The id of the triangle to add
Source:
Returns:
0 if succesful, -1 if triangle is already owned
Type
number

areFlatTriangleJoined()

test if two triangles are joined, by checking the distance between shared summits.
Source:

assembleFlattenedTriangles()

Assemble the pattern, must not be called until the triangles have been flattened
Source:

flatten()

symply call flattenTrianglesCoord (), assembleFlattenedTriangles () and genNodes (). In this order.
Source:

flattenTrianglesCoord()

calculate the flat coord of each triangle. mistake was done earlyer, pattern triangles ids are store in an array of array instead of an array of (js) objects dont wand to rewrite this now, so flat coordinates will be store in a separate array of array - SO - P.triangles[x] & P.trianlesflatcoord[x] refer to the same triangle and will always be. the other reason why is that full OOP rewrite is planed
Source:

genFrontiers()

find edges id witch are frontier of the pattern.
Source:

genNodes()

compute the frontier's nodes of the pattern, using the pattern's flattened triangles summits And order them to corectly define a shape frontier
Source:

gentriangles()

Find the pattern triangles using pattern edges
Source:

getFlatTriangle(mtid) → {object}

returns the flattened triangle object that matches the triangle of the mesh of which the id is Mtid
Parameters:
Name Type Description
mtid number mesh triangle's id
Source:
Returns:
flattened triangle
Type
object

getTriangleIndex(tid) → {number}

indicate the index of the specified triangle into menber triangles[]
Parameters:
Name Type Description
tid number the id of the wanted triangle
Source:
Returns:
the index of the wanted triangle in member "triangles[]" -1 if cannot be founded
Type
number

owntriangle(t) → {number}

Search for a triangle by it's id into pattern
Parameters:
Name Type Description
t number The id of the triangle to look for
Source:
Returns:
The index of the triangle into member triangles[] or -1 if the pattern doesn' own the triangle
Type
number

smartPositioning()

Update some stats
Source: