Lively Kernel canvas
//
DraftPointTransformDirection40
10000.21498983085950915Wikicontroltrue
911
Runtestsfalsenull>' + result.selector;\n\t\t\tmsg += '\\n';\n\t\t\tmsg += result.err.message;\n\t\t\treturn msg;\n\t\t}).join('\\n---------\\n');\n\t\t$morph('testResult').setExtent(pt(400,20))\n\t\t$morph('testResult').setFill(Color.red);\n\t\t$morph('testResult').setTextString(failStr);\n\t} /* runFinished */"]]>null
truenull
SceneTest
10000.000016690958237224847Wikicontroltrue
10000.00007702729172761999Wikicontroltrue
10002.054932729059625e-8Wikicontroltrue
10003.6135926356613576e-33Wikicontroltrue
1.786557915145955
10001.0425347725544004e-13Wikicontroltrue
10002.116834252826705e-13Wikicontroltrue
10000.0063626854570584725Wikicontroltrue
10000.18530283990711194Wikicontroltrue
10000.03435252244335789Wikicontroltrue
t=newlively.Tests.SceneTest.RotateMorphTest();t.setUp();t.testRotateFixedAround()5
-0.2410978044081229
10002.8189230522396902e-8Wikicontroltrue
10004.295799664301754e-8Wikicontroltrue
2.3561944901923453
$morph('box2').setPosition(pt(500,100))$morph('box2').setExtent(pt(200,100))$morph('box2').setRotation(0)$morph('box2').rotateAround(45,pt(100,50))printMatrix($morph('box2').getTransform().toMatrix())6
10000.0009559175032080271Wikicontroltrue
Runningtest:testRotatefalsetruefalse0
Runningtest:testRotateFixedAroundfalsetruefalse0
Runningtest:testCombineTransformfalsetruefalse0
Runningtest:testRotateAroundfalsetruefalse0
Runningtest:testTransformDirectionfalsetruefalse0
Runningtest:testTranslatefalsetruefalse0
Runningtest:testRotatefalsetruefalse0
Runningtest:testMultiplyIndentitiesfalsetruefalse0
Runningtest:testMultiplyTranslationsfalsetruefalse0
Runningtest:testMultiplyTranslationWithRotationfalsetruefalse0
--failed--(Object:isAssertion:true,message:matrixmultiplyforwardbroken({a:0,b:1,c:-1,d:0,e:10,f:20}!={a:0,b:1,c:-1,d:0,e:-20,f:10}),)falsetruefalse0
Runningtest:testSetTransformfalsetruefalse0
Runningtest:testRotatefalsetruefalse0
Runningtest:testRotateFixedAroundfalsetruefalse0
Runningtest:testCombineTransformfalsetruefalse0
Runningtest:testRotateAroundfalsetruefalse0
Runningtest:testTransformDirectionfalsetruefalse0
Runningtest:testTranslatefalsetruefalse0
Runningtest:testRotatefalsetruefalse0
Runningtest:testMultiplyIndentitiesfalsetruefalse0
Runningtest:testMultiplyTranslationsfalsetruefalse0
Runningtest:testMultiplyTranslationWithRotationfalsetruefalse0
Runningtest:testSetTransformfalsetruefalse0
Runningtest:testRotatefalsetruefalse0
Runningtest:testRotateFixedAroundfalsetruefalse0
Runningtest:testCombineTransformfalsetruefalse0
Runningtest:testRotateAroundfalsetruefalse0
-------------------------------------------falsetruefalse0
invoke1:WorldMorph([[0,0,2000,1200]])falsetruefalse0
status200onGEThttp://lively-kernel.org/repository/webwerkstatt/draft/DraftPointTransformDirection.xhtmlfalsetruefalse0
extendForSerializationundefinedfalsetruefalse0
status204onPUThttp://lively-kernel.org/repository/webwerkstatt/draft/DraftPointTransformDirection.xhtmlfalsetruefalse0
successpublishingworldathttp://lively-kernel.org/repository/webwerkstatt/draft/DraftPointTransformDirection.xhtml,status204falsetruefalse0
statusmsg:worldsavedtoDraftPointTransformDirection.xhtmlin1624msfalsetruefalse0
fontHelvetica16:spacewidth4from20xWidth8falsetruefalse0
Runningtest:testTransformDirectionfalsetruefalse0
Runningtest:testTranslatefalsetruefalse0
Runningtest:testRotatefalsetruefalse0
Runningtest:testMultiplyIndentitiesfalsetruefalse0
Runningtest:testMultiplyTranslationsfalsetruefalse0
Runningtest:testMultiplyTranslationWithRotationfalsetruefalse0
Runningtest:testSetTransformfalsetruefalse0
Runningtest:testRotatefalsetruefalse0
Runningtest:testRotateFixedAroundfalsetruefalse0
Runningtest:testCombineTransformfalsetruefalse0
Runningtest:testRotateAroundfalsetruefalse0
-------------------------------------------falsetruefalse0
invoke1:WorldMorph([[0,0,2000,1200]])falsetruefalse0
status200onGEThttp://lively-kernel.org/repository/webwerkstatt/draft/DraftPointTransformDirection.xhtmlfalsetruefalse0
extendForSerializationundefinedfalsetruefalse0862.0900268554688-1nulltrue0falsetruetruefalse
false1truefalse
nullfalse
nullfalse
nullfalse
nullfalsefalsetruetruefalse
truetrue100false
truefalse050
nullfalsetruenullfalse
Consolefalsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
10000.002465364796093623Wikicontroltrue
10000.00013074434443575452Wikicontroltrue
10008.172360787564877Wikicontroltrue
printMatrix=function(m){varp=0.001return"{a:"+m.a.roundTo(p)+",b:"+m.b.roundTo(p)+",c:"+m.c.roundTo(p)+",d:"+m.d.roundTo(p)+",e:"+m.e.roundTo(p)+",f:"+m.f.roundTo(p)+"}"}TestCase.subclass('lively.Tests.SceneTest.PointTest',{testTransformDirection:function(){vartfm=newlively.scene.Similitude()varp1=pt(10,0);p2=p1.matrixTransformDirection(tfm)this.assertEqualState(p2,p1,"identitytransformbroken")},})TestCase.subclass('lively.Tests.SceneTest.MatrixTest',{setUp:function(){this.sut=newlively.scene.Similitude().toMatrix()},testTranslate:function(){vartfm=this.sut.translate(10,20);varp2=pt(0,0).matrixTransform(tfm);this.assertEqualState(p2,pt(10,20),"matrixtranslatebroken")},testRotate:function(){vartfm=this.sut.rotate(90);varp2=pt(0,10).matrixTransform(tfm);this.assertEqualState(p2.roundTo(0.001),pt(-10,0),"matrixtranslatebroken")},testMultiplyIndentities:function(){vartfm1=newlively.scene.Similitude().toMatrix();vartfm2=newlively.scene.Similitude().toMatrix();vartfm3=tfm1.multiply(tfm2);printMatrix(tfm3)this.assertEqual(printMatrix(tfm3),"{a:1,b:0,c:0,d:1,e:0,f:0}","matrixmultiplybroken")},testMultiplyTranslations:function(){vartfm1=newlively.scene.Similitude().toMatrix();vartfm1=this.sut.translate(10,20);vartfm2=newlively.scene.Similitude().toMatrix();vartfm2=this.sut.translate(30,40);vartfm3=tfm1.multiply(tfm2);this.assertEqual(printMatrix(tfm3),"{a:1,b:0,c:0,d:1,e:40,f:60}","matrixmultiplyforwardbroken")//orderdoesnotplayaroleformultiplyingtranslationsvartfm4=tfm2.multiply(tfm1);this.assertEqual(printMatrix(tfm4),"{a:1,b:0,c:0,d:1,e:40,f:60}","matrixmultiplybackbroken")},testMultiplyTranslationWithRotation:function(){vartfm1=newlively.scene.Similitude().toMatrix();vartfm1=this.sut.translate(10,20);vartfm2=newlively.scene.Similitude().toMatrix();vartfm2=this.sut.rotate(90);vartfm3=tfm1.multiply(tfm2);this.assertEqual(printMatrix(tfm3),"{a:0,b:1,c:-1,d:0,e:10,f:20}","matrixmultiplyforwardbroken")//orderdoesplayaroleformultiplyingtranslationwithrotationvartfm4=tfm2.multiply(tfm1);this.assertEqual(printMatrix(tfm4),"{a:0,b:1,c:-1,d:0,e:-20,f:10}","matrixmultiplybackbroken")},})TestCase.subclass('lively.Tests.SceneTest.RotateMorphTest',{setUp:function(){varname='RotateMorphTestMorph';if($morph(name))$morph(name).remove();this.origin=pt(500,100);this.extent=pt(200,100);this.morph=Morph.makeRectangle(this.origin.extent(this.extent))this.morph.name=name;this.morph.openInWorld()},testSetTransform:function(){varpos=pt(10,20)varnewTfm=newlively.scene.Similitude().toMatrix();newTfm=newTfm.translate(pos.x,pos.y);this.morph.setTransform(newlively.scene.Similitude(newTfm));this.assertEqualState(this.morph.origin.roundTo(0.001),pos)},testRotate:function(){varpos=pt(0,100)vartfm=newlively.scene.Similitude().toMatrix();tfm=tfm.rotate(-90);tfm=tfm.translate(pos.x,pos.y);this.morph.setTransform(newlively.scene.Similitude(tfm));this.assertEqualState(this.morph.origin.roundTo(0.001),pt(100,0))},testRotateFixedAround:function(){//varcenter=pt(600,150)varcenter=pt(100,50)vartfm=newlively.scene.Similitude().toMatrix();tfm=tfm.translate(center.x,center.y);tfm=tfm.rotate(-90)tfm=tfm.translate(-center.x,-center.y);varoldTfm=newlively.scene.Similitude().toMatrix();oldTfm=oldTfm.translate(this.origin.x,this.origin.y);vartfm=oldTfm.multiply(tfm);this.morph.setTransform(newlively.scene.Similitude(tfm));this.assertEqualState(this.morph.origin.roundTo(0.001),pt(550,250))},testCombineTransform:function(){varoldTfm=this.morph.getTransform().toMatrix();varpos=pt(10,20)varnewTfm=newlively.scene.Similitude().toMatrix();newTfm=newTfm.translate(pos.x,pos.y);varnewTfm=newTfm.multiply(oldTfm);this.morph.setTransform(newlively.scene.Similitude(newTfm));this.assertEqualState(this.morph.origin.roundTo(0.001),this.origin.addPt(pos))},testRotateAround:function(){this.assertEqualState(this.morph.origin,pt(500,100),"morphhaswrongorigin")varcenter=pt(600,150);varcenter=pt(100,50);this.morph.rotateAround(-90,center)this.assertEqualState(this.morph.origin.roundTo(0.001),pt(550,250),"rotationbroken")},tearDown:function(){this.morph.remove()}})181truetruefalsetruetruetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
Point.addMethods({matrixTransformDirection:function(mx,acc){if(!acc)acc=pt(0,0);//ifnoaccumulatorpassed,allocateafreshoneacc.x=mx.a*this.x+mx.c*this.y;acc.y=mx.b*this.x+mx.d*this.y;returnacc;},})Morph.addMethods({moveForwardBy:function(amount){varnose=pt(1,0)vardir=nose.matrixTransformDirection(this.getTransform()).normalized();this.moveBy(dir.scaleBy(amount))},//TODO:ThereisabuginSafari(thematrixmultiplicationisthewrongwayaround)//thatisnottakenintoaccounthere....rotateAround:function(angle,center){vartfm=newlively.scene.Similitude().toMatrix();tfm=tfm.translate(center.x,center.y);tfm=tfm.rotate(angle)tfm=tfm.translate(-center.x,-center.y);varoldTfm=this.getTransform().toMatrix();varnewTfm=oldTfm.multiply(tfm);this.setTransform(newlively.scene.Similitude(newTfm));},turnBy:function(angle){this.rotateAround(angle,this.shape.bounds().center())}})//$morph('joe').rotateAround(3,pt(100.9,28.1))//$morph('joe').moveForwardBy(10)//$morph('joe').turnBy(3)40truetruefalsetruetruetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
null86