package
0.0.0-20250127165859-030b425ef91c
Repository: https://github.com/deadsy/sdfx.git
Documentation: pkg.go.dev
# Functions
AcmeThread returns the 2d profile for an acme thread.
ANSIButtressThread returns the 2d profile for an ANSI 45/7 buttress thread.
ArcSpiral2D returns a 2d Archimedean spiral (r = m*theta + b).
Array2D returns an XY grid array of an existing SDF2.
Array3D returns an XYZ array of a given SDF3.
BenchmarkSDF2 reports the evaluation speed for an SDF2.
BenchmarkSDF3 reports the evaluation speed for an SDF3.
Box2D returns a 2d box.
Box3D return an SDF3 for a 3d box (rounded corners with round > 0).
Cache2D wraps the passed SDF2 with an evaluation cache.
Capsule3D return an SDF3 for a capsule.
Center2D centers the origin of an SDF2 on it's bounding box.
CenterAndScale2D centers the origin of an SDF2 on it's bounding box, and then scales it.
ChamferMin returns a minimum function that makes a 45-degree chamfered edge (the diagonal of a square of size <r>).
Circle2D returns the SDF2 for a 2d circle.
Clamp x between a and b, assume a <= b.
Cone3D returns the SDF3 for a trucated cone (round > 0 gives rounded edges).
CubicSpline2D returns an SDF2 made from a set of cubic splines.
Cut2D cuts the SDF2 along a line from a in direction v.
Cut3D cuts an SDF3 along a plane passing through a with normal n.
Cylinder3D return an SDF3 for a cylinder (rounded edges with round > 0).
Difference2D returns the difference of two SDF2 objects, s0 - s1.
Difference3D returns the difference of two SDF3s, s0 - s1.
DtoR converts degrees to radians.
Elongate2D returns the elongation of an SDF2.
Elongate3D returns the elongation of an SDF3.
EqualFloat64 compares two float64 values for equality.
ErrMsg returns an error with a message function name and line number.
ExpMin returns a minimum function with exponential smoothing (k = 32).
Extrude3D does a linear extrude on an SDF3.
ExtrudeRounded3D extrudes an SDF2 to an SDF3 with rounded edges.
FlatFlankCam2D creates a 2D cam profile.
FloatDecode returns a string that decodes the float64 bitfields.
FloatEncode encodes a float64 from sign, fraction and exponent values.
GearRack2D returns the 2D profile for a gear rack.
GenerateMesh2D generates a set of internal mesh points for an SDF2.
Gyroid3D returns a 3d gyroid.
Identity returns a 2x2 identity matrix.
Identity2d returns a 3x3 identity matrix.
Identity3d returns a 4x4 identity matrix.
Intersect2D returns the intersection of two SDF2s.
Intersect3D returns the intersection of two SDF3s.
ISOThread returns the 2d profile for an ISO/UTS thread.
Line2D returns a line from (-l/2,0) to (l/2,0).
LineOf2D returns a union of 2D objects positioned along a line from p0 to p1.
LineOf3D returns a union of 3D objects positioned along a line from p0 to p1.
LoadFont loads a truetype (*.ttf) font file.
Loft3D extrudes an SDF3 that transitions between two SDF2 shapes.
MakeFlatFlankCam makes a flat flank cam profile from design parameters.
MakeThreeArcCam makes a three arc cam profile from design parameters.
Mesh2D returns an SDF2 made from a set of line segments.
Mesh2DSlow returns an SDF2 made from a set of line segments.
Mesh3D returns an SDF3 made from a set of triangles.
Mesh3DSlow returns an SDF3 made from a set of triangles.
MirrorX returns a 3x3 matrix with mirroring across the X axis.
MirrorXeqY returns a 4x4 matrix with mirroring across the X == Y plane.
MirrorXY returns a 4x4 matrix with mirroring across the XY plane.
MirrorXZ returns a 4x4 matrix with mirroring across the XZ plane.
MirrorY returns a 3x3 matrix with mirroring across the Y axis.
MirrorYZ returns a 4x4 matrix with mirroring across the YZ plane.
Mix does a linear interpolation from x to y, a = [0,1].
Multi2D creates a union of an SDF2 at a set of 2D positions.
Multi3D creates a union of an SDF3 at translated positions.
Nagon return the vertices of a N sided regular polygon.
NewBezier returns an empty bezier curve.
NewBezierSpline returns a bezier spline from the provided control/end points.
NewBox2 creates a 2d box with a given center and size.
NewBox3 creates a 3d box with a given center and size.
NewFlange1 returns a flange shape made from a center circle with two side circles.
NewLine2Buffer returns a Line2Buffer.
NewM22 returns a new matrix.
NewM33 returns a new matrix.
NewM44 returns a new matrix.
NewMap2 returns a 2d region to grid coordinates map.
NewPolygon returns an empty polygon.
NewText returns a text object (text and alignment).
NewTriangle3Buffer returns a Triangle3Buffer.
NewVoxelSDF3 returns a VoxelSDF3.
Normal2 returns the normal of an SDF3 at a point (doesn't need to be on the surface).
Normal3 returns the normal of an SDF3 at a point (doesn't need to be on the surface).
NormalExtrude returns an extrusion function.
Offset2D returns an SDF2 that offsets the distance function of another SDF2.
Offset3D returns an SDF3 that offsets the distance function of another SDF3.
Orient3D creates a union of an SDF3 at oriented directions.
PlasticButtressThread returns the 2d profile for a screw top style plastic buttress thread.
Polygon2D returns a Mesh2D built with polygon vertices.
PolyMax returns a maximum function (Try k = 0.1, a bigger k gives a bigger fillet).
PolyMin returns a minimum function (Try k = 0.1, a bigger k gives a bigger fillet).
PowMin returns a minimum function (k = 8).
RandomM22 returns a 2x2 matrix with random elements.
RandomM33 returns a 3x3 matrix with random elements.
RandomM44 returns a 4x4 matrix with random elements.
Raycast2 see Raycast3.
Raycast3 collides a ray (with an origin point from and a direction dir) with an SDF3.
Revolve3D returns an SDF3 for a solid of revolution.
RevolveTheta3D returns an SDF3 for a solid of revolution.
Rotate returns an orthographic 2x2 rotation matrix (right hand rule).
Rotate2d returns an orthographic 3x3 rotation matrix (right hand rule).
Rotate3d returns an orthographic 4x4 rotation matrix (right hand rule).
RotateCopy2D rotates and copies an SDF2 n times in a full circle.
RotateCopy3D rotates and creates N copies of an SDF3 about the z-axis.
RotateToVector returns the rotation matrix that transforms a onto the same direction as b.
RotateUnion2D returns a union of rotated SDF2s.
RotateUnion3D creates a union of SDF3s rotated about the z-axis.
RotateX returns a 4x4 matrix with rotation about the X axis.
RotateY returns a 4x4 matrix with rotation about the Y axis.
RotateZ returns a 4x4 matrix with rotation about the Z axis.
RoundMin returns a minimum function that uses a quarter-circle to join the two objects smoothly.
RtoD converts radians to degrees.
SawTooth generates a sawtooth function.
Scale2d returns a 3x3 scaling matrix.
Scale3d returns a 4x4 scaling matrix.
ScaleExtrude returns an extrusion functions that scales with z.
ScaleExtrude3D extrudes an SDF2 and scales it over the height of the extrusion.
ScaleTwistExtrude returns an extrusion function that scales and twists with z.
ScaleTwistExtrude3D extrudes an SDF2 and scales and twists it over the height of the extrusion.
ScaleUniform2D scales an SDF2 by k on each axis.
ScaleUniform3D uniformly scales an SDF3 on all axes.
Screw3D returns a screw SDF3.
Shell3D returns an SDF3 that shells the surface of an existing SDF3.
Sign returns the sign of x.
Slice2D returns an SDF2 created from a planar slice through an SDF3.
SnapFloat64 snaps a float value to b if it is within epsilon of b.
Sphere3D return an SDF3 for a sphere.
Text2D returns a sized SDF2 for a text object.
ThreadLookup lookups the parameters for a thread by name.
ThreeArcCam2D creates a 2D cam profile.
Transform2D applies a transformation matrix to an SDF2.
Transform3D applies a transformation matrix to an SDF3.
Translate2d returns a 3x3 translation matrix.
Translate3d returns a 4x4 translation matrix.
TwistExtrude returns an extrusion function that twists with z.
TwistExtrude3D extrudes an SDF2 while rotating by twist radians over the height of the extrusion.
Union2D returns the union of multiple SDF2 objects.
Union3D returns the union of multiple SDF3 objects.
VertexToLine converts a set of vertices into a set of line segments.
WriteTriangles writes a stream of triangles to a slice.
ZeroSmall zeroes out values that are small relative to a quantity.
# Constants
InchesPerMillimetre is inches per millimetre.
Mil is millimetres per 1/1000 of an inch.
MillimetresPerInch is millimetres per inch (25.4).
Pi (3.14159...).
Tau (2 * Pi).
# Structs
ArcSpiralSDF2 is a 2d Archimedean spiral.
ArraySDF2 defines an XY grid array of an existing SDF2.
ArraySDF3 stores an XYZ array of a given SDF3.
Bezier curve specification..
BezierPolynomial contains the bezier polynomial parameters.
BezierSpline contains the x/y bezier curves for a 2D spline.
BezierVertex specifies the vertex for a bezier curve.
Box2 is a 2d bounding box.
Box3 is a 3d bounding box.
BoxSDF2 is the 2d signed distance object for a rectangular box.
BoxSDF3 is a 3d box.
CacheSDF2 is an SDF2 cache.
CircleSDF2 is the 2d signed distance object for a circle.
ConeSDF3 is a truncated cone.
CubicPolynomial is a cubic polynomial.
CubicSpline is a 2d cubic spline.
CubicSplineSDF2 is an SDF2 made from a set of cubic splines.
CutSDF2 is an SDF2 made by cutting across an existing SDF2.
CutSDF3 makes a planar cut through an SDF3.
CylinderSDF3 is a cylinder.
DifferenceSDF2 is the difference of two SDF2s.
DifferenceSDF3 is the difference of two SDF3s, s0 - s1.
ElongateSDF2 is the elongation of an SDF2.
ElongateSDF3 is the elongation of an SDF3.
ExtrudeRoundedSDF3 extrudes an SDF2 to an SDF3 with rounded edges.
ExtrudeSDF3 extrudes an SDF2 to an SDF3.
Flange1 is a flange shape made from a center circle with two side circles.
FlatFlankCamSDF2 is 2d cam profile.
GearRackParms defines the parameters for a gear rack.
GearRackSDF2 is a 2d linear gear rack.
GyroidSDF3 is a 3d gyroid.
IntersectionSDF2 is the intersection of two SDF2s.
IntersectionSDF3 is the intersection of two SDF3s.
Line2Buffer buffers lines before writing them to a channel.
LineSDF2 is the 2d signed distance object for a line.
LoftSDF3 is an extrusion between two SDF2s.
Map2 maps a 2d region to integer grid coordinates.
MeshSDF2 is SDF2 made from a set of line segments.
MeshSDF2Slow is SDF2 made from a set of line segments.
MeshSDF3 is an SDF3 made from a set of 3d triangles.
MeshSDF3Slow is an SDF3 made from a set of 3d triangles.
OffsetSDF2 offsets the distance function of an existing SDF2.
OffsetSDF3 offsets the distance function of an existing SDF3.
Polygon stores a set of 2d polygon vertices.
PolygonVertex is a polygon vertex.
RotateCopySDF2 copies an SDF2 n times in a full circle.
RotateCopySDF3 rotates and creates N copies of an SDF3 about the z-axis.
RotateUnionSDF2 defines a union of rotated SDF2s.
RotateUnionSDF3 creates a union of SDF3s rotated about the z-axis.
ScaleUniformSDF2 scales another SDF2 on each axis.
ScaleUniformSDF3 is an SDF3 scaled uniformly in XYZ directions.
ScrewSDF3 is a 3d screw form.
ShellSDF3 shells the surface of an existing SDF3.
SliceSDF2 creates an SDF2 from a planar slice through an SDF3.
SorSDF3 solid of revolution, SDF2 to SDF3.
SphereSDF3 is a sphere.
Text stores a UTF8 string and it's rendering parameters.
ThreadParameters stores the values that define a thread.
ThreeArcCamSDF2 is 2d cam profile.
TransformSDF2 transorms an SDF2 with rotation, translation and scaling.
TransformSDF3 is an SDF3 transformed with a 4x4 transformation matrix.
Triangle3Buffer buffers triangles before writing them to a channel.
UnionSDF2 is a union of multiple SDF2 objects.
UnionSDF3 is a union of SDF3s.
VoxelSDF3 is the SDF that represents a pre-computed voxel-based SDF3.
# Interfaces
Line2Writer is the interface of a line writer/closer object.
SDF2 is the interface to a 2d signed distance function object.
SDF3 is the interface to a 3d signed distance function object.
Triangle3Writer is the interface of a triangle writer/closer object.
# Type aliases
ExtrudeFunc maps v3.Vec to v2.Vec - the point used to evaluate the SDF2.
Interval is a closed interval on real numbers.
Line2 is a 2d line defined with end-points.
M22 is a 2x2 matrix.
M33 is a 3x3 matrix.
M44 is a 4x4 matrix.
MaxFunc is a maximum function for SDF blending.
MinFunc is a minimum functions for SDF blending.
Triangle2 is a 2D triangle.
Triangle3 is a 3D triangle.