math.QuadraticBezier

  Vector math.QuadraticBezier( number frac, Vector p0, Vector p1, Vector p2 )

Açıklama

3 kontrol noktası arasında kuadratik bezier ile bir nokta enterpolasyonu yapar.

4 kontrol noktası ile çalışan bir fonksiyon için math.CubicBezier'e bakın.

Argümanlar

1 number frac
Sonucu bulmak için kullanılacak kesir.
2 Vector p0
Birinci kontrol noktası
3 Vector p1
Teğet
4 Vector p2
İkinci kontrol noktası

Döndürdükleri

1 Vector
Belirtilen kesirde kontrol noktaları arasındaki nokta

Örnek

Bu fonksiyonun kullanımını gösterir.

local points = { Vector( 128, 128 ), Vector( 384, 128 ), Vector( 384, 384 ) } hook.Add( "HUDPaint", "math.QuadraticBezier", function() local frac = RealTime() % 1 local point = math.QuadraticBezier( 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[2].x - 4, points[2].y - 4, 8, 8 ) surface.DrawRect( points[3].x - 4, points[3].y - 4, 8, 8 ) end )
Çıktı:

Tüm sunucular · GmodTR Launcher · Rehber · GMod Wiki · GmodTR nedir? · Sunucu ekle · Discord