# math.CHSpline

- **Ortam:** İstemci, Sunucu, Menü
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/math.CHSpline
- **Çeviri tarihi:** 2025-09-08

```lua
Vector math.CHSpline( number frac, Vector point0, Vector tan0, Vector point1, Vector tan1 )
```

## Açıklama

Kübik Hermite spline algoritması.

## Argümanlar

1. [number](https://gmod.tr/wiki/number) **frac**: 0'dan 1'e kadar, spline boyunca noktanın nerede olacağını belirtir.
2. [Vector](https://gmod.tr/wiki/Vector) **point0**: Spline için ilk nokta.
3. [Vector](https://gmod.tr/wiki/Vector) **tan0**: Spline'ın ilk noktası için teğet.
4. [Vector](https://gmod.tr/wiki/Vector) **point1**: Spline için ikinci nokta.
5. [Vector](https://gmod.tr/wiki/Vector) **tan1**: Spline'ın ikinci noktası için teğet.

## Döndürülen Değerler

1. [Vector](https://gmod.tr/wiki/Vector): Verilen kesirde kübik Hermite spline üzerindeki nokta.

### Örnek

```lua
local points = {
	Vector( 128, 128 ), -- nokta 1
	Vector( 384, 128 ), -- teğet pozisyonu 1
	Vector( 128, 384 ), -- nokta 2
	Vector( 384, 384 ) -- teğet pozisyonu 2
}

hook.Add( "HUDPaint", "math.BezierLerp", function()
	local frac = RealTime() % 1
	local point = math.CHSpline( frac, unpack( points ) )

	surface.SetDrawColor( 255, 255, 0 )
	surface.DrawRect( point.x - 4, point.y - 4, 8, 8 )

	surface.DrawRect( points[1].x - 4, points[1].y - 4, 8, 8 )
	surface.DrawRect( points[3].x - 4, points[3].y - 4, 8, 8 )
	surface.SetDrawColor( 255, 0, 0 )
	surface.DrawRect( points[2].x - 4, points[2].y - 4, 8, 8 )
	surface.DrawRect( points[4].x - 4, points[4].y - 4, 8, 8 )

	-- Spline'ı çiz
	for i=0,20 do

		local point = math.CHSpline( i / 20, unpack( points ) )

		surface.SetDrawColor( 0, 255, 0 )
		surface.DrawRect( point.x - 2, point.y - 2, 4, 4 )
	end
end )
```

**Çıktı:**

![image.png](https://gmod.tr/api/uploads/wiki/9eb74901a40ff482a34d.png)

- [GMod Wiki ana sayfası](https://gmod.tr/wiki)

---

[Tüm sunucular](https://gmod.tr/) · [GmodTR Launcher](https://gmod.tr/launcher) · [Rehber](https://gmod.tr/rehber) · [GMod Wiki](https://gmod.tr/wiki) · [GmodTR nedir?](https://gmod.tr/hakkinda) · [Sunucu ekle](https://gmod.tr/sunucu-ekle) · [Discord](https://discord.gg/gmodtr)

Kaynak: https://gmod.tr/wiki/math.CHSpline
