Documentation ¶
Index ¶
- func MirrorX() m33
- func MirrorXY() m44
- func MirrorXZ() m44
- func MirrorXeqY() m44
- func MirrorY() m33
- func MirrorYZ() m44
- func NormalExtrude(p r3.Vec) r2.Vec
- func R2FromI(a V2i) r2.Vecdeprecated
- func R3FromI(a V3i) r3.Vecdeprecated
- func Rotate(a float64) m22
- func Rotate2D(a float64) m33
- func Rotate3D(v r3.Vec, a float64) m44
- func RotateX(a float64) m44
- func RotateY(a float64) m44
- func RotateZ(a float64) m44
- func Scale2D(v r2.Vec) m33
- func Scale3D(v r3.Vec) m44
- func Translate2D(v r2.Vec) m33
- func Translate3D(v r3.Vec) m44
- type CutSDF2
- type ExtrudeFunc
- type MaxFunc
- type MinFunc
- type SDF2
- func Center2D(s SDF2) SDF2
- func CenterAndScale2D(s SDF2, k float64) SDF2
- func Cut2D(sdf SDF2, a, v r2.Vec) SDF2
- func Elongate2D(sdf SDF2, h r2.Vec) SDF2
- func LineOf2D(s SDF2, p0, p1 r2.Vec, pattern string) SDF2
- func Multi2D(s SDF2, positions d2.Set) SDF2
- func Offset2D(sdf SDF2, offset float64) SDF2
- func RotateCopy2D(sdf SDF2, n int) SDF2
- func RotateUnion2D(sdf SDF2, num int, step m33) SDF2
- func ScaleUniform2D(sdf SDF2, k float64) SDF2
- func Slice2D(sdf SDF3, a, n r3.Vec) SDF2
- func Transform2D(sdf SDF2, m m33) SDF2
- type SDF2Diff
- type SDF2Union
- type SDF3
- func Cut3D(sdf SDF3, a, n r3.Vec) SDF3
- func Elongate3D(sdf SDF3, h r3.Vec) SDF3
- func Extrude3D(sdf SDF2, height float64) SDF3
- func ExtrudeRounded3D(sdf SDF2, height, round float64) SDF3
- func LineOf3D(s SDF3, p0, p1 r3.Vec, pattern string) SDF3
- func Loft3D(sdf0, sdf1 SDF2, height, round float64) SDF3
- func Multi3D(s SDF3, positions d3.Set) SDF3
- func Offset3D(sdf SDF3, offset float64) SDF3
- func Orient3D(s SDF3, base r3.Vec, directions d3.Set) SDF3
- func Revolve3D(sdf SDF2, theta float64) SDF3
- func RotateCopy3D(sdf SDF3, num int) SDF3
- func ScaleExtrude3D(sdf SDF2, height float64, scale r2.Vec) SDF3
- func ScaleTwistExtrude3D(sdf SDF2, height, twist float64, scale r2.Vec) SDF3
- func ScaleUniform3D(sdf SDF3, k float64) SDF3
- func Shell3D(sdf SDF3, thickness float64) SDF3
- func Transform3D(sdf SDF3, matrix m44) SDF3
- func TwistExtrude3D(sdf SDF2, height, twist float64) SDF3
- type SDF3Diff
- type SDF3Union
- type ScaleUniformSDF2
- type TransformSDF2
- type V2i
- func R2ToI(a r2.Vec) V2ideprecated
- type V3i
- func R3ToI(a r3.Vec) V3ideprecated
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MirrorXY ¶
func MirrorXY() m44
MirrorXY returns a 4x4 matrix with mirroring across the XY plane.
func MirrorXZ ¶
func MirrorXZ() m44
MirrorXZ returns a 4x4 matrix with mirroring across the XZ plane.
func MirrorXeqY ¶
func MirrorXeqY() m44
MirrorXeqY returns a 4x4 matrix with mirroring across the X == Y plane.
func MirrorYZ ¶
func MirrorYZ() m44
MirrorYZ returns a 4x4 matrix with mirroring across the YZ plane.
func NormalExtrude ¶
NormalExtrude returns an extrusion function.
func Rotate ¶
func Rotate(a float64) m22
Rotate returns an orthographic 2x2 rotation matrix (right hand rule).
func Rotate2D ¶
func Rotate2D(a float64) m33
Rotate2D returns an orthographic 3x3 rotation matrix (right hand rule).
func RotateX ¶
func RotateX(a float64) m44
RotateX returns a 4x4 matrix with rotation about the X axis.
func RotateY ¶
func RotateY(a float64) m44
RotateY returns a 4x4 matrix with rotation about the Y axis.
func RotateZ ¶
func RotateZ(a float64) m44
RotateZ returns a 4x4 matrix with rotation about the Z axis.
func Scale2D ¶
Scale2D returns a 3x3 scaling matrix. Scaling does not preserve distance. See: ScaleUniform2D().
Types ¶
type CutSDF2 ¶
type CutSDF2 struct {
// contains filtered or unexported fields
}
CutSDF2 is an SDF2 made by cutting across an existing SDF2.
type ExtrudeFunc ¶
ExtrudeFunc maps r3.Vec to V2 - the point used to evaluate the SDF2.
func ScaleExtrude ¶
func ScaleExtrude(height float64, scale r2.Vec) ExtrudeFunc
ScaleExtrude returns an extrusion functions that scales with z.
func ScaleTwistExtrude ¶
func ScaleTwistExtrude(height, twist float64, scale r2.Vec) ExtrudeFunc
ScaleTwistExtrude returns an extrusion function that scales and twists with z.
func TwistExtrude ¶
func TwistExtrude(height, twist float64) ExtrudeFunc
TwistExtrude returns an extrusion function that twists with z.
type MinFunc ¶
MinFunc is a minimum functions for SDF blending.
func MinPoly ¶
MinPoly creates a n-degree polynomial MinFunc with parameter k that controls radius of the smoothing function.
- n<0 or k<=0 undefined output
- n=0 returns a chamfer-like MinFunc
- n=1 returns math.Min
type SDF2 ¶
type SDF2 interface { // Evaluate takes a point in 2D space as input and returns // the minimum distance of the SDF2 to the point. The distance // is negative if the point is contained within the SDF3. Evaluate(p r2.Vec) float64 // Bounds returns the bounding box that completely contains the SDF2. Bounds() r2.Box }
SDF2 is the interface to a 2d signed distance function object.
func CenterAndScale2D ¶
CenterAndScale2D centers the origin of an SDF2 on it's bounding box, and then scales it. Distance is correct with scaling.
func Cut2D ¶
Cut2D cuts the SDF2 along a line from a in direction v. The SDF2 to the right of the line remains.
func Elongate2D ¶
Elongate2D returns the elongation of an SDF2.
func RotateCopy2D ¶
RotateCopy2D rotates and copies an SDF2 n times in a full circle.
func RotateUnion2D ¶
RotateUnion2D returns a union of rotated SDF2s.
func ScaleUniform2D ¶
ScaleUniform2D scales an SDF2 by k on each axis. Distance is correct with scaling.
func Slice2D ¶
Slice2D returns an SDF2 created from a planar slice through an SDF3. a is point on slicing plane, n is normal to slicing plane
func Transform2D ¶
Transform2D applies a transformation matrix to an SDF2. Distance is *not* preserved with scaling.
type SDF2Diff ¶
func Difference2D ¶
Difference2D returns the difference of two SDF2 objects, s0 - s1.
func Intersect2D ¶
Intersect2D returns the intersection of two SDF2s.
type SDF3 ¶
type SDF3 interface { // Evaluate takes a point in 3D space as input and returns // the minimum distance of the SDF3 to the point. The distance // is negative if the point is contained within the SDF3. Evaluate(p r3.Vec) float64 // Bounds returns the bounding box that completely contains // the SDF3. Bounds() r3.Box }
SDF3 is the interface to a 3d signed distance function object.
func Cut3D ¶
Cut3D cuts an SDF3 along a plane passing through a with normal n. The SDF3 on the same side as the normal remains.
func Elongate3D ¶
Elongate3D returns the elongation of an SDF3.
func ExtrudeRounded3D ¶
ExtrudeRounded3D extrudes an SDF2 to an SDF3 with rounded edges.
func Revolve3D ¶
Revolve3D returns an SDF3 for a solid of revolution. theta is in radians. For a full revolution call
Revolve3D(s0, 2*math.Pi)
func RotateCopy3D ¶
RotateCopy3D rotates and creates N copies of an SDF3 about the z-axis. num is the number of copies.
func ScaleExtrude3D ¶
ScaleExtrude3D extrudes an SDF2 and scales it over the height of the extrusion.
func ScaleTwistExtrude3D ¶
ScaleTwistExtrude3D extrudes an SDF2 and scales and twists it over the height of the extrusion.
func ScaleUniform3D ¶
ScaleUniform3D uniformly scales an SDF3 on all axes.
func Transform3D ¶
Transform3D applies a transformation matrix to an SDF3.
func TwistExtrude3D ¶
TwistExtrude3D extrudes an SDF2 while rotating by twist radians over the height of the extrusion.
type SDF3Diff ¶
func Difference3D ¶
Difference3D returns the difference of two SDF3s, s0 - s1. Difference3D will panic if one any of the arguments is nil.
func Intersect3D ¶
Intersect3D returns the intersection of two SDF3s. Intersect3D will panic if any of the arguments are nil.
type SDF3Union ¶
func RotateUnion3D ¶
RotateUnion3D creates a union of SDF3s rotated about the z-axis. num is the number of copies.
type ScaleUniformSDF2 ¶
type ScaleUniformSDF2 struct {
// contains filtered or unexported fields
}
ScaleUniformSDF2 scales another SDF2 on each axis.
func (*ScaleUniformSDF2) Bounds ¶
func (s *ScaleUniformSDF2) Bounds() r2.Box
BoundingBox returns the bounding box of an SDF2 with uniform scaling.
type TransformSDF2 ¶
type TransformSDF2 struct {
// contains filtered or unexported fields
}
TransformSDF2 transorms an SDF2 with rotation, translation and scaling.
func (*TransformSDF2) Bounds ¶
func (s *TransformSDF2) Bounds() r2.Box
BoundingBox returns the bounding box of a transformed SDF2.
type V2i ¶
type V2i [2]int
V2i is a 2D integer vector.