-
Notifications
You must be signed in to change notification settings - Fork 12
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
8427262
commit 7068e98
Showing
4 changed files
with
104 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/unixpickle/model3d/model3d" | ||
"github.com/unixpickle/model3d/render3d" | ||
"github.com/unixpickle/model3d/toolbox3d" | ||
) | ||
|
||
func Ears() (model3d.Solid, toolbox3d.CoordColorFunc) { | ||
const tiltFactor = 0.99 | ||
earSolid := &model3d.Cylinder{ | ||
P1: model3d.XYZ(-0.8, 0.1, 2.0), | ||
P2: model3d.XYZ(-0.8*tiltFactor, 0.2, 2.0*tiltFactor), | ||
Radius: 0.2, | ||
} | ||
insideSolid := &model3d.Cylinder{ | ||
P1: model3d.XYZ(-0.8, 0.1, 2.0), | ||
P2: model3d.XYZ(-0.8*tiltFactor, 0.2, 2.0*tiltFactor), | ||
Radius: 0.1, | ||
} | ||
insideSolid.P1.Y -= 0.1 | ||
insideSolid.P2.Y += 0.1 | ||
|
||
otherEar := *earSolid | ||
otherEar.P1.X *= -1 | ||
otherEar.P2.X *= -1 | ||
bothEars := model3d.JoinedSolid{ | ||
earSolid, &otherEar, | ||
} | ||
|
||
otherInside := *insideSolid | ||
otherInside.P1.X *= -1 | ||
otherInside.P2.X *= -1 | ||
bothInside := model3d.JoinedSolid{ | ||
insideSolid, &otherInside, | ||
} | ||
|
||
return bothEars, func(c model3d.Coord3D) render3d.Color { | ||
if bothInside.Contains(c) { | ||
return render3d.NewColor(0) | ||
} else { | ||
return BodyColor | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/unixpickle/model3d/model3d" | ||
"github.com/unixpickle/model3d/render3d" | ||
"github.com/unixpickle/model3d/toolbox3d" | ||
) | ||
|
||
var NoseColor = render3d.NewColorRGB(0xd9/255.0, 0xce/255.0, 0x98/255.0) | ||
|
||
func Nose() (model3d.Solid, toolbox3d.CoordColorFunc) { | ||
mound := &model3d.Torus{ | ||
Center: model3d.YZ(0.4, 1.0), | ||
Axis: model3d.YZ(-0.5, 0.55).Normalize(), | ||
InnerRadius: 0.15, | ||
OuterRadius: 0.3, | ||
} | ||
dot := model3d.TranslateSolid( | ||
model3d.VecScaleSolid( | ||
&model3d.Sphere{Radius: 0.1}, | ||
model3d.XYZ(1.0, 1.0, 0.8), | ||
), | ||
model3d.YZ(0.7, 1.35), | ||
) | ||
return model3d.JoinedSolid{mound, dot}, func(c model3d.Coord3D) render3d.Color { | ||
if dot.Contains(c) { | ||
return render3d.NewColor(0) | ||
} else { | ||
return NoseColor | ||
} | ||
} | ||
} |
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,20 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/unixpickle/model3d/model3d" | ||
"github.com/unixpickle/model3d/render3d" | ||
"github.com/unixpickle/model3d/toolbox3d" | ||
) | ||
|
||
func Teeth() (model3d.Solid, toolbox3d.CoordColorFunc) { | ||
tooth := &model3d.Capsule{ | ||
P1: model3d.YZ(0.69, 1.15), | ||
P2: model3d.YZ(0.69, 0.95), | ||
Radius: 0.055, | ||
} | ||
teeth := model3d.JoinedSolid{ | ||
model3d.TranslateSolid(tooth, model3d.X(-0.055)), | ||
model3d.TranslateSolid(tooth, model3d.X(0.055)), | ||
} | ||
return teeth, toolbox3d.ConstantCoordColorFunc(render3d.NewColor(1.0)) | ||
} |