Skip to content

Instantly share code, notes, and snippets.

View hadiidbouk's full-sized avatar

Hadi Dbouk hadiidbouk

View GitHub Profile
@hadiidbouk
hadiidbouk / Casteljau.swift
Last active July 22, 2021 12:23
De Casteljau's algorithm implementation in Swift 5
import CoreGraphics
class Casteljau {
let count: Int
let x: [CGFloat]
let y: [CGFloat]
var b: [[CGFloat]]
init(p0: CGPoint, p1: CGPoint, p2: CGPoint, p3: CGPoint) {
let points = [p0, p1, p2, p3]