<?xml version="1.0" encoding="UTF-8" ?>
<class name="Curve" inherits="Resource" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
	<brief_description>
		A mathematical curve.
	</brief_description>
	<description>
		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].
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="add_point">
			<return type="int" />
			<param index="0" name="position" type="Vector2" />
			<param index="1" name="left_tangent" type="float" default="0" />
			<param index="2" name="right_tangent" type="float" default="0" />
			<param index="3" name="left_mode" type="int" enum="Curve.TangentMode" default="0" />
			<param index="4" name="right_mode" type="int" enum="Curve.TangentMode" default="0" />
			<description>
				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].
			</description>
		</method>
		<method name="bake">
			<return type="void" />
			<description>
				Recomputes the baked cache of points for the curve.
			</description>
		</method>
		<method name="clean_dupes">
			<return type="void" />
			<description>
				Removes duplicate points, i.e. points that are less than 0.00001 units (engine epsilon value) away from their neighbor on the curve.
			</description>
		</method>
		<method name="clear_points">
			<return type="void" />
			<description>
				Removes all points from the curve.
			</description>
		</method>
		<method name="get_domain_range" qualifiers="const">
			<return type="float" />
			<description>
				Returns the difference between [member min_domain] and [member max_domain].
			</description>
		</method>
		<method name="get_point_left_mode" qualifiers="const">
			<return type="int" enum="Curve.TangentMode" />
			<param index="0" name="index" type="int" />
			<description>
				Returns the left [enum TangentMode] for the point at [param index].
			</description>
		</method>
		<method name="get_point_left_tangent" qualifiers="const">
			<return type="float" />
			<param index="0" name="index" type="int" />
			<description>
				Returns the left tangent angle (in degrees) for the point at [param index].
			</description>
		</method>
		<method name="get_point_position" qualifiers="const">
			<return type="Vector2" />
			<param index="0" name="index" type="int" />
			<description>
				Returns the curve coordinates for the point at [param index].
			</description>
		</method>
		<method name="get_point_right_mode" qualifiers="const">
			<return type="int" enum="Curve.TangentMode" />
			<param index="0" name="index" type="int" />
			<description>
				Returns the right [enum TangentMode] for the point at [param index].
			</description>
		</method>
		<method name="get_point_right_tangent" qualifiers="const">
			<return type="float" />
			<param index="0" name="index" type="int" />
			<description>
				Returns the right tangent angle (in degrees) for the point at [param index].
			</description>
		</method>
		<method name="get_value_range" qualifiers="const">
			<return type="float" />
			<description>
				Returns the difference between [member min_value] and [member max_value].
			</description>
		</method>
		<method name="remove_point">
			<return type="void" />
			<param index="0" name="index" type="int" />
			<description>
				Removes the point at [param index] from the curve.
			</description>
		</method>
		<method name="sample" qualifiers="const">
			<return type="float" />
			<param index="0" name="offset" type="float" />
			<description>
				Returns the Y value for the point that would exist at the X position [param offset] along the curve.
			</description>
		</method>
		<method name="sample_baked" qualifiers="const">
			<return type="float" />
			<param index="0" name="offset" type="float" />
			<description>
				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.
			</description>
		</method>
		<method name="set_point_left_mode">
			<return type="void" />
			<param index="0" name="index" type="int" />
			<param index="1" name="mode" type="int" enum="Curve.TangentMode" />
			<description>
				Sets the left [enum TangentMode] for the point at [param index] to [param mode].
			</description>
		</method>
		<method name="set_point_left_tangent">
			<return type="void" />
			<param index="0" name="index" type="int" />
			<param index="1" name="tangent" type="float" />
			<description>
				Sets the left tangent angle for the point at [param index] to [param tangent].
			</description>
		</method>
		<method name="set_point_offset">
			<return type="int" />
			<param index="0" name="index" type="int" />
			<param index="1" name="offset" type="float" />
			<description>
				Assigns the horizontal position [param offset] to the point at [param index].
			</description>
		</method>
		<method name="set_point_right_mode">
			<return type="void" />
			<param index="0" name="index" type="int" />
			<param index="1" name="mode" type="int" enum="Curve.TangentMode" />
			<description>
				Sets the right [enum TangentMode] for the point at [param index] to [param mode].
			</description>
		</method>
		<method name="set_point_right_tangent">
			<return type="void" />
			<param index="0" name="index" type="int" />
			<param index="1" name="tangent" type="float" />
			<description>
				Sets the right tangent angle for the point at [param index] to [param tangent].
			</description>
		</method>
		<method name="set_point_value">
			<return type="void" />
			<param index="0" name="index" type="int" />
			<param index="1" name="y" type="float" />
			<description>
				Assigns the vertical position [param y] to the point at [param index].
			</description>
		</method>
	</methods>
	<members>
		<member name="bake_resolution" type="int" setter="set_bake_resolution" getter="get_bake_resolution" default="100">
			The number of points to include in the baked (i.e. cached) curve data.
		</member>
		<member name="max_domain" type="float" setter="set_max_domain" getter="get_max_domain" default="1.0">
			The maximum domain (x-coordinate) that points can have.
		</member>
		<member name="max_value" type="float" setter="set_max_value" getter="get_max_value" default="1.0">
			The maximum value (y-coordinate) that points can have. Tangents can cause higher values between points.
		</member>
		<member name="min_domain" type="float" setter="set_min_domain" getter="get_min_domain" default="0.0">
			The minimum domain (x-coordinate) that points can have.
		</member>
		<member name="min_value" type="float" setter="set_min_value" getter="get_min_value" default="0.0">
			The minimum value (y-coordinate) that points can have. Tangents can cause lower values between points.
		</member>
		<member name="point_count" type="int" setter="set_point_count" getter="get_point_count" default="0">
			The number of points describing the curve.
		</member>
		<member name="point_{index}/left_mode" type="int" setter="" getter="" default="0">
			The left [enum TangentMode] for the point at [code]index[/code].
			[b]Note:[/b] [code]index[/code] is a value in the [code]0 .. point_count - 1[/code] range.
		</member>
		<member name="point_{index}/left_tangent" type="float" setter="" getter="" default="0.0">
			The left tangent angle (in degrees) for the point at [code]index[/code].
			[b]Note:[/b] [code]index[/code] is a value in the [code]0 .. point_count - 1[/code] range.
		</member>
		<member name="point_{index}/position" type="Vector2" setter="" getter="" default="Vector2(0, 0)">
			The position of the point at [code]index[/code].
			[b]Note:[/b] [code]index[/code] is a value in the [code]0 .. point_count - 1[/code] range.
		</member>
		<member name="point_{index}/right_mode" type="int" setter="" getter="" default="0">
			The right [enum TangentMode] for the point at [code]index[/code].
			[b]Note:[/b] [code]index[/code] is a value in the [code]0 .. point_count - 1[/code] range.
		</member>
		<member name="point_{index}/right_tangent" type="float" setter="" getter="" default="0.0">
			The right tangent angle (in degrees) for the point at [code]index[/code].
			[b]Note:[/b] [code]index[/code] is a value in the [code]0 .. point_count - 1[/code] range.
		</member>
	</members>
	<signals>
		<signal name="domain_changed">
			<description>
				Emitted when [member max_domain] or [member min_domain] is changed.
			</description>
		</signal>
		<signal name="range_changed">
			<description>
				Emitted when [member max_value] or [member min_value] is changed.
			</description>
		</signal>
	</signals>
	<constants>
		<constant name="TANGENT_FREE" value="0" enum="TangentMode">
			The tangent on this side of the point is user-defined.
		</constant>
		<constant name="TANGENT_LINEAR" value="1" enum="TangentMode">
			The curve calculates the tangent on this side of the point as the slope halfway towards the adjacent point.
		</constant>
		<constant name="TANGENT_MODE_COUNT" value="2" enum="TangentMode">
			The total number of available tangent modes.
		</constant>
	</constants>
</class>
