editor › Globals › FingerSpecsGenerator
Class: FingerSpecsGenerator
Generates the FingerSpecs that can then be passed to the FingerShapeGenerator.
"Fingers" are defined on a normalized outline section that goes from left to right: (0,0) is the start of the section. y is up. x is left. This means that positive values for y (e.g. additions and cutouts) are outside of the plate. Negative values are inside the plate.
^ | y axis (+y is up) | <------------------------------- <-- outline section normalized from right to left | ^ | | | the plate | v |
see ../../src/model/visualization/Joints/FingerSpecsGenerator_documentation.svg details and explanation of formulas
Hierarchy
- FingerSpecsGenerator
Index
Methods
- _applySafetyMargins
- _applySingleNonStrictSafetyMargin
- _createAdditionsCutouts
- _createConstrainedAlternatingCutouts
- _makeFlexSpec
- _mergeAdjacentCutouts
- _offsetCutoutLength
- _offsetFlexSpec
- _reverseFingerSpecs
- determineFingerWidth
- generateFingerSpecs
Methods
Static Private _applySafetyMargins
▸ _applySafetyMargins(cutouts: any, additions: any, marginStart: any, marginEnd: any, length: any, actualLength: any, hasFirstFinger: any, hasLastFinger: any, strictSafetyMarginStart: any, strictSafetyMarginEnd: any): object
Defined in src/model/visualization/Joints/Renderer/FingerRendering/FingerSpecsGenerator.ts:371
Parameters:
| Name | Type |
|---|---|
cutouts |
any |
additions |
any |
marginStart |
any |
marginEnd |
any |
length |
any |
actualLength |
any |
hasFirstFinger |
any |
hasLastFinger |
any |
strictSafetyMarginStart |
any |
strictSafetyMarginEnd |
any |
Returns: object
-
additions: CutoutSpec = newAdditions
-
cutouts: CutoutSpec = newCutouts
Static Private _applySingleNonStrictSafetyMargin
▸ _applySingleNonStrictSafetyMargin(safetyMargin: number, fingerWidth: number, hasFinger: boolean, numberOfFingers: number, startOrEnd: "start" | "end", length: number, start: number, additions: CutoutSpec, cutouts: CutoutSpec): object
Defined in src/model/visualization/Joints/Renderer/FingerRendering/FingerSpecsGenerator.ts:297
Applies the given safety margin at the start or end of the section. First, it tries to use the normal fingers to fulfill the safety margin. If that fails, it will create a dedicated shape (cutout/addition) to fulfill it. The other parameters are adjusted accordingly.
Parameters:
| Name | Type | Description |
|---|---|---|
safetyMargin |
number | - |
fingerWidth |
number | - |
hasFinger |
boolean | - |
numberOfFingers |
number | - |
startOrEnd |
"start" | "end" | - |
length |
number | - |
start |
number | - |
additions |
CutoutSpec | - |
cutouts |
CutoutSpec | - |
Returns: object
-
consumedLength: number
-
fingerWidth: number
-
flipAdjacentFinger: boolean
-
numberOfFingers: number
Static Private _createAdditionsCutouts
▸ _createAdditionsCutouts(length: number, actualLength: number, targetFingerWidth: number, hasFirstFinger: boolean, hasLastFinger: boolean, safetyMarginStart: number, safetyMarginEnd: number, strictSafetyMarginStart: boolean, strictSafetyMarginEnd: boolean, jpc: JoinedPlatesContext): object
Defined in src/model/visualization/Joints/Renderer/FingerRendering/FingerSpecsGenerator.ts:170
Divides the line strip length into fingerWidth distances and assign these substrips alternating to cutoutsA or B to create a finger pattern. This method already takes into account the safety margins at either end.
Parameters:
| Name | Type | Description |
|---|---|---|
length |
number | The length of the strip, that needs to be divided. |
actualLength |
number | The resulting (physical) length of the strip |
targetFingerWidth |
number | targetFingerWidth the target width of a finger/cutout |
hasFirstFinger |
boolean | - |
hasLastFinger |
boolean | - |
safetyMarginStart |
number | - |
safetyMarginEnd |
number | - |
strictSafetyMarginStart |
boolean | - |
strictSafetyMarginEnd |
boolean | - |
jpc |
JoinedPlatesContext | - |
Returns: object
-
additions: CutoutSpec
-
cutouts: CutoutSpec
Static Private _createConstrainedAlternatingCutouts
▸ _createConstrainedAlternatingCutouts(length: any, actualLength: any, fingerWidth: any, constraints: number[]): object
Defined in src/model/visualization/Joints/Renderer/FingerRendering/FingerSpecsGenerator.ts:329
Parameters:
| Name | Type |
|---|---|
length |
any |
actualLength |
any |
fingerWidth |
any |
constraints |
number[] |
Returns: object
-
cutoutsA: CutoutSpec
-
cutoutsB: CutoutSpec
Static Private _makeFlexSpec
▸ _makeFlexSpec(cutoutSpec: CutoutSpec): FlexCutoutSpec
Defined in src/model/visualization/Joints/Renderer/FingerRendering/FingerSpecsGenerator.ts:498
Parameters:
| Name | Type |
|---|---|
cutoutSpec |
CutoutSpec |
Returns: FlexCutoutSpec
Static Private _mergeAdjacentCutouts
▸ _mergeAdjacentCutouts(cutouts: any): any
Defined in src/model/visualization/Joints/Renderer/FingerRendering/FingerSpecsGenerator.ts:442
Parameters:
| Name | Type |
|---|---|
cutouts |
any |
Returns: any
Static Private _offsetCutoutLength
▸ _offsetCutoutLength(specs: CutoutSpec, offset: number, adjustFirstCut: boolean, adjustLastCut: boolean): void
Defined in src/model/visualization/Joints/Renderer/FingerRendering/FingerSpecsGenerator.ts:477
symmetrically adjust the length of the cutouts (or additions) in the given cutout spec, but not beyond the original section dimensions
Parameters:
| Name | Type | Description |
|---|---|---|
specs |
CutoutSpec | the CutoutSpec to be edited |
offset |
number | positive value increases lengths, negative decreases lengths of cutouts |
adjustFirstCut |
boolean | whether the start of the first cutout should be adjusted |
adjustLastCut |
boolean | whether the end of the last cutout should be adjusted |
Returns: void
Static Private _offsetFlexSpec
▸ _offsetFlexSpec(flexSpec: FlexCutoutSpec, offset: IExpression, adjustFirstCut: boolean, adjustLastCut: boolean): FlexCutoutSpec
Defined in src/model/visualization/Joints/Renderer/FingerRendering/FingerSpecsGenerator.ts:513
symmetrically adjust the length of the cutouts (or additions) in the given spec, but not beyond the original section dimensions
Parameters:
| Name | Type | Description |
|---|---|---|
flexSpec |
FlexCutoutSpec | the FlexCutoutSpec to modify |
offset |
IExpression | positive value increases lengths, negative decreases lengths of cutouts |
adjustFirstCut |
boolean | whether the start of the first cutout should be adjusted |
adjustLastCut |
boolean | whether the end of the last cutout should be adjusted |
Returns: FlexCutoutSpec
Static Private _reverseFingerSpecs
▸ _reverseFingerSpecs(specs: CutoutSpec, length: number): void
Defined in src/model/visualization/Joints/Renderer/FingerRendering/FingerSpecsGenerator.ts:461
Parameters:
| Name | Type |
|---|---|
specs |
CutoutSpec |
length |
number |
Returns: void
Static determineFingerWidth
▸ determineFingerWidth(plates: [Plate, Plate]): number
Defined in src/model/visualization/Joints/Renderer/FingerRendering/FingerSpecsGenerator.ts:151
Determine finger width based on the average material thickness
Parameters:
| Name | Type |
|---|---|
plates |
[Plate, Plate] |
Returns: number
Static generateFingerSpecs
▸ generateFingerSpecs(joinedPlatesContext: JoinedPlatesContext, fingerWidth: number, hasFirstFinger: boolean, hasLastFinger: boolean, safetyMarginStart: number, safetyMarginEnd: number, strictSafetyMarginStart: boolean, strictSafetyMarginEnd: boolean, fabricationConfig: FabricationConfig, length: number, actualLength: number, constraints?: number[], reverseSpecs: boolean): FingerSpecs
Defined in src/model/visualization/Joints/Renderer/FingerRendering/FingerSpecsGenerator.ts:50
Generates specifications for the fingers of a finger joint
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
joinedPlatesContext |
JoinedPlatesContext | - | - |
fingerWidth |
number | - | intended width of the fingers, in mm |
hasFirstFinger |
boolean | - | hasFirstFinger whether this joint starts with a finger (true) or a cutout (false) |
hasLastFinger |
boolean | - | hasLastFinger whether this joint ends with a finger (true) or a cutout (false) |
safetyMarginStart |
number | 0 | Within the safetyMargin, the additions/cutouts must not alter between addition/cutout. |
safetyMarginEnd |
number | 0 | - |
strictSafetyMarginStart |
boolean | false | If the safetyMargin is strict, both plates will get a cutout here. |
strictSafetyMarginEnd |
boolean | false | - |
fabricationConfig |
FabricationConfig | - | - |
length |
number | - | The length of the section |
actualLength |
number | length | The actual (physical) length of the section. E.g. the length deviates from the actual length when rendering bent plates. The length is the curved (actual) length +/- some percent of stretching. |
constraints? |
number[] | - | - |
reverseSpecs |
boolean | false | - |
Returns: FingerSpecs