-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3b27b6
commit cf51f58
Showing
34 changed files
with
361 additions
and
1,027 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
import Example from "src/Example" | ||
import { designCodeArray } from "src/designCode" | ||
import { JsCadFixture } from "../lib/components/jscad-fixture" | ||
import { Cuboid, Subtract } from "../lib/jscad-fns" | ||
import Example from "src/Example"; | ||
import { JsCadFixture } from "../lib/components/jscad-fixture"; | ||
import { Cuboid, Subtract } from "../lib/jscad-fns"; | ||
|
||
export default () => ( | ||
<Example designCode={designCodeArray}> | ||
<JsCadFixture zAxisUp showGrid> | ||
<Subtract> | ||
<Cuboid size={[10, 5, 2]} /> | ||
{[-4, -2, 0, 2, 4].map((value, index) => ( | ||
<Cuboid key={index} center={[value, 0, 0]} size={[1, 1, 4]} /> | ||
))} | ||
</Subtract> | ||
</JsCadFixture> | ||
<Example> | ||
<JsCadFixture zAxisUp showGrid> | ||
<Subtract> | ||
<Cuboid size={[10, 5, 2]} /> | ||
{[-4, -2, 0, 2, 4].map((value, index) => ( | ||
<Cuboid key={index} center={[value, 0, 0]} size={[1, 1, 4]} /> | ||
))} | ||
</Subtract> | ||
</JsCadFixture> | ||
</Example> | ||
) | ||
); |
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,13 +1,11 @@ | ||
import { designCodeCircle } from "src/designCode"; | ||
import Example from "src/Example"; | ||
import { Circle } from "../lib"; | ||
import { JsCadFixture } from "../lib/components/jscad-fixture"; | ||
|
||
|
||
export default () => ( | ||
<Example designCode={designCodeCircle}> | ||
<JsCadFixture> | ||
<Circle radius={10} /> | ||
</JsCadFixture> | ||
<Example> | ||
<JsCadFixture> | ||
<Circle radius={10} /> | ||
</JsCadFixture> | ||
</Example> | ||
) | ||
); |
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,13 @@ | ||
import Example from "src/Example" | ||
import { designCodeColorizeCube } from "src/designCode" | ||
import { JsCadFixture } from "../lib/components/jscad-fixture" | ||
import { Colorize, Cube } from "../lib/jscad-fns" | ||
import Example from "src/Example"; | ||
import { JsCadFixture } from "../lib/components/jscad-fixture"; | ||
import { Colorize, Cube } from "../lib/jscad-fns"; | ||
|
||
export default () => ( | ||
<Example designCode={designCodeColorizeCube}> | ||
<JsCadFixture> | ||
<Colorize color={"red"}> | ||
<Cube size={10} /> | ||
</Colorize> | ||
</JsCadFixture> | ||
<Example> | ||
<JsCadFixture> | ||
<Colorize color={"red"}> | ||
<Cube size={10} /> | ||
</Colorize> | ||
</JsCadFixture> | ||
</Example> | ||
) | ||
); |
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,21 +1,20 @@ | ||
import { designCodeCone } from "src/designCode"; | ||
import Example from "src/Example"; | ||
import { CylinderElliptic } from "../lib"; | ||
import { JsCadFixture } from "../lib/components/jscad-fixture"; | ||
|
||
export default () => ( | ||
<Example designCode={designCodeCone}> | ||
<JsCadFixture wireframe> | ||
<CylinderElliptic | ||
height={5} | ||
startRadius={[2, 2]} | ||
endRadius={[0, 0]} | ||
segments={32} | ||
startAngle={0} | ||
endAngle={Math.PI * 2} | ||
color="green" | ||
center={[0, 5, 5]} | ||
/> | ||
</JsCadFixture> | ||
<Example> | ||
<JsCadFixture wireframe> | ||
<CylinderElliptic | ||
height={5} | ||
startRadius={[2, 2]} | ||
endRadius={[0, 0]} | ||
segments={32} | ||
startAngle={0} | ||
endAngle={Math.PI * 2} | ||
color="green" | ||
center={[0, 5, 5]} | ||
/> | ||
</JsCadFixture> | ||
</Example> | ||
) | ||
); |
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,12 +1,11 @@ | ||
import { designCodeCube } from "src/designCode"; | ||
import Example from "src/Example"; | ||
import { Cube } from "../lib"; | ||
import { JsCadFixture } from "../lib/components/jscad-fixture"; | ||
|
||
export default () => ( | ||
<Example designCode={designCodeCube}> | ||
<JsCadFixture> | ||
<Cube size={10} color="orange" center={[0, 0, 10]} /> | ||
</JsCadFixture> | ||
<Example> | ||
<JsCadFixture> | ||
<Cube size={10} color="orange" center={[0, 0, 10]} /> | ||
</JsCadFixture> | ||
</Example> | ||
) | ||
); |
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,12 +1,11 @@ | ||
import { designCodeCuboid } from "src/designCode"; | ||
import Example from "src/Example"; | ||
import { Cuboid } from "../lib"; | ||
import { JsCadFixture } from "../lib/components/jscad-fixture"; | ||
|
||
export default () => ( | ||
<Example designCode={designCodeCuboid}> | ||
<JsCadFixture zAxisUp showGrid> | ||
<Cuboid color="blue" offset={{ x: 0, y: 0, z: 0 }} size={[15, 10, 10]} /> | ||
</JsCadFixture> | ||
<Example> | ||
<JsCadFixture zAxisUp showGrid> | ||
<Cuboid color="blue" offset={{ x: 0, y: 0, z: 0 }} size={[15, 10, 10]} /> | ||
</JsCadFixture> | ||
</Example> | ||
) | ||
); |
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,12 +1,11 @@ | ||
import { designCodeCustomSphere } from "src/designCode"; | ||
import Example from "src/Example"; | ||
import { Sphere } from "../lib"; | ||
import { JsCadFixture } from "../lib/components/jscad-fixture"; | ||
|
||
export default () => ( | ||
<Example designCode={designCodeCustomSphere}> | ||
<JsCadFixture wireframe> | ||
<Sphere radius={10} segments={64} /> | ||
</JsCadFixture> | ||
<Example> | ||
<JsCadFixture wireframe> | ||
<Sphere radius={10} segments={64} /> | ||
</JsCadFixture> | ||
</Example> | ||
) | ||
); |
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,20 +1,19 @@ | ||
import { designCodeCustomTorus } from "src/designCode"; | ||
import Example from "src/Example"; | ||
import { Torus } from "../lib"; | ||
import { JsCadFixture } from "../lib/components/jscad-fixture"; | ||
|
||
export default () => ( | ||
<Example designCode={designCodeCustomTorus}> | ||
<JsCadFixture wireframe> | ||
<Torus | ||
innerRadius={15} | ||
outerRadius={20} | ||
innerSegments={64} | ||
outerSegments={96} | ||
innerRotation={Math.PI} | ||
outerRotation={Math.PI / 2} | ||
startAngle={0} | ||
/> | ||
</JsCadFixture> | ||
<Example> | ||
<JsCadFixture wireframe> | ||
<Torus | ||
innerRadius={15} | ||
outerRadius={20} | ||
innerSegments={64} | ||
outerSegments={96} | ||
innerRotation={Math.PI} | ||
outerRotation={Math.PI / 2} | ||
startAngle={0} | ||
/> | ||
</JsCadFixture> | ||
</Example> | ||
) | ||
); |
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,18 +1,17 @@ | ||
import { booleans, primitives } from "@jscad/modeling"; | ||
import { designCodeCustom } from "src/designCode"; | ||
import Example from "src/Example"; | ||
import { Custom } from "../lib"; | ||
import { JsCadFixture } from "../lib/components/jscad-fixture"; | ||
|
||
const cube = primitives.cube({ size: 10 }) | ||
const sphere = primitives.sphere({ radius: 6, segments: 32 }) | ||
const cube = primitives.cube({ size: 10 }); | ||
const sphere = primitives.sphere({ radius: 6, segments: 32 }); | ||
|
||
const intersected = booleans.subtract(cube, sphere) | ||
const intersected = booleans.subtract(cube, sphere); | ||
|
||
export default () => ( | ||
<Example designCode={designCodeCustom}> | ||
<JsCadFixture> | ||
<Custom geometry={intersected} /> | ||
</JsCadFixture> | ||
<Example> | ||
<JsCadFixture> | ||
<Custom geometry={intersected} /> | ||
</JsCadFixture> | ||
</Example> | ||
) | ||
); |
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,19 +1,18 @@ | ||
import { designCodeCylinder } from "src/designCode"; | ||
import Example from "src/Example"; | ||
import { Cylinder } from "../lib"; | ||
import { JsCadFixture } from "../lib/components/jscad-fixture"; | ||
|
||
export default () => ( | ||
<Example designCode={designCodeCylinder}> | ||
<JsCadFixture showGrid zAxisUp> | ||
<Cylinder | ||
radius={5} | ||
height={10} | ||
color="#F7E8AA" | ||
center={[-20, 0, 0]} | ||
rotation={["90deg", 0, 0]} | ||
/> | ||
<Cylinder radius={5} height={10} color="#F7E8AA" center={[20, 0, 0]} /> | ||
</JsCadFixture> | ||
<Example> | ||
<JsCadFixture showGrid zAxisUp> | ||
<Cylinder | ||
radius={5} | ||
height={10} | ||
color="#F7E8AA" | ||
center={[-20, 0, 0]} | ||
rotation={["90deg", 0, 0]} | ||
/> | ||
<Cylinder radius={5} height={10} color="#F7E8AA" center={[20, 0, 0]} /> | ||
</JsCadFixture> | ||
</Example> | ||
) | ||
); |
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,12 +1,11 @@ | ||
import { designCodeEllipsoid } from "src/designCode"; | ||
import Example from "src/Example"; | ||
import { Ellipsoid } from "../lib"; | ||
import { JsCadFixture } from "../lib/components/jscad-fixture"; | ||
|
||
export default () => ( | ||
<Example designCode={designCodeEllipsoid}> | ||
<JsCadFixture wireframe> | ||
<Ellipsoid radius={[15, 10, 10]} color="brown" center={[0, 0, 10]} /> | ||
</JsCadFixture> | ||
<Example> | ||
<JsCadFixture wireframe> | ||
<Ellipsoid radius={[15, 10, 10]} color="brown" center={[0, 0, 10]} /> | ||
</JsCadFixture> | ||
</Example> | ||
) | ||
); |
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,60 +1,59 @@ | ||
import jscad from "@jscad/modeling"; | ||
import { designCodeExtrudeFromSlices } from "src/designCode"; | ||
import Example from "src/Example"; | ||
import { ExtrudeFromSlices } from "../lib"; | ||
import { JsCadFixture } from "../lib/components/jscad-fixture"; | ||
|
||
const { bezier } = jscad.curves | ||
const { bezier } = jscad.curves; | ||
const { circle, line, polygon, rectangle, roundedRectangle, star } = | ||
jscad.primitives | ||
jscad.primitives; | ||
const { extrudeLinear, extrudeRotate, extrudeFromSlices, slice } = | ||
jscad.extrusions | ||
const { mat4 } = jscad.maths | ||
jscad.extrusions; | ||
const { mat4 } = jscad.maths; | ||
|
||
const baseSlice = slice.fromPoints([ | ||
[2, 2], | ||
[-2, 2], | ||
[-2, -2], | ||
[2, -2], | ||
]) | ||
]); | ||
|
||
const xCurve = bezier.create([1, 1.8, 0.4, 1]) | ||
const yCurve = bezier.create([1, 1.8, 0.5]) | ||
const xCurve = bezier.create([1, 1.8, 0.4, 1]); | ||
const yCurve = bezier.create([1, 1.8, 0.5]); | ||
|
||
export default () => ( | ||
<Example designCode={designCodeExtrudeFromSlices}> | ||
<JsCadFixture zAxisUp showGrid> | ||
<ExtrudeFromSlices | ||
numberOfSlices={10} | ||
capStart={true} | ||
capEnd={true} | ||
close={true} | ||
repair={true} | ||
baseSlice={baseSlice} | ||
callback={function (progress, count, base) { | ||
let newslice = slice.transform( | ||
mat4.fromTranslation(mat4.create(), [0, 0, 10 * progress]), | ||
baseSlice, | ||
) | ||
newslice = slice.transform( | ||
mat4.fromScaling(mat4.create(), [ | ||
bezier.valueAt(progress, xCurve) as any, | ||
bezier.valueAt(progress, yCurve) as any, | ||
1, | ||
]), | ||
newslice, | ||
) | ||
<Example> | ||
<JsCadFixture zAxisUp showGrid> | ||
<ExtrudeFromSlices | ||
numberOfSlices={10} | ||
capStart={true} | ||
capEnd={true} | ||
close={true} | ||
repair={true} | ||
baseSlice={baseSlice} | ||
callback={function (progress, count, base) { | ||
let newslice = slice.transform( | ||
mat4.fromTranslation(mat4.create(), [0, 0, 10 * progress]), | ||
baseSlice | ||
); | ||
newslice = slice.transform( | ||
mat4.fromScaling(mat4.create(), [ | ||
bezier.valueAt(progress, xCurve) as any, | ||
bezier.valueAt(progress, yCurve) as any, | ||
1, | ||
]), | ||
newslice | ||
); | ||
|
||
// Rotate the slice 90 degrees along the path | ||
const rotationAngle = (Math.PI / 2) * progress // 90 degrees in radians | ||
newslice = slice.transform( | ||
mat4.fromXRotation(mat4.create(), rotationAngle), | ||
newslice, | ||
) | ||
// Rotate the slice 90 degrees along the path | ||
const rotationAngle = (Math.PI / 2) * progress; // 90 degrees in radians | ||
newslice = slice.transform( | ||
mat4.fromXRotation(mat4.create(), rotationAngle), | ||
newslice | ||
); | ||
|
||
return newslice | ||
}} | ||
/> | ||
</JsCadFixture> | ||
return newslice; | ||
}} | ||
/> | ||
</JsCadFixture> | ||
</Example> | ||
) | ||
); |
Oops, something went wrong.