Documentation
¶
Overview ¶
Package wire implements wireframe 3d shapes.
Package wire implements wireframe 3d shapes.
Package wire implements wireframe 3d shapes.
Package wire implements wireframe 3d shapes.
Package wire implements wireframe 3d shapes.
Package wire implements wireframe 3d shapes.
Package wire implements wireframe 3d shapes.
Package wire implements wireframe 3d shapes.
Package wire implements wireframe 3d shapes.
Index ¶
- Variables
- func ApplyFogAndWaterLevel(objectY, objectZ float64)
- func CirclePath(radius float64, res int) (PointList, []*Segment)
- func GetRGB() (float64, float64, float64)
- func InitWorld(context Context, cx, cy, cz float64)
- func LabelPoints(b bool)
- func SetCenter(x, y, z float64)
- func SetClipping(near, far float64)
- func SetFog(active bool, near, far float64)
- func SetFont(font FontType, size, spacing float64)
- func SetFontSize(size float64)
- func SetFontSpacing(spacing float64)
- func SetFontType(font FontType)
- func SetPerspective(fl float64)
- func SetRGB(r, g, b float64)
- func SetWaterLevel(active bool, top, bottom float64)
- type Context
- type FontType
- type Lure3d
- type Point
- func LerpPoint(t float64, p0, p1 *Point) *Point
- func NewPoint(x, y, z float64) *Point
- func RandomPointInBox(w, h, d float64) *Point
- func RandomPointInCircle(radius float64) *Point
- func RandomPointInCylinder(height, radius float64) *Point
- func RandomPointInRectangle(w, d float64) *Point
- func RandomPointInSphere(radius float64) *Point
- func RandomPointInSphereDist(radius, dist float64) *Point
- func RandomPointInTorus(radius1, radius2, arc float64) *Point
- func RandomPointOnBox(w, h, d float64) *Point
- func RandomPointOnCylinder(height, radius float64, includeCaps bool) *Point
- func RandomPointOnSphere(radius float64) *Point
- func RandomPointOnTorus(radius1, radius2, arc float64) *Point
- func (p *Point) Clone() *Point
- func (p *Point) Distance(other *Point) float64
- func (p *Point) Lerp(t float64, p1 *Point)
- func (p *Point) Magnitude() float64
- func (p *Point) Normalize()
- func (p *Point) Normalized() *Point
- func (p *Point) Project()
- func (p *Point) Randomize(amount float64)
- func (p *Point) RandomizeX(amount float64)
- func (p *Point) RandomizeY(amount float64)
- func (p *Point) RandomizeZ(amount float64)
- func (p *Point) Randomized(amount float64) *Point
- func (p *Point) RandomizedX(amount float64) *Point
- func (p *Point) RandomizedY(amount float64) *Point
- func (p *Point) RandomizedZ(amount float64) *Point
- func (p *Point) Rotate(rx, ry, rz float64)
- func (p *Point) RotateX(angle float64)
- func (p *Point) RotateY(angle float64)
- func (p *Point) RotateZ(angle float64)
- func (p *Point) Rotated(rx, ry, rz float64) *Point
- func (p *Point) RotatedX(angle float64) *Point
- func (p *Point) RotatedY(angle float64) *Point
- func (p *Point) RotatedZ(angle float64) *Point
- func (p *Point) Scale(sx, sy, sz float64)
- func (p *Point) ScaleX(scale float64)
- func (p *Point) ScaleY(scale float64)
- func (p *Point) ScaleZ(scale float64)
- func (p *Point) Scaled(sx, sy, sz float64) *Point
- func (p *Point) ScaledX(scale float64) *Point
- func (p *Point) ScaledY(scale float64) *Point
- func (p *Point) ScaledZ(scale float64) *Point
- func (p *Point) Translate(tx, ty, tz float64)
- func (p *Point) TranslateX(tx float64)
- func (p *Point) TranslateY(ty float64)
- func (p *Point) TranslateZ(tz float64)
- func (p *Point) Translated(tx, ty, tz float64) *Point
- func (p *Point) TranslatedX(tx float64) *Point
- func (p *Point) TranslatedY(ty float64) *Point
- func (p *Point) TranslatedZ(tz float64) *Point
- func (p *Point) UniScale(scale float64)
- func (p *Point) UniScaled(scale float64) *Point
- func (p *Point) Visible() bool
- type PointList
- func (p *PointList) Add(point *Point)
- func (p *PointList) AddRandomPointInBox(w, h, d float64)
- func (p *PointList) AddRandomPointInCylinder(height, radius float64)
- func (p *PointList) AddRandomPointInSphere(radius float64)
- func (p *PointList) AddRandomPointInTorus(radius1, radius2 float64)
- func (p *PointList) AddRandomPointOnBox(w, h, d float64)
- func (p *PointList) AddRandomPointOnCylinder(height, radius float64, includeCaps bool)
- func (p *PointList) AddRandomPointOnSphere(radius float64)
- func (p *PointList) AddRandomPointOnTorus(radius1, radius2 float64)
- func (p *PointList) AddXYZ(x, y, z float64)
- func (p PointList) Center()
- func (p PointList) Clone() PointList
- func (p *PointList) Cull(cullFunc func(*Point) bool)
- func (p *PointList) CullBox(minX, minY, minZ, maxX, maxY, maxZ float64)
- func (p PointList) Culled(cullFunc func(*Point) bool) PointList
- func (p PointList) First() *Point
- func (p PointList) Get(index int) *Point
- func (p PointList) GetSize() (float64, float64, float64)
- func (p PointList) Last() *Point
- func (p PointList) Lerp(t float64, other PointList)
- func (p PointList) Noisify(origin *Point, scale, offset float64)
- func (p PointList) Normalize()
- func (p PointList) Normalized() PointList
- func (p PointList) Project()
- func (p PointList) Push(pusher *Point, radius float64)
- func (p PointList) Randomize(amount float64)
- func (p PointList) RandomizeX(amount float64)
- func (p PointList) RandomizeY(amount float64)
- func (p PointList) RandomizeZ(amount float64)
- func (p PointList) Randomized(amount float64) PointList
- func (p PointList) RandomizedX(amount float64) PointList
- func (p PointList) RandomizedY(amount float64) PointList
- func (p PointList) RandomizedZ(amount float64) PointList
- func (p PointList) RenderPoints(radius float64)
- func (p PointList) Rotate(rx, ry, rz float64)
- func (p PointList) RotateX(angle float64)
- func (p PointList) RotateY(angle float64)
- func (p PointList) RotateZ(angle float64)
- func (p PointList) Rotated(rx, ry, rz float64) PointList
- func (p PointList) RotatedX(angle float64) PointList
- func (p PointList) RotatedY(angle float64) PointList
- func (p PointList) RotatedZ(angle float64) PointList
- func (p PointList) Scale(sx, sy, sz float64)
- func (p PointList) ScaleX(scale float64)
- func (p PointList) ScaleY(scale float64)
- func (p PointList) ScaleZ(scale float64)
- func (p PointList) Scaled(sx, sy, sz float64) PointList
- func (p PointList) ScaledX(scale float64) PointList
- func (p PointList) ScaledY(scale float64) PointList
- func (p PointList) ScaledZ(scale float64) PointList
- func (p *PointList) SortX(ascending bool)
- func (p *PointList) SortY(ascending bool)
- func (p *PointList) SortZ(ascending bool)
- func (p PointList) Translate(tx, ty, tz float64)
- func (p PointList) TranslateX(tx float64)
- func (p PointList) TranslateY(ty float64)
- func (p PointList) TranslateZ(tz float64)
- func (p PointList) Translated(tx, ty, tz float64) PointList
- func (p *PointList) TranslatedX(tx float64) PointList
- func (p *PointList) TranslatedY(ty float64) PointList
- func (p *PointList) TranslatedZ(tz float64) PointList
- func (p PointList) TwistX(angle float64)
- func (p PointList) TwistY(angle float64)
- func (p PointList) TwistZ(angle float64)
- func (p PointList) UniScale(scale float64)
- func (p PointList) UniScaled(scale float64) PointList
- func (p PointList) WrapCylinderWithArc(arc float64)
- func (p PointList) WrapCylinderWithRadius(radius float64)
- func (p PointList) WrapCylinderWithRadiusAndArc(radius, arc float64)
- type Segment
- type Shape
- func Box(w, h, d float64) *Shape
- func Circle(radius float64, res int) *Shape
- func Cone(height, radius0, radius1 float64, slices, res int, showSlices, showLong bool) *Shape
- func Cube(size float64) *Shape
- func Cylinder(height, radius float64, slices, res int, showSlices, showLong bool) *Shape
- func Dodecahedron(size float64) *Shape
- func GridBox(w, h, d float64, xCount, yCount, zCount int, inner bool) *Shape
- func GridPlane(w, d float64, rows, cols int) *Shape
- func Icosahedron(size float64) *Shape
- func LoadShape(fileName string) (*Shape, error)
- func NewShape() *Shape
- func Octahedron(size float64) *Shape
- func ParseChar(char string, fontData FontType) *Shape
- func Pyramid(height, baseRadius float64, sides int) *Shape
- func RandomInnerBox(w, h, d float64, count int) *Shape
- func RandomInnerCylinder(height, radius float64, count int) *Shape
- func RandomInnerSphere(radius float64, count int) *Shape
- func RandomInnerTorus(radius1, radius2, arc float64, count int) *Shape
- func RandomSurfaceBox(w, h, d float64, count int) *Shape
- func RandomSurfaceCylinder(height, radius float64, count int, includeCaps bool) *Shape
- func RandomSurfaceSphere(radius float64, count int) *Shape
- func RandomSurfaceTorus(radius1, radius2, arc float64, count int) *Shape
- func ShapeFrom2dPath(path geom.PointList, closed bool) *Shape
- func ShapeFromLure(lure Lure3d, count int) *Shape
- func ShapeFromXYZ(fileName string) *Shape
- func Sphere(radius float64, long, lat int, showLong, showLat bool) *Shape
- func Spring(height, r0, r1, turns, res float64) *Shape
- func Tetrahedron(size float64) *Shape
- func Torus(r1, r2, arc float64, slices, res int, showSlices, showLong bool) *Shape
- func TorusKnot(p, q, r1, r2, res float64) *Shape
- func (s *Shape) AddPoint(point *Point)
- func (s *Shape) AddRandomPointInBox(w, h, d float64)
- func (s *Shape) AddRandomPointInCylinder(height, radius float64)
- func (s *Shape) AddRandomPointInSphere(radius float64)
- func (s *Shape) AddRandomPointInTorus(radius1, radius2, arc float64)
- func (s *Shape) AddRandomPointOnBox(w, h, d float64)
- func (s *Shape) AddRandomPointOnCylinder(height, radius float64, includeCaps bool)
- func (s *Shape) AddRandomPointOnSphere(radius float64)
- func (s *Shape) AddRandomPointOnTorus(radius1, radius2, arc float64)
- func (s *Shape) AddSegment(seg *Segment)
- func (s *Shape) AddSegmentByIndex(a, b int)
- func (s *Shape) AddSegmentByPoints(a, b *Point)
- func (s *Shape) AddShape(shape *Shape)
- func (s *Shape) AddXYZ(x, y, z float64)
- func (s *Shape) Center()
- func (s *Shape) Clone() *Shape
- func (s *Shape) ConvexHull3d(dy float64) *Shape
- func (s *Shape) Cull(cullFunc func(*Point) bool)
- func (s *Shape) CullBox(minX, minY, minZ, maxX, maxY, maxZ float64)
- func (s *Shape) Culled(cullFunc func(*Point) bool) *Shape
- func (s *Shape) GetSize() (float64, float64, float64)
- func (s *Shape) Randomize(amount float64)
- func (s *Shape) RandomizeX(amount float64)
- func (s *Shape) RandomizeY(amount float64)
- func (s *Shape) RandomizeZ(amount float64)
- func (s *Shape) Randomized(amount float64) *Shape
- func (s *Shape) RandomizedX(amount float64) *Shape
- func (s *Shape) RandomizedY(amount float64) *Shape
- func (s *Shape) RandomizedZ(amount float64) *Shape
- func (s *Shape) RemoveSegment(seg *Segment)
- func (s *Shape) RenderPoints(radius float64)
- func (s *Shape) Rotate(rx, ry, rz float64)
- func (s *Shape) RotateX(angle float64)
- func (s *Shape) RotateY(angle float64)
- func (s *Shape) RotateZ(angle float64)
- func (s *Shape) Rotated(rx, ry, rz float64) *Shape
- func (s *Shape) RotatedX(angle float64) *Shape
- func (s *Shape) RotatedY(angle float64) *Shape
- func (s *Shape) RotatedZ(angle float64) *Shape
- func (s *Shape) Save(fileName string)
- func (s *Shape) Scale(sx, sy, sz float64)
- func (s *Shape) ScaleX(scale float64)
- func (s *Shape) ScaleY(scale float64)
- func (s *Shape) ScaleZ(scale float64)
- func (s *Shape) Scaled(sx, sy, sz float64) *Shape
- func (s *Shape) ScaledX(scale float64) *Shape
- func (s *Shape) ScaledY(scale float64) *Shape
- func (s *Shape) ScaledZ(scale float64) *Shape
- func (s *Shape) Split(split func(p *Point) bool) *Shape
- func (s *Shape) Stroke(width float64)
- func (s *Shape) Subdivide(maxDist float64)
- func (s *Shape) ThinPoints(take, skip int)
- func (s *Shape) Translate(tx, ty, tz float64)
- func (s *Shape) TranslateX(tx float64)
- func (s *Shape) TranslateY(ty float64)
- func (s *Shape) TranslateZ(tz float64)
- func (s *Shape) Translated(tx, ty, tz float64) *Shape
- func (s *Shape) TranslatedX(tx float64) *Shape
- func (s *Shape) TranslatedY(ty float64) *Shape
- func (s *Shape) TranslatedZ(tz float64) *Shape
- func (s *Shape) TwistX(amt float64)
- func (s *Shape) TwistY(amt float64)
- func (s *Shape) TwistZ(amt float64)
- func (s *Shape) UniScale(scale float64)
- func (s *Shape) UniScaled(scale float64) *Shape
- func (s *Shape) WrapCylinderWithArc(arc float64)
- func (s *Shape) WrapCylinderWithRadius(radius float64)
- func (s *Shape) WrapCylinderWithRadiusAndArc(radius, arc float64)
- type String
Constants ¶
This section is empty.
Variables ¶
var FontArcade = FontType{ // contains filtered or unexported fields }
FontArcade is the path data for this font. adapted from https://github.com/coolbutuseless/arcadefont/blob/master/data-raw/create-arcade-font.R with some changes.
var FontAsteroid = FontType{ // contains filtered or unexported fields }
FontAsteroid is the path data for this font. adapted from https://github.com/osresearch/vst/blob/master/teensyv/asteroids_font.c with some changes.
Functions ¶
func ApplyFogAndWaterLevel ¶
func ApplyFogAndWaterLevel(objectY, objectZ float64)
ApplyFogAndWaterLevel sets the color to simulate an object receding into fog, or being in water, or both.
func CirclePath ¶
CirclePath creates a single path defining a circle.
func LabelPoints ¶
func LabelPoints(b bool)
LabelPoints will render the index of each point - usually for debugging purposes.
func SetClipping ¶
func SetClipping(near, far float64)
SetClipping sets the near and far limits of rendering.
func SetFont ¶
SetFont sets the font type, size and spacing for future text objects. Size is the width of a single letter. Default 100. Spacing is the space between letters, as a percentage of letter width. Defaults to 0.2.
func SetFontSize ¶
func SetFontSize(size float64)
SetFontSize sets the font size (width of one letter) used for future text objects. Default is 100.
func SetFontSpacing ¶
func SetFontSpacing(spacing float64)
SetFontSpacing sets the spacing between letters, as a percentage of letter width. Default is 0.2.
func SetFontType ¶
func SetFontType(font FontType)
SetFontType sets which font type will be used for future text objects. Default is wire.FontAsteroid.
func SetPerspective ¶
func SetPerspective(fl float64)
SetPerspective sets the amount of perspective to apply.
func SetWaterLevel ¶
SetWaterLevel sets the water level parameters, including turning on and off. This is the same as fog but applied to the y axis.
Types ¶
type Context ¶
type Context interface { StrokePath(geom.PointList, bool) FillCircle(float64, float64, float64) MoveTo(float64, float64) LineTo(float64, float64) Stroke() ClosePath() SetLineWidth(float64) GetLineWidth() float64 Save() Restore() SetSourceColor(blcolor.Color) GetSourceRGB() (float64, float64, float64) FillTextAny(text any, x, y float64) }
Context interface to allow for drawing functions. The interface defines only the used methods of cairo.Context. This is needed to avoid recursive dependencies between wire and cairo.
type FontType ¶
type FontType = struct {
// contains filtered or unexported fields
}
FontType is a struct holding the font data.
type Lure3d ¶
type Lure3d interface { GetScale() float64 InitVals3d() (float64, float64, float64) Center3d() (float64, float64, float64) Iterate(x, y, z float64) (float64, float64, float64) }
Lure3d is an interface for a 3d attractor. Included here to decouple the concrete lures library and avoid a direct dependecy.
type Point ¶
Point is a 3d point.
func RandomPointInBox ¶
RandomPointInBox creates a new 3d point within a 3d box of the given dimensions. The box is centered on the origin, so points will range from -w/2 to w/2, etc. on each dimension.
func RandomPointInCircle ¶
RandomPointInCircle returns a random 3d point in a circle. The y-coordinate will be 0.
func RandomPointInCylinder ¶
RandomPointInCylinder creates a random 3d point IN a cylinder of the given radius and height.
func RandomPointInRectangle ¶
RandomPointInRectangle returns a random 3d point in a rectangle. The rectangle will be centered at the origin, with the y-coordinate at 0.
func RandomPointInSphere ¶
RandomPointInSphere creates a random 3d point IN a sphere of the given radius. https://mathworld.wolfram.com/SpherePointPicking.html Main change from the on-surface version is radius is randomized. It uses a distribution of 1/3 which evenly distributes the points throughout the sphere.
func RandomPointInSphereDist ¶
RandomPointInSphereDist creates a random 3d point IN a sphere of the given radius. https://mathworld.wolfram.com/SpherePointPicking.html The dist value lets you adjust the distribution of points. A value of 3 will result in a completely even distribution of points throughout the sphere. Lower values will concentrate points in the center of the sphere and higher values will send them to the edges.
func RandomPointInTorus ¶
RandomPointInTorus creates a random 3d point IN a torus. radius1 is from the center of the torus to the center of the circle forming the torus. radius2 is the radius of the circle forming the torus.
func RandomPointOnBox ¶
RandomPointOnBox creates a new random point on the surface of a box.
func RandomPointOnCylinder ¶
RandomPointOnCylinder creates a random 3d point ON a cylinder of the given radius and height. Can optionally include the caps on not.
func RandomPointOnSphere ¶
RandomPointOnSphere creates a random 3d point ON a sphere of the given radius. https://mathworld.wolfram.com/SpherePointPicking.html
func RandomPointOnTorus ¶
RandomPointOnTorus creates a random 3d point ON a torus. radius1 is from the center of the torus to the center of the circle forming the torus. radius2 is the radius of the circle forming the torus.
func (*Point) Normalize ¶
func (p *Point) Normalize()
Normalize normalizes each component ofthis point, in place.
func (*Point) Normalized ¶
Normalized returns a copy of this point, normalized.
func (*Point) Project ¶
func (p *Point) Project()
Project projects this 3d point to a 2d point, by setting the Px, Py and Scaling properties of this point.
func (*Point) RandomizeX ¶
RandomizeX randomizes this point on the x-axis, in place.
func (*Point) RandomizeY ¶
RandomizeY randomizes this point on the y-axis, in place.
func (*Point) RandomizeZ ¶
RandomizeZ randomizes this point on the z-axis, in place.
func (*Point) Randomized ¶
Randomized returns a copy of this point, randomized on all axes.
func (*Point) RandomizedX ¶
RandomizedX returns a copy of this point, randomized on the x-axis.
func (*Point) RandomizedY ¶
RandomizedY returns a copy of this point, randomized on the y-axis.
func (*Point) RandomizedZ ¶
RandomizedZ returns a copy of this point, randomized on the z-axis.
func (*Point) TranslateX ¶
TranslateX translates this point on the x-axis, in place.
func (*Point) TranslateY ¶
TranslateY translates this point on the y-axis, in place.
func (*Point) TranslateZ ¶
TranslateZ translates this point on the z-axis, in place.
func (*Point) Translated ¶
Translated returns a copy of this point, translated on all axes.
func (*Point) TranslatedX ¶
TranslatedX returns a copy of this point, translated on the x-axis.
func (*Point) TranslatedY ¶
TranslatedY returns a copy of this point, translated on the y-axis.
func (*Point) TranslatedZ ¶
TranslatedZ returns a copy of this point, translated on the z-axis.
type PointList ¶
type PointList []*Point
PointList represents a list of 3d points.
func (*PointList) AddRandomPointInBox ¶
AddRandomPointInBox creates and adds a new 3d point within a 3d box of the given dimensions. The box is centered on the origin, so points will range from -w/2 to w/2, etc. on each dimension.
func (*PointList) AddRandomPointInCylinder ¶
AddRandomPointInCylinder creates and adds a random 3d point IN a cylinder of the given radius and height.
func (*PointList) AddRandomPointInSphere ¶
AddRandomPointInSphere creates and adds a random 3d point IN a sphere of the given radius.
func (*PointList) AddRandomPointInTorus ¶
AddRandomPointInTorus creates and adds a random 3d point IN a torus. radius1 is from the center of the torus to the center of the circle forming the torus. radius2 is the radius of the circle forming the torus.
func (*PointList) AddRandomPointOnBox ¶
AddRandomPointOnBox creates and adds a new 3d point on the surface of a 3d box of the given dimensions. The box is centered on the origin, so points will range from -w/2 to w/2, etc. on each dimension.
func (*PointList) AddRandomPointOnCylinder ¶
AddRandomPointOnCylinder creates and adds a random 3d point ON a cylinder of the given radius and height.
func (*PointList) AddRandomPointOnSphere ¶
AddRandomPointOnSphere creates and adds a random 3d point ON a sphere of the given radius.
func (*PointList) AddRandomPointOnTorus ¶
AddRandomPointOnTorus creates and adds a random 3d point ON a torus. radius1 is from the center of the torus to the center of the circle forming the torus. radius2 is the radius of the circle forming the torus.
func (*PointList) Cull ¶
Cull removes points from the list that do not satisfy the cull function. Modifies list in place.
func (*PointList) CullBox ¶
CullBox removes points that ar not within the defined box. Modifies the shape in place.
func (PointList) Culled ¶
Culled returns a new point list with points removed that do not satisfy the cull function.
func (PointList) Get ¶
Get returns the point at the given index. Negative indexes go in reverse from end.
func (PointList) Lerp ¶
Lerp interpolates thispoint list towards another, in place. Thus, it should maintain segment relationships.
func (PointList) Normalize ¶
func (p PointList) Normalize()
Normalize normalizes all the points in this list.
func (PointList) Normalized ¶
Normalized returns a copy of this list, normalized.
func (PointList) Project ¶
func (p PointList) Project()
Project projects this 3d point list to a 2d point list. This returns a list of 2d points as well as a list of scale values for each point.
func (PointList) Randomize ¶
Randomize randomizes each point in this pointlist on all axes, in place.
func (PointList) RandomizeX ¶
RandomizeX randomizes each point in this pointlist on the x-axis, in place.
func (PointList) RandomizeY ¶
RandomizeY randomizes each point in this pointlist on the y-axis, in place.
func (PointList) RandomizeZ ¶
RandomizeZ randomizes each point in this pointlist on the z-axis, in place.
func (PointList) Randomized ¶
Randomized returns a copy of this pointlist, randomized on all axes.
func (PointList) RandomizedX ¶
RandomizedX returns a copy of this pointlist, randomized on the x-axis
func (PointList) RandomizedY ¶
RandomizedY returns a copy of this pointlist, randomized on the y-axis
func (PointList) RandomizedZ ¶
RandomizedZ returns a copy of this pointlist, randomized on the z-axis
func (PointList) RenderPoints ¶
RenderPoints projects and draws a circle for each point in the list.
func (PointList) RotateX ¶
RotateX rotates each point in this pointlist around the x-axis, in place.
func (PointList) RotateY ¶
RotateY rotates each point in this pointlist around the y-axis, in place.
func (PointList) RotateZ ¶
RotateZ rotates each point in this pointlist around the z-axis, in place.
func (PointList) Translate ¶
Translate translates each point in this pointlist on all axes, in place.
func (PointList) TranslateX ¶
TranslateX translates each point in this pointlist on the x-axis, in place.
func (PointList) TranslateY ¶
TranslateY translates each point in this pointlist on the y-axis, in place.
func (PointList) TranslateZ ¶
TranslateZ translates each point in this pointlist on the z-axis, in place.
func (PointList) Translated ¶
Translated returns a copy of this pointlist, translated on all axes.
func (*PointList) TranslatedX ¶
TranslatedX returns a copy of this pointlist, translated on the x-axis.
func (*PointList) TranslatedY ¶
TranslatedY returns a copy of this pointlist, translated on the y-axis.
func (*PointList) TranslatedZ ¶
TranslatedZ returns a copy of this pointlist, translated on the z-axis.
func (PointList) UniScale ¶
UniScale scales each point in this pointlist by the same amount on each axis, in place.
func (PointList) UniScaled ¶
UniScaled returns a copy of this pointlist, scaled by the same amount on each axis.
func (PointList) WrapCylinderWithArc ¶
WrapCylinderWithArc wraps the x-axis of a point list around an imaginary cylinder laying along the z-axis. The point list will retain its relative width, measured along the curve. The radius of the cylinder will be dynamically computed.
func (PointList) WrapCylinderWithRadius ¶
WrapCylinderWithRadius wraps the x-axis of a point list around an imaginary cylinder laying along the z-axis. The point list will retain its relative width, measured along the curve. The resulting arc the points cover will be dynamically computed.
func (PointList) WrapCylinderWithRadiusAndArc ¶
WrapCylinderWithRadiusAndArc wraps the x-axis of a point list around an imaginary cylinder laying along the z-axis. The point list will be stretched or compressed to fit in the given arc and radius.
type Segment ¶
type Segment struct {
PointA, PointB *Point
}
Segment represents a line segment between two points.
func NewSegment ¶
NewSegment creates a new segment from two points.
type Shape ¶
Shape is a 3d shape composed of a list of points and segments connecting them.
func Dodecahedron ¶
Dodecahedron creates a dodecahedron shape.
func GridBox ¶
GridBox creates a 3d box shape where each surface is a grid. If inner is true, it will create a full lattice.
func ParseChar ¶
ParseChar parses a single character into a single 3d shape. The font data is initially sized from -1 to +1 on the x-axis. Height will depend on the font. Each character is scaled to 100 units wide on creation (-50 to +50). The string shape can be scaled further later.
func RandomInnerBox ¶
RandomInnerBox creates a 3d box filled with random points.
func RandomInnerCylinder ¶
RandomInnerCylinder creates a 3d cylinder made of random point inside the cylinder.
func RandomInnerSphere ¶
RandomInnerSphere creates a 3d sphere made of random points inside the sphere.
func RandomInnerTorus ¶
RandomInnerTorus creates a 3d torus made of random point inside the torus.
func RandomSurfaceBox ¶
RandomSurfaceBox creates a 3d box made of random points on the surface of the box.
func RandomSurfaceCylinder ¶
RandomSurfaceCylinder creates a 3d cylinder made of random point on the surface of the cylinder.
func RandomSurfaceSphere ¶
RandomSurfaceSphere creates a 3d sphere made of random points on the surface of the sphere.
func RandomSurfaceTorus ¶
RandomSurfaceTorus creates a 3d torus made of random point on the surface of the torus.
func ShapeFrom2dPath ¶
ShapeFrom2dPath creates a shape from a geom.PointList.
func ShapeFromLure ¶
ShapeFromLure creates a shape filled with points forming a strange attractor.
func ShapeFromXYZ ¶
ShapeFromXYZ creates a new point-only shape from an .xyz formatted point cloud file.
func Sphere ¶
Sphere creates a 3d sphere of regular points that can be connected longitudinally, lattitudally, or both.
func TorusKnot ¶
TorusKnot creates a 3d torus knot shape made of one long path that wraps around the torus.
func (*Shape) AddRandomPointInBox ¶
AddRandomPointInBox creates and adds a new 3d point within a 3d box of the given dimensions. The box is centered on the origin, so points will range from -w/2 to w/2, etc. on each dimension.
func (*Shape) AddRandomPointInCylinder ¶
AddRandomPointInCylinder creates and adds a random 3d point IN a cylinder of the given radius and height.
func (*Shape) AddRandomPointInSphere ¶
AddRandomPointInSphere creates and adds a random 3d point IN a sphere of the given radius.
func (*Shape) AddRandomPointInTorus ¶
AddRandomPointInTorus creates and adds a random 3d point IN a torus. radius1 is from the center of the torus to the center of the circle forming the torus. radius2 is the radius of the circle forming the torus.
func (*Shape) AddRandomPointOnBox ¶
AddRandomPointOnBox creates and adds a new 3d point on the surface of a 3d box of the given dimensions. The box is centered on the origin, so points will range from -w/2 to w/2, etc. on each dimension.
func (*Shape) AddRandomPointOnCylinder ¶
AddRandomPointOnCylinder creates and adds a random 3d point ON a cylinder of the given radius and height.
func (*Shape) AddRandomPointOnSphere ¶
AddRandomPointOnSphere creates and adds a random 3d point ON a sphere of the given radius.
func (*Shape) AddRandomPointOnTorus ¶
AddRandomPointOnTorus creates and adds a random 3d point ON a torus. radius1 is from the center of the torus to the center of the circle forming the torus. radius2 is the radius of the circle forming the torus.
func (*Shape) AddSegmentByIndex ¶
AddSegmentByIndex adds a new segment based on the indexes of the two points passed.
func (*Shape) AddSegmentByPoints ¶
AddSegmentByPoints adds a new segment based on the two points passed.
func (*Shape) AddShape ¶
AddShape adds the points and segments of another shape to this shape. Does not clone the original shape, so transforms to this shape will affect the added shape as well.
func (*Shape) ConvexHull3d ¶
ConvexHull3d returns a new shape consisting of a stack of convex hulls oriented along the y axis. dy determines the distance on the y access between each slice.
func (*Shape) Cull ¶
Cull removes points from the shape that do not satisfy the cull function. Modifies shape in place.
func (*Shape) CullBox ¶
CullBox removes points that ar not within the defined box. Modifies the shape in place. TODO: cull segments not just points
func (*Shape) Culled ¶
Culled returns a new shape with points removed that do not satisfy the cull function.
func (*Shape) RandomizeX ¶
RandomizeX randomizes this shape on the x-axis, in place.
func (*Shape) RandomizeY ¶
RandomizeY randomizes this shape on the y-axis, in place.
func (*Shape) RandomizeZ ¶
RandomizeZ randmizes this shape on the z-axis, in place.
func (*Shape) Randomized ¶
Randomized returns a copy of this shape, randomized on all axes.
func (*Shape) RandomizedX ¶
RandomizedX returns a copy of this shape, randomized on the x-axis.
func (*Shape) RandomizedY ¶
RandomizedY returns a copy of this shape, randomized on the y-axis.
func (*Shape) RandomizedZ ¶
RandomizedZ returns a copy of this shape, randomized on the z-axis.
func (*Shape) RemoveSegment ¶
RemoveSegment removes the given segment from the shape's segment list.
func (*Shape) RenderPoints ¶
RenderPoints draws a filled circle for each point in the path.
func (*Shape) Split ¶
Split culls points that satisfy the split function, then adds those points to a new shape and returns that. TODO: handle segments
func (*Shape) ThinPoints ¶
ThinPoints is used to thin out a dense model. It will keep `take` number of points, and then discard `skip` number of points, repeating until all points are processed. To thin by 25% use ThinPoints(3, 1). To thin by 75%, ThinPoints(1, 3). TODO: remove invalidated segments.
func (*Shape) TranslateX ¶
TranslateX translates this shape on the x-axis, in place.
func (*Shape) TranslateY ¶
TranslateY translates this shape on the y-axis, in place.
func (*Shape) TranslateZ ¶
TranslateZ translates this shape on the z-axis, in place.
func (*Shape) Translated ¶
Translated returns a copy of this shape, translated on all axes.
func (*Shape) TranslatedX ¶
TranslatedX returns a copy of this shape, translated on the x-axis.
func (*Shape) TranslatedY ¶
TranslatedY returns a copy of this shape, translated on the y-axis.
func (*Shape) TranslatedZ ¶
TranslatedZ returns a copy of this shape, translated on the z-axis.
func (*Shape) UniScaled ¶
UniScaled returns a copy of this shape, scaled by the same amount on each axis.
func (*Shape) WrapCylinderWithArc ¶
WrapCylinderWithArc wraps the x-axis of a shape around an imaginary cylinder laying along the z-axis. The shape will retain its relative width, measured along the curve. The radius of the cylindar will be dynamically computed.
func (*Shape) WrapCylinderWithRadius ¶
WrapCylinderWithRadius wraps the x-axis of a shape around an imaginary cylinder laying along the z-axis. The shape will retain its relative width, measured along the curve. The resulting arc the shape covers will be dynamically computed.
func (*Shape) WrapCylinderWithRadiusAndArc ¶
WrapCylinderWithRadiusAndArc wraps the x-axis of a shape around an imaginary cylinder laying along the z-axis. The shape will be stretched or compressed to fit in the given arc and radius.
type String ¶
String represents a 3d character string. Initially this only holds a list of shapes, each on representing one letter in the string. Calling one of the `As...` methods returns a single unified shape object.
func (*String) AsCylinder ¶
AsCylinder creates a single shape consisting of the all the chars in the string wrapped around a cylinder.
func (*String) AsLine ¶
AsLine creates a single shape consisting of all the chars in the string laid out in a single horizontal line.
func (*String) AsVCylinder ¶
AsVCylinder creates a single shape consisting of the all the chars in the string layed out vertically and wrapped around a cylinder.