Skip to content

Instantly share code, notes, and snippets.

@dowoge
Last active January 12, 2024 23:31
Show Gist options
  • Save dowoge/b5c4e638c48f8553e92512895789a60c to your computer and use it in GitHub Desktop.
Save dowoge/b5c4e638c48f8553e92512895789a60c to your computer and use it in GitHub Desktop.
--return the target angle needed between segments to join them via a semi-circle (radius=pi)
local pi=math.pi
local deg=math.deg
local function CalculateAngle(SegmentLength,DistanceBetweenPoints)
local NSegments=(pi*DistanceBetweenPoints/2)/SegmentLength
local SegmentAngle=pi/NSegments
return deg(SegmentAngle)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment