Quadrangle Calculation

I’ve applied isometric skews to some squares & rectangles in fireworks, saved & looked at the javascript produced thinking I can make myself an isometric-auto-skew extension with flash … I’ve spent days trying to figure out how Fireworks is calculating the points for the “dom.setQuadrangle({pointObject})” with little success other than noticing a square always produces the same numbers no matter the size/position, & skewing oposite side mirrors point numbers.

Here’s a few of the results of skewing from the sides, ({TL,TR,BR,BL})


Any Square
setQuadrangle({x:0, y:0}, {x:1, y:0.5}, {x:1, y:1.5}, {x:0, y:1}
20 X 10
setQuadrangle({x:0, y:0.25}, {x:1, y:0.75}, {x:1, y:1.25}, {x:0, y:0.75}
18 X 10
setQuadrangle({x:0, y:0.2222222238779068}, {x:1, y:0.72222220897674561}, {x:1, y:1.2777777910232544}, {x:0, y:0.77777779102325439}

I need to know how I can use Flash’s math methods to calculate these points from just width, height, & the 26.6 degrees mentioned in a tutorial by Senocular.

Pleeeeeeease :smiley:

AS doesnt support skewing, so theres no setQuadrangle equivalent to use in Flash. The best you have is to encase a square in another movieclip, rotate the square 45 degrees then scale the movieclip down to compress the square and therefore “skew” it within those two timelines. This is covered in the tutorials somewhere.

I know :smiley:

Sorry I think I explianed myself backwards :oops:

I’m not trying to skew in Flash, just calculate the points from width/height aquired from Fireworks as this will be a command panel in Fireworks.

So I can just click a button in this flash command panel in fireworks & have my selection auto-skewed to the 2:1 ratio :smiley:

I’m thinking use bounds = MMExecute(“dom.getSelectionBounds();”) for getting the width/height of a selection, calculate the Quadrangle points in flash (part i’m having trouble with) then return them with the dom.setQuadrangle({pointObj}); To have whatever I’ve selected in fireworks be auto-skewed :smiley:

I know this is is more a math question than an AS question, I need to use AS Math methods (which other than round,random,floor,ceil, im a little foggy on) to do the figuring though :smiley:

EDIT // Guess I should mention I’m using the MX(not 2004) versions of Flash & Fireworks.

ah, ok, so you’re skewing in FW (via Flash panel) :wink:
Actually, not much has changed :P. Skewing alone in FW wont get you what you want since given any square, a single, regular skew will alter only two parallel sides at a time, the others remain constant, thereby resulting in an uneven transformation.

You will have to take a similar approach as the one I mentioned above. Rotate the tile 45 degrees and then scale it down vertically by 50% - granted setQuadrangle can provide this kind of transformation, but you’re not skewing :wink:

var dom = fw.getDocumentDOM();
dom.rotateSelection(45, "autoTrimImages transformAttributes");
dom.scaleSelection(1, .5, "autoTrimImages transformAttributes");

Aha, that explains how to go about making a buildings floors/flat roofs, Thankyou :smiley:
I was scratching my head on how to apply that to walls but I think dom.cropSelection({boundingRectangle}) may work.
lets see, 50 X 50 square rotated, scaled … hmmm need walls width to be 2*roofWidth else there wont be enough to crop … ok, rotate/scale wall, precalculate bounding rectangle of preWall to skip a MMExecute to get it, selectionBoundsForCrop = {left: (width/4), top:0, right: ((width/4)*3), bottom:height}…
On second thought it may be easier to just make one with a series of dom.addNewLine()'s & fillSelectedPixels() since I’ll have to selectAllOnLayer & flattenSlection anyway :ponders:

I’m trying to keep as much as I can in vectors so the fills are easy to change, hence the want for skewing with walls :smiley:

*heads over to Senocular.com to get ahold of the fwCommandPrompt :stuck_out_tongue: *
Thanks Senocular.