editor › Globals › CellFactory
Class: CellFactory
Builds CellMembranes for an assembly and provides methods for updating its mesh. Current building-algorithm only works on axis-aligned cuboids (assumptions are marked in the code)
Hierarchy
- CellFactory
Index
Properties
Methods
- _buildFromPlane
- _buildGrid
- _buildMiddleOutline
- _buildWithExiting
- _calculateNeededMembrane
- _getAnchorFromPosition
- _getTouchingSurfaces
- build
- _buildMiddleOutlines
- _createSurfaceDescriptor
- _flipNormalIfNeeded
- findUnusedMembranes
- updateMembraneSizeAfterPushPull
Properties
Private cellSize
• cellSize: Vector2
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:93
Private cells
• cells: CellMembrane[]
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:94
Private mesh
• mesh: Mesh
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:92
Methods
Private _buildFromPlane
▸ _buildFromPlane(plane: Plane): CellMembrane[]
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:298
Find all intersecting cycles and convert each to a cell
Parameters:
| Name | Type |
|---|---|
plane |
Plane |
Returns: CellMembrane[]
Private _buildGrid
▸ _buildGrid(): Plane[][]
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:254
Lays a grid with a given cell size over the mesh. The longest side of the assemblies aabb will get the longer cell size, everything else gets the shorter cell size
This is not an optimal placement (but it's fast)
Returns: Plane[][]
the planes where cuts of the grid are per axis
Private _buildMiddleOutline
▸ _buildMiddleOutline(membrane: CellMembrane): Outline
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:218
Parameters:
| Name | Type |
|---|---|
membrane |
CellMembrane |
Returns: Outline
Private _buildWithExiting
▸ _buildWithExiting(): CellMembrane[]
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:114
Returns: CellMembrane[]
Private _calculateNeededMembrane
▸ _calculateNeededMembrane(surface: MeshSurface, membranes: CellMembrane[]): CellMembrane
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:144
A surface needs another membrane if for any section the distance of the first or last membrane along the section to the start or end of the section is greater than the material size
Limitations: - Only works with rectangular surfaces - Only checks the minimal dimensions of the material size and not both dimensions
Parameters:
| Name | Type |
|---|---|
surface |
MeshSurface |
membranes |
CellMembrane[] |
Returns: CellMembrane
Private _getAnchorFromPosition
▸ _getAnchorFromPosition(position: Vector3, plane: Plane): PointOnEdgeAnchor
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:314
Parameters:
| Name | Type |
|---|---|
position |
Vector3 |
plane |
Plane |
Returns: PointOnEdgeAnchor
Private _getTouchingSurfaces
▸ _getTouchingSurfaces(middle: Outline): MeshSurfaceAnchor[]
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:232
Find Plates which touch the membrane and return the Anchor of their MeshSurface
Parameters:
| Name | Type |
|---|---|
middle |
Outline |
Returns: MeshSurfaceAnchor[]
build
▸ build(mesh: Mesh, materialSize: Vector2, existingCells: CellMembrane[]): CellMembrane[]
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:99
Builds new membranes on a cuboid mesh with or without existing membranes
Parameters:
| Name | Type | Default |
|---|---|---|
mesh |
Mesh | - |
materialSize |
Vector2 | - |
existingCells |
CellMembrane[] | [] |
Returns: CellMembrane[]
Static Private _buildMiddleOutlines
▸ _buildMiddleOutlines(plane: Plane, assembly: Assembly): Outline[]
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:65
Searches for a Cycles in the intersections of the cells plane and the plates to intersect.
Parameters:
| Name | Type |
|---|---|
plane |
Plane |
assembly |
Assembly |
Returns: Outline[]
Static Private _createSurfaceDescriptor
▸ _createSurfaceDescriptor(outline: Outline): SingleSurfaceDescriptor
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:69
Parameters:
| Name | Type |
|---|---|
outline |
Outline |
Returns: SingleSurfaceDescriptor
Static Private _flipNormalIfNeeded
▸ _flipNormalIfNeeded(normal: Vector3): Vector3
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:85
Flips the normal so it points into positive xyz-space. This only works on axis aligned cuboids
Parameters:
| Name | Type |
|---|---|
normal |
Vector3 |
Returns: Vector3
Static findUnusedMembranes
▸ findUnusedMembranes(cells: CellMembrane[], mesh: Mesh): CellMembrane[]
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:50
Return membranes that are not intersecting all their surrounding surfaces
Parameters:
| Name | Type |
|---|---|
cells |
CellMembrane[] |
mesh |
Mesh |
Returns: CellMembrane[]
Static updateMembraneSizeAfterPushPull
▸ updateMembraneSizeAfterPushPull(membrane: CellMembrane, otherMesh: Mesh): void
Defined in src/modules/kyub.core.cell/src/CellFactory.ts:32
If push-pull widens the box orthogonal to a membrane, the membrane needs to be made wider as well. This is done by modifying the mesh (SingleSurface) of the membrane
Parameters:
| Name | Type | Description |
|---|---|---|
membrane |
CellMembrane | The membrane to update |
otherMesh |
Mesh | The mesh that got push-pulled |
Returns: void