surreal2

package
v0.0.0-...-278928f Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Algorithm

type Algorithm struct {
	// contains filtered or unexported fields
}

Algorithm builds a surface by moving along it's border and making lines as long as possible.

PARAMETERS:
- minAngle limits the angle between tangents to generate a new vertex (maximum value is 90º, expressed in radians).
- step is the distance between surface checks and is useful for avoiding skipping small features that return
  to the original tangent. Keep it as close to 0, as possible (as long as performance is good enough).
- normalEps should generally be as close to 0 as possible (considering numerical inaccuracies).
- numNeighbors is used for duplicate surface detection and vertex merging (should be as high as possible as long as
  performance allows it).
- scanSurfaceCells is required when there are multiple surfaces, as the algorithm needs to find each one of them to
  properly generate them.
- scanSurfaceDistSq is the minimum distance between surfaces to consider them as different (keep as high as your
  surfaces allow in order to avoid double surfaces)
- surf* see fallToSurface.
- rng is only used for fallToSurface (to solve 0 gradient by pushing in a random direction).

func New

func New(minAngle float64, step float64, normalEps float64, scanSurfaceCells sdf.V2i, scanSurfaceDistSq float64, numNeighbors int, surfHitEps float64, surfStepSize float64, surfMaxSteps int, randSource rand.Source) *Algorithm

New see Algorithm.

func NewDefault

func NewDefault() *Algorithm

NewDefault values may change at any time. See NewSimple.

func NewSimple

func NewSimple(minAngle, step float64, scanSurfaceCells sdf.V2i) *Algorithm

NewSimple values may change at any time. See New.

func (*Algorithm) Run

func (a *Algorithm) Run(s sdf.SDF2) [][2]sdf.V2

Jump to

Keyboard shortcuts

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