-
Hrm. That's what I had before... and it stopped working way back.. I've just gotten around to trying to fix it.
I had the whole Dulox Toolkit thing setup... and it was working for Equilateral Triangles... but.. yeah.. not since November of 2016 apparently.
It was drawing the end points but none of the lines..
Never did figure out how to make the Hexagon work though.
Code:
<windowclass name="imagewindow" merge="join">
<sheetdata>
<imagecontrol name="image">
<default snap="off" drawingsize="500,500" snaphex="vertexandcenter" gridtype="hexrow" />
<pointertypes>
<arrow>
<icon>pointer</icon>
<label>Draw Arrow</label>
</arrow>
<circle>
<icon>pointer_circle</icon>
<label>Draw Circle</label>
</circle>
<custom name="60ConePointer">
<icon>pointer_cone</icon>
<label>Draw 60-Degree Cone</label>
</custom>
<custom name="TrianglePointer">
<icon>pointer_cone</icon>
<label>Draw Triangle</label>
</custom>
<custom name="HexPointer">
<icon>pointer_circle</icon>
<label>Draw Hex</label>
</custom>
</pointertypes>
</imagecontrol>
</sheetdata>
</windowclass>
I suppose now I can default 60 degrees for the cone pointer and just set that one as a standard pointer.
Code:
<cone>
<icon>pointer_cone</icon>
<label>Draw Cone</label>
</cone>
I'm currently trying to figure out where it actually broke if you are telling me that the onBuildCustomPointer is still working. Hrm.
-
I'm assuming that it is all still working, as it is used for almost all the Savage Worlds pointers and I haven't heard any issues. Also, I haven't touched that code since 2016. ;)
JPG
-
OK.. so I figured it out and triangles are working again. :)
Now on to Hexagons.
-
OK.. so I took the one side of the Equilateral Triangle and that draws one side of the Hexagon.. all I need to do.. (in theory) is flip it around 5 more times to get the various other sides.
I could probably use a little help with the math... it's been a while.
Code:
function fpLineCurve(nStartLineXCoord,nStartLineYCoord,nEndLineXCoord,nEndLineYCoord,nOffset)
local aCurve = {{nStartLineXCoord,nStartLineYCoord-nOffset},
{nStartLineXCoord,nStartLineYCoord-nOffset},
{nEndLineXCoord,nEndLineYCoord-nOffset},
{nEndLineXCoord,nEndLineYCoord-nOffset}};
return aCurve;
end
function fpHexPointer(aShapeCurves,nRadius)
local nSide = math.sqrt((nRadius*nRadius)+((nRadius*nRadius)/3));
table.insert(aShapeCurves,fpLineCurve(-nSide/2, 0, nSide/2, 0, nRadius));
table.insert(aShapeCurves,fpLineCurve(-nSide/2, 0, nSide/2, 0, -nRadius));
end
So the 0 is the point on the offset where it's drawing the line.. and half the side + or - gets you to the ends.
Reverse the Radius gets you the opposite line.
If I set up 3 of these.. it makes a Hexagon. :)
-
Victory!!
The Hexagonal Pointer!
Code:
function fpHexPointer(aShapeCurves,nRadius)
local nSide = math.sqrt((nRadius*nRadius)+((nRadius*nRadius)/3));
table.insert(aShapeCurves,fpLineCurve(-nSide,0,-nSide/2,-nRadius,0));
table.insert(aShapeCurves,fpLineCurve(-nSide,0,-nSide/2,nRadius,0));
table.insert(aShapeCurves,fpLineCurve(-nSide/2,0,nSide/2,0,-nRadius));
table.insert(aShapeCurves,fpLineCurve(-nSide/2,0,nSide/2,0,nRadius));
table.insert(aShapeCurves,fpLineCurve(nSide,0,nSide/2,-nRadius,0));
table.insert(aShapeCurves,fpLineCurve(nSide,0,nSide/2,nRadius,0));
end
-
Just to geek out on trig for a moment. Equal width/distance from the origin point is not an equilateral triangle, as Moon said. If you think of an equilateral triangle being two right triangles back to back, then each of those right triangles will have tan(x) = 0.5, where x is the angle between adjacent and hypotenuse. The total angle is then 2x, because, two triangles. tan(x) = 0.5 is the same as arctan(0.5) = x, which is ~26.56. Double that, and you get 53.12, or, what Moon said. There will be a quiz on Monday...
https://www.mathsisfun.com/sine-cosine-tangent.html
Since equilateral triangles have 3 60 degree angles, by the same logic as above, the ratio of distance/width is 2 * tan(30) = ~1.15
-
Dork.
Yeah yeah... I meant oh bother.. Whatever. You know what I meant.
Check out my HEX pointer! :)
https://media.discordapp.net/attachm...13/unknown.png
-
who has two thumbs and was in math club in high school? this guy :-)