Geometry

class cee.usg.Geometry()

The geometry class defines a CAE surface geometry that can be used in one or more States.

A geometry has one or more Parts. Each part defines a mesh with surface elements and nodes, as well as settings on how to render a part. There is no limit on the number of nodes per element. A mesh can also be shared between parts (in the same or different geometries).

The common case is to use one geometry for all states and then use displacements and/or transformation results to animate the model. Scalar and vector results can also be defined per state.

Example:

let model = new cee.usg.UnstructGridModel();
this.m_view.addModel(model);
this.m_view.background.setSingleColor({r: 1, g: 1, b:1, a: 1});

let geometry = new cee.usg.Geometry();

const vertexArr = [
    0,0,0,
    1,0,0, 1,3,0,
    2,0,0, 4,0,0, 3,3,0,
    5,0,0, 7,0,0, 7,3,0, 5,3,0,
    9,0,0, 10,0,0, 11,1,0, 11,2,0, 10,3,0, 9,3,0, 8,2,0, 8,1,0,
    12,0,0, 14,0,0, 16,0,0,
    12,3,0, 14,3,0, 16,3,0
];

const elConnArr = [
    0,
    1,2,
    3,4,5,
    6,7,8,9,
    10,11,12,13,14,15,16,17,
    18,19,22,21,
    19,20,23,22
];

const elNodeCountArr = [1, 2, 3, 4, 8, 4, 4];

// Create the first part
let part1 = geometry.addPart();
part1.mesh = new cee.usg.Mesh(vertexArr, elNodeCountArr, elConnArr);
part1.settings.color = new cee.Color3(1,0,0);

// Create the second part - same mesh with transform
let part2 = geometry.addPart();
part2.mesh = part1.mesh;
part2.settings.color = new cee.Color3(0,1,0);
part2.settings.drawStyle = cee.usg.DrawStyle.SURFACE_MESH;

// Create a state, set the geometry and add the scalar result
let state = model.addState();
state.geometry = geometry;

// Transform the second part
state.setPartTransformationAt(1, cee.Mat4.fromTranslation(new cee.Vec3(0,5,0)));

This code sample produces the following image in the 3D Viewer:

../../_images/UsgGeometry.png

Constructors

Accessors

  • partCount


Constructors

Geometry.constructor()
Return type:

Geometry

Accessors

cee.usg.partCount()

The number of parts in the model.

Return type:

number

Methods

addPart

Geometry.addPart()

Creates a new part and adds it to the geometry.

Returns the newly created part.

Return type:

Part

deleteAllParts

Geometry.deleteAllParts()

Delete all parts in the geometry

Return type:

void

deletePartAt

Geometry.deletePartAt(partIndex)
Arguments:
  • partIndex (number) – None

Delete the part at the given zero based index

Return type:

void

getPartArray

Geometry.getPartArray()

Returns a read only array with all parts

Return type:

unknown

getPartAt

Geometry.getPartAt(partIndex)
Arguments:
  • partIndex (number) – None

Returns an active reference to the part at the given (zero based) index.

Return type:

Part