Curve

package
v0.0.0-...-59761c8 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package Curve provides methods for working with Curve object instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsCurve() Instance
}

type Instance

type Instance [1]gdclass.Curve

This resource describes a mathematical curve by defining a set of points and tangents at each point. By default, it ranges between [code]0[/code] and [code]1[/code] on the X and Y axes, but these ranges can be changed. Please note that many resources and nodes assume they are given [i]unit curves[/i]. A unit curve is a curve whose domain (the X axis) is between [code]0[/code] and [code]1[/code]. Some examples of unit curve usage are [member CPUParticles2D.angle_curve] and [member Line2D.width_curve].

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddPoint

func (self Instance) AddPoint(position Vector2.XY) int

Adds a point to the curve. For each side, if the [code]*_mode[/code] is [constant TANGENT_LINEAR], the [code]*_tangent[/code] angle (in degrees) uses the slope of the curve halfway to the adjacent point. Allows custom assignments to the [code]*_tangent[/code] angle if [code]*_mode[/code] is set to [constant TANGENT_FREE].

func (Instance) AsCurve

func (self Instance) AsCurve() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) Bake

func (self Instance) Bake()

Recomputes the baked cache of points for the curve.

func (Instance) BakeResolution

func (self Instance) BakeResolution() int

func (Instance) CleanDupes

func (self Instance) CleanDupes()

Removes duplicate points, i.e. points that are less than 0.00001 units (engine epsilon value) away from their neighbor on the curve.

func (Instance) ClearPoints

func (self Instance) ClearPoints()

Removes all points from the curve.

func (Instance) GetDomainRange

func (self Instance) GetDomainRange() Float.X

Returns the difference between [member min_domain] and [member max_domain].

func (Instance) GetPointLeftMode

func (self Instance) GetPointLeftMode(index int) gdclass.CurveTangentMode

Returns the left [enum TangentMode] for the point at [param index].

func (Instance) GetPointLeftTangent

func (self Instance) GetPointLeftTangent(index int) Float.X

Returns the left tangent angle (in degrees) for the point at [param index].

func (Instance) GetPointPosition

func (self Instance) GetPointPosition(index int) Vector2.XY

Returns the curve coordinates for the point at [param index].

func (Instance) GetPointRightMode

func (self Instance) GetPointRightMode(index int) gdclass.CurveTangentMode

Returns the right [enum TangentMode] for the point at [param index].

func (Instance) GetPointRightTangent

func (self Instance) GetPointRightTangent(index int) Float.X

Returns the right tangent angle (in degrees) for the point at [param index].

func (Instance) GetValueRange

func (self Instance) GetValueRange() Float.X

Returns the difference between [member min_value] and [member max_value].

func (Instance) MaxDomain

func (self Instance) MaxDomain() Float.X

func (Instance) MaxValue

func (self Instance) MaxValue() Float.X

func (Instance) MinDomain

func (self Instance) MinDomain() Float.X

func (Instance) MinValue

func (self Instance) MinValue() Float.X

func (Instance) OnDomainChanged

func (self Instance) OnDomainChanged(cb func())

func (Instance) OnRangeChanged

func (self Instance) OnRangeChanged(cb func())

func (Instance) PointCount

func (self Instance) PointCount() int

func (Instance) RemovePoint

func (self Instance) RemovePoint(index int)

Removes the point at [param index] from the curve.

func (Instance) Sample

func (self Instance) Sample(offset Float.X) Float.X

Returns the Y value for the point that would exist at the X position [param offset] along the curve.

func (Instance) SampleBaked

func (self Instance) SampleBaked(offset Float.X) Float.X

Returns the Y value for the point that would exist at the X position [param offset] along the curve using the baked cache. Bakes the curve's points if not already baked.

func (Instance) SetBakeResolution

func (self Instance) SetBakeResolution(value int)

func (Instance) SetMaxDomain

func (self Instance) SetMaxDomain(value Float.X)

func (Instance) SetMaxValue

func (self Instance) SetMaxValue(value Float.X)

func (Instance) SetMinDomain

func (self Instance) SetMinDomain(value Float.X)

func (Instance) SetMinValue

func (self Instance) SetMinValue(value Float.X)

func (Instance) SetPointCount

func (self Instance) SetPointCount(value int)

func (Instance) SetPointLeftMode

func (self Instance) SetPointLeftMode(index int, mode gdclass.CurveTangentMode)

Sets the left [enum TangentMode] for the point at [param index] to [param mode].

func (Instance) SetPointLeftTangent

func (self Instance) SetPointLeftTangent(index int, tangent Float.X)

Sets the left tangent angle for the point at [param index] to [param tangent].

func (Instance) SetPointOffset

func (self Instance) SetPointOffset(index int, offset Float.X) int

Sets the offset from [code]0.5[/code].

func (Instance) SetPointRightMode

func (self Instance) SetPointRightMode(index int, mode gdclass.CurveTangentMode)

Sets the right [enum TangentMode] for the point at [param index] to [param mode].

func (Instance) SetPointRightTangent

func (self Instance) SetPointRightTangent(index int, tangent Float.X)

Sets the right tangent angle for the point at [param index] to [param tangent].

func (Instance) SetPointValue

func (self Instance) SetPointValue(index int, y Float.X)

Assigns the vertical position [param y] to the point at [param index].

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type TangentMode

type TangentMode = gdclass.CurveTangentMode //gd:Curve.TangentMode
const (
	/*The tangent on this side of the point is user-defined.*/
	TangentFree TangentMode = 0
	/*The curve calculates the tangent on this side of the point as the slope halfway towards the adjacent point.*/
	TangentLinear TangentMode = 1
	/*The total number of available tangent modes.*/
	TangentModeCount TangentMode = 2
)

Jump to

Keyboard shortcuts

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