Doswelk
January 6th, 2013, 09:42
Guys,
I'm trying to work out this old post to see if I can create the call of darkness strafe template.
https://www.fantasygrounds.com/forums/showthread.php?t=8971&highlight=custom+pointer
Does anyone here understand the maths / spline curves that can explain to me how I work out what the 4 points I need to create for each control point?
PW and I looked at this a while back and did not understand it, but would like to try again..
Thanks in advance
grapper
January 6th, 2013, 16:44
I'm assuming that you don't need to do the curves in order or in a specific direction (i.e. they are all independently drawn)
To do the lozenge shape you'll need 6 segments (one for each quarter circle and two straight segments)
dimensions I used Circle diameter 2", straight segments 7" long, total length 9"
I don't do lua and I haven't done more than write xml modules for my own use, but by cribbing from the example you gave, this should work if you insert it in place of the cone section.
-- strafe template facing in the negative y direction
local kappa = 4/3*(sqrt(2)-1);
-- circle segments at the origin
local segment = { { startx, starty },
{ startx + kappa*u, starty },
{ startx + u, starty - (1 - kappa)*u },
{ startx + u, starty - u } };
table.insert(segments, segment);
local segment = { { startx, starty },
{ startx - kappa*u, starty },
{ startx - u, starty - (1 - kappa)*u },
{ startx - u, starty - u } };
table.insert(segments, segment);
-- straight segments
local segment = { { startx + u, starty - u },
{ startx + u, starty -2*u },
{ startx + u, starty - 7*u },
{ startx + u, starty - 8*u } };
table.insert(segments, segment);
local segment = { { startx - u, starty - u },
{ startx - u, starty -2*u },
{ startx - u, starty - 7*u },
{ startx - u, starty - 8*u } };
table.insert(segments, segment);
-- circle segments at the far end
local segment = { { startx, starty -9*u },
{ startx + kappa*u, starty -9*u },
{ startx + u, starty - (8 + kappa)*u },
{ startx + u, starty - 8*u } };
table.insert(segments, segment);
local segment = { { startx, starty -9*u },
{ startx - kappa*u, starty -9*u },
{ startx - u, starty - (8 + kappa)*u },
{ startx - u, starty - 8*u } };
table.insert(segments, segment);
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.