Finds the convex hull of a finite set of 3d points
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
MIT License | |
Copyright (c) 2021 EgoMoose | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
MIT License | |
Copyright (c) 2021 EgoMoose | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local UNIT_X = Vector3.new(1, 0, 0) | |
local UNIT_Y = Vector3.new(0, 1, 0) | |
local SPIN_Y = CFrame.fromEulerAnglesXYZ(0, -math.pi/2, 0) | |
local function getRotationBetween(u, v, axis) | |
local dot, uxv = u:Dot(v), u:Cross(v) | |
if dot < -0.99999 then return CFrame.fromAxisAngle(axis, math.pi) end | |
return CFrame.new(0, 0, 0, uxv.x, uxv.y, uxv.z, 1 + dot) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local abs = math.abs; | |
local log = math.log; | |
local sqrt = math.sqrt; | |
-- calculates length from 0 to t (where t is a percentage eg 1 = 100%). | |
local function quadraticBezierLength(t, p0, p1, p2) | |
local a = p0 - 2*p1 + p2; | |
local b = 2*(p1 - p0); | |
local A = 4*(a:Dot(a)); | |
local B = 4*(a:Dot(b)); |