-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(modeling): reworked slice to use vertices in parameters, etc
* refactor(modeling): reworked slice to use vertices in parameters, etc. * refactor(modeling): adjusted usage of slice in extrusions
- Loading branch information
Showing
16 changed files
with
51 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import test from 'ava' | ||
|
||
import { create, clone, fromPoints, toPoints } from './index.js' | ||
import { create, clone, fromVertices, toVertices } from './index.js' | ||
|
||
test('slice: clone() should return a new slice with same values', (t) => { | ||
const org1 = create() | ||
const ret1 = clone(org1) | ||
t.not(ret1, org1) | ||
|
||
const org2 = fromPoints([[1, 1], [-1, 1], [-1, -1], [1, -1]]) | ||
const org2 = fromVertices([[1, 1], [-1, 1], [-1, -1], [1, -1]]) | ||
const ret2 = clone(org2) | ||
t.not(ret2, org2) | ||
t.deepEqual(toPoints(ret2), toPoints(org2)) | ||
t.deepEqual(toVertices(ret2), toVertices(org2)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Vec2, Vec3 } from '../../maths/types' | ||
|
||
import { Slice } from './type' | ||
|
||
type Vertex = Vec2 | Vec3 | ||
|
||
export function fromVertices(points: Array<Vertex>): Slice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/modeling/src/geometries/slice/fromVertices.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import test from 'ava' | ||
|
||
import { fromVertices } from './index.js' | ||
|
||
test('slice: fromVertices() should return a new slice with correct values', (t) => { | ||
const exp1 = { | ||
contours: [[[0, 0, 0], [1, 0, 0], [1, 1, 0]]] | ||
} | ||
const obs1 = fromVertices([[0, 0], [1, 0], [1, 1]]) | ||
t.deepEqual(obs1, exp1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters