vshape

package
v1.0.34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2023 License: BSD-3-Clause Imports: 5 Imported by: 2

README

vshape: Compositional 3D shape library

vshape provides a library of 3D shapes, built from indexed triangle meshes, which can be added together in ShapeGroup lists. Each Shape can report the number of points and indexes based on configured parameters, and keeps track of its offset within an overall mat32.ArrayF32 allocated based on total numbers. In this way, separate Allocate then Configure phases are supported, as required by the vgpu Memory allocation system.

It only has a dependency on the mat32 package and could be used for anything.

Basic building blocks (e.g., Plane, SphereSector) have standalone methods, in addition to Shape elements.

Here are the shapes:

  • Plane
  • Box
  • Sphere (including various partial segments thereof)
  • Cylinder, Cone (including different size top and bottom radii, e.g., Cones)
  • Capsule: a cylinder with half-sphere caps -- good for simple body segments

Documentation

Overview

vshape provides a library of 3D shapes, built from indexed triangle meshes, which can be added together in `ShapeGroup` lists. Each `Shape` can report the number of points and indexes based on configured parameters, and keeps track of its offset within an overall `mat32.ArrayF32` allocated based on total numbers. In this way, separate Allocate then Configure phases are supported, as required by the vgpu Memory allocation system.

Basic building blocks (e.g., Plane, SphereSector) have standalone methods, in addition to Shape elements.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BBoxFromVtxs added in v1.0.0

func BBoxFromVtxs(vtxAry mat32.ArrayF32, vtxOff int, nvtxs int) mat32.Box3

BBoxFromVtxs returns the bounding box updated from the range of vertex points

func BoxN

func BoxN(segs mat32.Vec3i) (nVtx, nIdx int)

PlaneN returns the N's for a single plane's worth of vertex and index data with given number of segments. Note: In *vertex* units, not float units (i.e., x3 to get actual float offset in Vtx array).

func CylinderSectorN

func CylinderSectorN(radialSegs, heightSegs int, top, bottom bool) (nVtx, nIdx int)

CylinderSectorN returns the N's for the cylinder (truncated cone) sector vertex and index data with given parameters

func DiskSectorN

func DiskSectorN(segs int) (nVtx, nIdx int)

DiskSectorN returns the N's for a disk sector's vertex and index data with given number of segments. Note: In *vertex* units, not float units (i.e., x3 to get actual float offset in Vtx array).

func LinesN added in v1.0.0

func LinesN(npoints int, closed bool) (nVtx, nIdx int)

LinesN returns number of vertex and idx points

func MiterPts added in v1.0.0

func MiterPts(ax, ay, bx, by, cx, cy, w2 float32) mat32.Vec2

MiterPts returns the miter points

func PlaneN

func PlaneN(wsegs, hsegs int) (nVtx, nIdx int)

PlaneN returns the N's for a single plane's worth of vertex and index data with given number of segments. Note: In *vertex* units, not float units (i.e., x3 to get actual float offset in Vtx array). nVtx = (wsegs + 1) * (hsegs + 1) nIdx = wsegs * hsegs * 6

func QuadN added in v1.0.0

func QuadN() (nVtx, nIdx int)

QuadN returns 4, 6

func SetBox

func SetBox(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32, vtxOff, idxOff int, size mat32.Vec3, segs mat32.Vec3i, pos mat32.Vec3) mat32.Vec3

SetBox sets box vertex, norm, tex, index data at given starting *vertex* index (i.e., multiply this *3 to get actual float offset in Vtx array), and starting Idx index. for given 3D size, and given number of segments per side. finely subdividing a plane allows for higher-quality lighting and texture rendering (minimum of 1 will be enforced). pos is a 3D position offset. returns 3D size of plane.

func SetColor added in v1.0.0

func SetColor(clrAry mat32.ArrayF32, vtxOff int, nvtxs int, clr mat32.Vec4)

SetColor sets color for given range of vertex indexes

func SetCone

func SetCone(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32, vtxOff, idxOff int, height, radius float32, radialSegs, heightSegs int, bottom bool, pos mat32.Vec3) mat32.Box3

SetCone creates a cone mesh with the specified base radius, height, vertex, norm, tex, index data at given starting *vertex* index (i.e., multiply this *3 to get actual float offset in Vtx array), number of radial segments, number of height segments, and presence of a bottom cap. Height is along the Y axis. pos is an arbitrary offset (for composing shapes).

func SetCylinderSector

func SetCylinderSector(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32, vtxOff, idxOff int, height, topRad, botRad float32, radialSegs, heightSegs int, angStart, angLen float32, top, bottom bool, pos mat32.Vec3) mat32.Box3

SetCylinderSector creates a generalized cylinder (truncated cone) sector vertex, norm, tex, index data at given starting *vertex* index (i.e., multiply this *3 to get actual float offset in Vtx array), with the specified top and bottom radii, height, number of radial segments, number of height segments, sector start angle in degrees (start = -1,0,0) sector size angle in degrees, and presence of a top and/or bottom cap. Height is along the Y axis. pos is an arbitrary offset (for composing shapes).

func SetDiskSector

func SetDiskSector(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32, vtxOff, idxOff int, radius float32, segs int, angStart, angLen float32, pos mat32.Vec3) mat32.Box3

SetDiskSector sets a disk sector vertex, norm, tex, index data at given starting *vertex* index (i.e., multiply this *3 to get actual float offset in Vtx array), and starting Idx index, with the specified radius, number of radial segments (minimum 3), sector start angle and angle length in degrees. The center of the disk is at the origin, and angle runs counter-clockwise on the XY plane, starting at (x,y,z)=(1,0,0). pos is an arbitrary offset (for composing shapes), returns bounding box.

func SetLines added in v1.0.0

func SetLines(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32, vtxOff, idxOff int, points []mat32.Vec3, width mat32.Vec2, closed bool, pos mat32.Vec3) mat32.Box3

SetLines sets lines rendered as long thin boxes defined by points and width parameters. The Mesh must be drawn in the XY plane (i.e., use Z = 0 or a constant unless specifically relevant to have full 3D variation). Rotate to put into other planes.

func SetPlane

func SetPlane(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32, vtxOff, idxOff int, waxis, haxis mat32.Dims, wdir, hdir int, width, height, woff, hoff, zoff float32, wsegs, hsegs int, pos mat32.Vec3)

SetPlane sets plane vertex, norm, tex, index data at given starting *vertex* index (i.e., multiply this *3 to get actual float offset in Vtx array), and starting Idx index. waxis, haxis = width, height axis, wdir, hdir are the directions for width and height dimensions. wsegs, hsegs = number of segments to create in each dimension -- more finely subdividing a plane allows for higher-quality lighting and texture rendering (minimum of 1 will be enforced). offset is the distance to place the plane along the orthogonal axis. pos is a 3D position offset.

func SetPlaneAxisSize

func SetPlaneAxisSize(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32, vtxOff, idxOff int, normAxis mat32.Dims, normNeg bool, size mat32.Vec2, segs mat32.Vec2i, offset float32, pos mat32.Vec3) mat32.Vec3

SetPlaneAxisSize sets plane vertex, norm, tex, index data at given starting *vertex* index (i.e., multiply this *3 to get actual float offset in Vtx array), and starting Idx index. using Norm Axis, offset, and size params. wsegs, hsegs = number of segments to create in each dimension -- more finely subdividing a plane allows for higher-quality lighting and texture rendering (minimum of 1 will be enforced). offset is the distance to place the plane along the orthogonal axis. pos is a 3D position offset. returns 3D size of plane. returns bounding box.

func SetQuad added in v1.0.0

func SetQuad(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32, vtxOff, idxOff int, vtxs []mat32.Vec3, texs []mat32.Vec2, pos mat32.Vec3) mat32.Box3

SetQuad sets quad vertex data (optionally texUV, color, and indexes) at given starting *vertex* index (i.e., multiply this *3 to get actual float offset in Vtx array), and starting Idx index. Norm is auto-computed, and bbox expanded by points. pos is a 3D position offset. returns 3D size of plane. returns bounding box.

func SetSphereSector

func SetSphereSector(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32, vtxOff, idxOff int, radius float32, widthSegs, heightSegs int, angStart, angLen, elevStart, elevLen float32, pos mat32.Vec3) mat32.Box3

SetSphereSector sets a sphere sector vertex, norm, tex, index data at given starting *vertex* index (i.e., multiply this *3 to get actual float offset in Vtx array), and starting Idx index, with the specified radius, number of radial segments in each dimension (min 3), radial sector start angle and length in degrees (0 - 360), start = -1,0,0, elevation start angle and length in degrees (0 - 180), top = 0, bot = 180. pos is an arbitrary offset (for composing shapes), returns bounding box.

func SetTorusSector added in v1.0.0

func SetTorusSector(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32, vtxOff, idxOff int, radius, tubeRadius float32, radialSegs, tubeSegs int, angStart, angLen float32, pos mat32.Vec3) mat32.Box3

SetTorusSector sets torus sector vertex, norm, tex, index data at given starting *vertex* index (i.e., multiply this *3 to get actual float offset in Vtx array), and starting Idx index, with the specified revolution radius, tube radius, number of radial segments, number of tubular segments, radial sector start angle and length in degrees (0 - 360) pos is an arbitrary offset (for composing shapes), returns bounding box.

func SetTriangle added in v1.0.0

func SetTriangle(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32, vtxOff, idxOff int, a, b, c mat32.Vec3, texs []mat32.Vec2, pos mat32.Vec3) mat32.Box3

SetTriangle sets one triangle of vertex data indexes, and optionally texUV coords, at given starting *vertex* index (i.e., multiply this *3 to get actual float offset in Vtx array), and starting Idx index. Norm is auto-computed, and bounds expanded. pos is a 3D position offset. returns 3D size of plane. returns bounding box.

func SphereSectorN

func SphereSectorN(widthSegs, heightSegs int, elevStart, elevLen float32) (nVtx, nIdx int)

SphereSectorN returns the N's for a sphere sector's vertex and index data with given number of segments. Note: In *vertex* units, not float units (i.e., x3 to get actual float offset in Vtx array).

func TorusSectorN added in v1.0.0

func TorusSectorN(radialSegs, tubeSegs int) (nVtx, nIdx int)

TorusSectorN returns N's for a torus geometry with number of radial segments, number of tubular segments, radial sector start angle and length in degrees (0 - 360)

func TriangleN added in v1.0.0

func TriangleN() (nVtx, nIdx int)

TriangleN returns 3, 3

Types

type Box

type Box struct {
	ShapeBase

	// size along each dimension
	Size mat32.Vec3 `desc:"size along each dimension"`

	// number of segments to divide each plane into (enforced to be at least 1) -- may potentially increase rendering quality to have > 1
	Segs mat32.Vec3i `` /* 137-byte string literal not displayed */
}

Box is a rectangular-shaped solid (cuboid)

func NewBox

func NewBox(width, height, depth float32) *Box

NewBox returns a Box shape with given size

func (*Box) Defaults

func (bx *Box) Defaults()

func (*Box) N

func (bx *Box) N() (nVtx, nIdx int)

func (*Box) Set

func (bx *Box) Set(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32)

SetBox sets points in given allocated arrays

type Capsule

type Capsule struct {
	ShapeBase

	// height of the cylinder portion
	Height float32 `desc:"height of the cylinder portion"`

	// radius of the top -- set to 0 to omit top cap
	TopRad float32 `desc:"radius of the top -- set to 0 to omit top cap"`

	// radius of the bottom -- set to 0 to omit bottom cap
	BotRad float32 `desc:"radius of the bottom -- set to 0 to omit bottom cap"`

	// [min: 1] number of radial segments (32 is a reasonable default for full circle)
	RadialSegs int `min:"1" desc:"number of radial segments (32 is a reasonable default for full circle)"`

	// number of height segments
	HeightSegs int `desc:"number of height segments"`

	// number of segments in the hemisphere cap ends (16 is a reasonable default)
	CapSegs int `desc:"number of segments in the hemisphere cap ends (16 is a reasonable default)"`

	// [min: 0] [max: 360] [step: 5] starting angle in degrees, relative to -1,0,0 left side starting point
	AngStart float32 `min:"0" max:"360" step:"5" desc:"starting angle in degrees, relative to -1,0,0 left side starting point"`

	// [min: 0] [max: 360] [step: 5] total angle to generate in degrees (max 360)
	AngLen float32 `min:"0" max:"360" step:"5" desc:"total angle to generate in degrees (max 360)"`
}

Capsule is a generalized capsule shape: a cylinder with hemisphere end caps. Supports different radii on each end. Height is along the Y axis -- total height is Height + TopRad + BotRad.

func NewCapsule

func NewCapsule(height, radius float32, segs, heightSegs int) *Capsule

NewCapsule returns a Capsule shape with given radius, height, number of radial segments, number of height segments, and presence of a top and/or bottom cap. Height is along the Y axis.

func (*Capsule) Defaults

func (cp *Capsule) Defaults()

func (*Capsule) N

func (cp *Capsule) N() (nVtx, nIdx int)

func (*Capsule) Set

func (cp *Capsule) Set(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32)

SetCapsuleSector sets points in given allocated arrays

type Cylinder

type Cylinder struct {
	ShapeBase

	// height of the cylinder
	Height float32 `desc:"height of the cylinder"`

	// radius of the top -- set to 0 for a cone
	TopRad float32 `desc:"radius of the top -- set to 0 for a cone"`

	// radius of the bottom
	BotRad float32 `desc:"radius of the bottom"`

	// [min: 1] number of radial segments (32 is a reasonable default for full circle)
	RadialSegs int `min:"1" desc:"number of radial segments (32 is a reasonable default for full circle)"`

	// number of height segments
	HeightSegs int `desc:"number of height segments"`

	// render the top disc
	Top bool `desc:"render the top disc"`

	// render the bottom disc
	Bottom bool `desc:"render the bottom disc"`

	// [min: 0] [max: 360] [step: 5] starting angle in degrees, relative to -1,0,0 left side starting point
	AngStart float32 `min:"0" max:"360" step:"5" desc:"starting angle in degrees, relative to -1,0,0 left side starting point"`

	// [min: 0] [max: 360] [step: 5] total angle to generate in degrees (max 360)
	AngLen float32 `min:"0" max:"360" step:"5" desc:"total angle to generate in degrees (max 360)"`
}

Cylinder is a generalized cylinder shape, including a cone or truncated cone by having different size circles at either end. Height is up along the Y axis.

func NewCone

func NewCone(height, radius float32, radialSegs, heightSegs int, bottom bool) *Cylinder

NewCone returns a cone shape with the specified base radius, height, number of radial segments, number of height segments, and presence of a bottom cap. Height is along the Y axis.

func NewCylinder

func NewCylinder(height, radius float32, radialSegs, heightSegs int, top, bottom bool) *Cylinder

NewCylinder returns a Cylinder shape with given radius, height, number of radial segments, number of height segments, and presence of a top and/or bottom cap. Height is along the Y axis.

func (*Cylinder) Defaults

func (cy *Cylinder) Defaults()

func (*Cylinder) N

func (cy *Cylinder) N() (nVtx, nIdx int)

func (*Cylinder) Set

func (cy *Cylinder) Set(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32)

SetCylinderSector sets points in given allocated arrays

type Lines added in v1.0.0

type Lines struct {
	ShapeBase

	// line points (must be 2 or more)
	Points []mat32.Vec3 `desc:"line points (must be 2 or more)"`

	// line width, Y = height perpendicular to line direction, and X = depth
	Width mat32.Vec2 `desc:"line width, Y = height perpendicular to line direction, and X = depth"`

	// optional colors for each point -- actual color interpolates between
	Colors []color.Color `desc:"optional colors for each point -- actual color interpolates between"`

	// if true, connect the first and last points to form a closed shape
	Closed bool `desc:"if true, connect the first and last points to form a closed shape"`
}

Lines are lines rendered as long thin boxes defined by points and width parameters. The Mesh must be drawn in the XY plane (i.e., use Z = 0 or a constant unless specifically relevant to have full 3D variation). Rotate the solid to put into other planes.

func NewLines added in v1.0.0

func NewLines(points []mat32.Vec3, width mat32.Vec2, closed bool) *Lines

NewLines returns a Lines shape with given size

func (*Lines) Defaults added in v1.0.0

func (ln *Lines) Defaults()

func (*Lines) N added in v1.0.0

func (ln *Lines) N() (nVtx, nIdx int)

func (*Lines) Set added in v1.0.0

func (ln *Lines) Set(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32)

Set sets points in given allocated arrays

type Plane

type Plane struct {
	ShapeBase

	// axis along which the normal perpendicular to the plane points.  E.g., if the Y axis is specified, then it is a standard X-Z ground plane -- see also NormNeg for whether it is facing in the positive or negative of the given axis.
	NormAxis mat32.Dims `` /* 235-byte string literal not displayed */

	// if false, the plane normal facing in the positive direction along specified NormAxis, otherwise it faces in the negative if true
	NormNeg bool `` /* 135-byte string literal not displayed */

	// 2D size of plane
	Size mat32.Vec2 `desc:"2D size of plane"`

	// number of segments to divide plane into (enforced to be at least 1) -- may potentially increase rendering quality to have > 1
	Segs mat32.Vec2i `` /* 132-byte string literal not displayed */

	// offset from origin along direction of normal to the plane
	Offset float32 `desc:"offset from origin along direction of normal to the plane"`
}

Plane is a flat 2D plane, which can be oriented along any axis facing either positive or negative

func NewPlane

func NewPlane(axis mat32.Dims, width, height float32) *Plane

NewPlane returns a Plane shape with given size

func (*Plane) Defaults

func (pl *Plane) Defaults()

func (*Plane) N

func (pl *Plane) N() (nVtx, nIdx int)

N returns number of vertex, index points in this shape element

func (*Plane) Set

func (pl *Plane) Set(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32)

Set sets points in given allocated arrays

type Shape

type Shape interface {
	// N returns number of vertex, index points in this shape element
	N() (nVtx, nIdx int)

	// Offs returns starting offset for verticies, indexes in full shape array,
	// in terms of points, not floats
	Offs() (vtxOff, idxOff int)

	// SetOffs sets starting offset for verticies, indexes in full shape array,
	// in terms of points, not floats
	SetOffs(vtxOff, idxOff int)

	// Set sets points in given allocated arrays
	Set(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32)

	// BBox returns the bounding box for the shape, typically centered around 0
	// This is only valid after Set has been called.
	BBox() mat32.Box3
}

Shape is an interface for all shape-constructing elements

type ShapeBase

type ShapeBase struct {

	// vertex offset, in points
	VtxOff int `desc:"vertex offset, in points"`

	// index offset, in points
	IdxOff int `desc:"index offset, in points"`

	// cubic bounding box in local coords
	CBBox mat32.Box3 `desc:"cubic bounding box in local coords"`

	// all shapes take a 3D position offset to enable composition
	Pos mat32.Vec3 `desc:"all shapes take a 3D position offset to enable composition"`
}

ShapeBase is the base shape element

func (*ShapeBase) BBox

func (sb *ShapeBase) BBox() mat32.Box3

BBox returns the bounding box for the shape, typically centered around 0 This is only valid after Set has been called.

func (*ShapeBase) Offs

func (sb *ShapeBase) Offs() (vtxOff, idxOff int)

Offs returns starting offset for verticies, indexes in full shape array, in terms of points, not floats

func (*ShapeBase) SetOffs

func (sb *ShapeBase) SetOffs(vtxOff, idxOff int)

SetOffs sets starting offsets for verticies, indexes in full shape array

type ShapeGroup

type ShapeGroup struct {
	ShapeBase

	// list of shapes in group
	Shapes []Shape `desc:"list of shapes in group"`
}

ShapeGroup is a group of shapes -- returns summary data for shape elements

func (*ShapeGroup) N

func (sb *ShapeGroup) N() (nVtx, nIdx int)

N returns number of vertex, index points in this shape element.

func (*ShapeGroup) Set

func (sb *ShapeGroup) Set(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32)

Set sets points in given allocated arrays, also updates offsets

type Sphere

type Sphere struct {
	ShapeBase

	// radius of the sphere
	Radius float32 `desc:"radius of the sphere"`

	// [min: 3] number of segments around the width of the sphere (32 is reasonable default for full circle)
	WidthSegs int `min:"3" desc:"number of segments around the width of the sphere (32 is reasonable default for full circle)"`

	// [min: 3] number of height segments (32 is reasonable default for full height)
	HeightSegs int `min:"3" desc:"number of height segments (32 is reasonable default for full height)"`

	// [min: 0] [max: 360] [step: 5] starting radial angle in degrees, relative to -1,0,0 left side starting point
	AngStart float32 `min:"0" max:"360" step:"5" desc:"starting radial angle in degrees, relative to -1,0,0 left side starting point"`

	// [min: 0] [max: 360] [step: 5] total radial angle to generate in degrees (max = 360)
	AngLen float32 `min:"0" max:"360" step:"5" desc:"total radial angle to generate in degrees (max = 360)"`

	// [min: 0] [max: 180] [step: 5] starting elevation (height) angle in degrees - 0 = top of sphere, and Pi is bottom
	ElevStart float32 `min:"0" max:"180" step:"5" desc:"starting elevation (height) angle in degrees - 0 = top of sphere, and Pi is bottom"`

	// [min: 0] [max: 180] [step: 5] total angle to generate in degrees (max = 180)
	ElevLen float32 `min:"0" max:"180" step:"5" desc:"total angle to generate in degrees (max = 180)"`
}

Sphere is a sphere shape (can be a partial sphere too)

func NewSphere

func NewSphere(radius float32, segs int) *Sphere

NewSphere returns a Sphere shape with given size

func (*Sphere) Defaults

func (sp *Sphere) Defaults()

func (*Sphere) N

func (sp *Sphere) N() (nVtx, nIdx int)

func (*Sphere) Set

func (sp *Sphere) Set(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32)

SetSphereSector sets points in given allocated arrays

type Torus added in v1.0.0

type Torus struct {
	ShapeBase

	// larger radius of the torus ring
	Radius float32 `desc:"larger radius of the torus ring"`

	// radius of the solid tube
	TubeRadius float32 `desc:"radius of the solid tube"`

	// [min: 1] number of segments around the radius of the torus (32 is reasonable default for full circle)
	RadialSegs int `min:"1" desc:"number of segments around the radius of the torus (32 is reasonable default for full circle)"`

	// [min: 1] number of segments for the tube itself (32 is reasonable default for full height)
	TubeSegs int `min:"1" desc:"number of segments for the tube itself (32 is reasonable default for full height)"`

	// [min: 0] [max: 360] [step: 5] starting radial angle in degrees relative to 1,0,0 starting point
	AngStart float32 `min:"0" max:"360" step:"5" desc:"starting radial angle in degrees relative to 1,0,0 starting point"`

	// [min: 0] [max: 360] [step: 5] total radial angle to generate in degrees (max = 360)
	AngLen float32 `min:"0" max:"360" step:"5" desc:"total radial angle to generate in degrees (max = 360)"`
}

Torus is a torus mesh, defined by the radius of the solid tube and the larger radius of the ring.

func NewTorus added in v1.0.0

func NewTorus(radius, tubeRadius float32, segs int) *Torus

NewTorus returns a Torus mesh with the specified outer ring radius, solid tube radius, and number of segments (resolution).

func (*Torus) Defaults added in v1.0.0

func (tr *Torus) Defaults()

func (*Torus) N added in v1.0.0

func (tr *Torus) N() (nVtx, nIdx int)

func (*Torus) Set added in v1.0.0

func (tr *Torus) Set(vtxAry, normAry, texAry mat32.ArrayF32, idxAry mat32.ArrayU32)

Set sets points for torus in given allocated arrays

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL