rotation - Can't get transformed points out of a kinetic JS line -


i have been able draw line using kinetic js, follows:

var track129 = new kinetic.spline({ points: [ {x: 3, y: 400},  {x: 196, y: 400},  {x: 213, y: 395},  {x: 290, y: 345}, {x: 319, y: 324}, {x: 389, y: 253}, {x: 457, y: 184}, {x: 471, y: 173}, {x: 481, y: 173}, {x: 682, y: 173}, // blue track branches red track (129, 009). {x: 708, y: 171}, {x: 740, y: 186}, {x: 773, y: 218}, {x: 799, y: 240}, {x: 822, y: 251}, {x: 845, y: 254}, {x: 866, y: 251}, {x: 894, y: 238}, {x: 934, y: 204}         ], stroke: 'blue', strokewidth: 2, linecap: 'round', tension: .2 });  layer.add(track129); 

i rotate line using following command:

track129.setrotationdeg(45); 

the visual display updates. attempt transformed points out of rotated line so:

var myspleenpoints = track129.getpoints();  

i end getting same array of points entered. i've tried offset , translation in effort see if can derive absolute coordinates of rotated points i've had no luck. can me extract actual translated values?

sorry, rotation doesn't translate point values, you're getting correct output. if want translated values, have write function calculates coordinates. thing have values need that. rotation degree, coordinates, , rotation around point.

i think equation (for rotation around origin)

 x' = x * cos(theta) - y * sin(theta);  y' = x * sin(theta) + y * cos(theta);  

html5 canvas: calculating x,y point when rotated

https://math.stackexchange.com/questions/123098/finding-the-position-of-a-point-after-rotation-why-is-my-result-incorrect


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -