algorithm

package
v0.0.0-...-a8ee3e7 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BezierCurve

type BezierCurve struct {
	Geometry
	// contains filtered or unexported fields
}

BezierCurve

The Bézier curve is a polynomial curve expressed as the linear interpolation between some
representative points, called control points.

Português:

A curva de Bézier é uma curva polinomial expressa como a interpolação linear entre alguns pontos
representativos, chamados pontos de controle.

func (*BezierCurve) Add

func (e *BezierCurve) Add(point Point)

func (*BezierCurve) Clear

func (e *BezierCurve) Clear()

func (*BezierCurve) ClearOriginal

func (e *BezierCurve) ClearOriginal()

func (*BezierCurve) ClearProcessed

func (e *BezierCurve) ClearProcessed()

func (*BezierCurve) Copy

func (e *BezierCurve) Copy(ref CopyInterface)

func (*BezierCurve) GenerateRipple

func (e *BezierCurve) GenerateRipple(distance float64, ripples int)

GenerateRipple

English:

Generates a sine ripple in the list of processed points, losing the original points

 Input:
   distance: maximum ripple distance, wavelength;
   ripples: amounts of ripples;

Português:

Gera uma ondulação senoidal na lista de pontos processados, perdendo os pontos originais

 Entrada:
   distance: distância máxima da ondulação, ou comprimento de onda;
   ripples: quantidades de ondulações;
   processed: ponteiro da lista de pontos processados.

func (*BezierCurve) GetOriginal

func (e *BezierCurve) GetOriginal() (list *[]Point)

func (*BezierCurve) GetProcessed

func (e *BezierCurve) GetProcessed() (list *[]Point)

func (*BezierCurve) IncreaseDensityBetweenPoints

func (e *BezierCurve) IncreaseDensityBetweenPoints(lineSegments int)

IncreaseDensityBetweenPoints

English:

Increases the number of segments between points, in a straight line.

 Input:
   lineSegments: number of line segments to be added between points.

 Notes:
   * Use this function when the stitch density is low when using easing tween functions, so the movement is more
     fluid.

Português:

Aumenta a quantidade de segmentos entre os pontos, em linha reta.

 Entrada:
   lineSegments: quantidade de seguimentos de reta a serem adicionados entre os pontos.

 Nota:
   * Use esta função quando a densidade de pontos for baixa durante o uso das funções easing tween, para que o
     movimento fique mais fluido.

func (*BezierCurve) Init

func (e *BezierCurve) Init()

func (*BezierCurve) Process

func (e *BezierCurve) Process(step float64) (ref *BezierCurve)

func (*BezierCurve) SetNumberOfSegments

func (e *BezierCurve) SetNumberOfSegments(n int)

SetNumberOfSegments

English:

Adjusts the number of line segments that make up the curve.

Every curve is formed by N straight segments, where a curve with many segments of irregular sizes makes the movement of objects unstable, so adjusting the number of segments when generating a curve makes the movement more uniform, in addition to saving memory.

Português:

Ajusta a quantidade de segmentos de reta que formam a curva.

Toda curva é formada N segmentos de reta, onde uma curva com muitos seguimentos de tamanhos irregulares deixam o movimento de objetos instável, por isto, ajustar o número de segmentos ao gerar uma curva, deixa o movimento mais uniforme, além de poupar memória.

type Bresenham

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

Bresenham

English:

Bresenham's line algorithm is a line drawing algorithm that determines the points of an
n-dimensional raster that should be selected in order to form a close approximation to a straight
line between two points.

Português:

O algoritmo de linha de Bresenham é um algoritmo de desenho de linha que determina os pontos de um
raster n-dimensional que deve ser selecionado para formar uma aproximação próxima a uma linha reta
entre dois pontos.

func (*Bresenham) Add

func (e *Bresenham) Add(pos1, pos2 Point)

func (Bresenham) Get

func (e Bresenham) Get() (list []Point)

type CopyInterface

type CopyInterface interface {
	GetProcessed() (list *[]Point)
	GetOriginal() (list *[]Point)
}

type CurveInterface

type CurveInterface interface {
	GetProcessed() (list *[]Point)
}

type Geometry

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

func (*Geometry) AngleBetweenTwoPoints

func (e *Geometry) AngleBetweenTwoPoints(p1, p2 Point) (angle float64)

func (*Geometry) DistanceBetweenTwoPoints

func (e *Geometry) DistanceBetweenTwoPoints(p0, p1 Point) (d float64)

DistanceBetweenTwoPoints

English:

Calculates the distance between two points.

 Input:
   p1, p2: Start and end points of the line.

 Output:
   d: distance between p1 and p2 in pixels.

Português:

Calcula a distância entre dois pontos.

 Entrada:
   p1, p2: Pontos inicial e final da reta.

 Saída:
   d: distância entre p1 e p2 em pixels.

func (*Geometry) NewPointByDistance

func (e *Geometry) NewPointByDistance(point Point, distance, angle float64) Point

func (*Geometry) PointBetweenTwoPoints

func (e *Geometry) PointBetweenTwoPoints(p1, p2 Point, distance float64) (p Point)

PointBetweenTwoPoints

English:

Returns a point between two points from the distance of P1.

 Input:
   p1, p2: start and end point of the line;
   distance: distance of the new point from p1.

 Output:
   p: midpoint between p1 and p2.

Português:

Devolve um ponto entre dois pontos a partir da distância de P1.

 Entrada:
   p1, p2: ponto inicial e final da reta;
   distance: distância do novo ponto em relação a p1.

 Saída:
   p: ponto intermediário entre p1 e p2.

func (*Geometry) Round

func (e *Geometry) Round(value float64, places int) float64

Round

English:

Português:

Arredonda a quantidade máxima de casas decimais de um número de ponto flutuante.

 Entrada:
   value: número a ser arredondado;
   places: quantidade de dígitos decimais.

 Notes:
   * Se o dígito seguinte a places for menor que 5, o dígito place será arredondado para baixo.
     Exemplo: Round(3.1415, 2) = 3.14
              Round(3.1415, 3) = 3.142

type Point

type Point struct {
	X float64
	Y float64
	// contains filtered or unexported fields
}

type Rdp

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

Rdp

English:

The Ramer–Douglas–Peucker algorithm, also known as the Douglas–Peucker algorithm and iterative
end-point fit algorithm, is an algorithm that decimates a curve composed of line segments to a
similar curve with fewer points.

Português:

O algoritmo Ramer-Douglas-Peucker, também conhecido como algoritmo de Douglas-Peucker e algoritmo
iterativo de ajuste de ponto final, é um algoritmo que dizima uma curva composta de segmentos de
linha para uma curva semelhante com menos pontos.

func (*Rdp) Add

func (e *Rdp) Add(p Point)

func (*Rdp) Clear

func (e *Rdp) Clear()

func (*Rdp) ClearOriginal

func (e *Rdp) ClearOriginal()

func (*Rdp) ClearProcessed

func (e *Rdp) ClearProcessed()

func (*Rdp) GetOriginal

func (e *Rdp) GetOriginal() (points *[]Point)

func (*Rdp) GetProcessed

func (e *Rdp) GetProcessed() (points *[]Point)

func (*Rdp) Init

func (e *Rdp) Init()

func (*Rdp) Process

func (e *Rdp) Process(epsilon float64)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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