From df6bab24013e032f7d1b789fa5eceba970d8af71 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 30 Oct 2018 20:10:58 +0000 Subject: give up --- gui/src/chainImage.cpp | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/gui/src/chainImage.cpp b/gui/src/chainImage.cpp index b3be16c..f84f23a 100644 --- a/gui/src/chainImage.cpp +++ b/gui/src/chainImage.cpp @@ -147,12 +147,22 @@ int chainImage::updateOutput(float decayRatio){ (link->getLinkPos().x*cos(getLinkRot()*(PI/180)))-(link->getLinkPos().y*sin(getLinkRot()*(PI/180))), (link->getLinkPos().y*cos(getLinkRot()*(PI/180)))+(link->getLinkPos().x*sin(getLinkRot()*(PI/180))) ); + + float aspectscale; + if (link->getWidth()>0.0f){ + aspectscale=getWidth()/link->getWidth(); + } + else { + aspectscale=1.0f; + } - ofPoint destination=getLinkPos()+(rotated_destination*getLinkScale()); - ofPoint previous=getLinkPos()+(rotated_destination*getLinkScale()*(1.0f-BEZIER_IN)); + ofPoint destination=getLinkPos()+(rotated_destination*getLinkScale()*aspectscale); + ofPoint previous=getLinkPos()+(rotated_destination*getLinkScale()*aspectscale*(1.0f-BEZIER_IN)); + ofPoint first=getLinkPos()+(rotated_destination*getLinkScale()*aspectscale*BEZIER_OUT); path.bezierTo( - getLinkPos().x*(1.0f+(BEZIER_OUT*linkScale)),getLinkPos().y*(1.0f+(BEZIER_OUT*linkScale)) , + getLinkPos().x*(1.0f+(BEZIER_OUT*linkScale*aspectscale)),getLinkPos().y*(1.0f+(BEZIER_OUT*linkScale*aspectscale)), + //first.x,first.y, previous.x,previous.y, destination.x,destination.y); @@ -464,8 +474,22 @@ void chainImage::drawChain(float fadeIn,bool additive,float intensity,float zoom //this is worse why? float zoomFactor=pow(zoomMultiplier,1.0f+transition); - //allow for aspect change - zoomFactor*=(getWidth()/link->getWidth()); + //allow for aspect change - + float aspectfactor=(getWidth()/link->getWidth()); + //works as long as both images are centred at 0,0 + //there's a jump where a movement is introduced so there must be another term to be scaled + + //1 - how does this work? + //the outgoing picture is scaled up if it is wider + //the incoming picture has a fixed relationship to the outgoing + //when transition hits 1.0, the incoming picture is exactly where it will be + //as the outgoing picture at 0.0 + + //2 - what happens when the incoming picture isn't positioned at 0.0? + //we follow a path + //it seems to work if we fix the path in updateOutput() but it only works for 2 images??? + + zoomFactor*=aspectfactor; glScalef(zoomFactor,zoomFactor,zoomFactor); @@ -475,6 +499,10 @@ void chainImage::drawChain(float fadeIn,bool additive,float intensity,float zoom glPopMatrix(); + if (aspectfactor==0.0f){ + aspectfactor=1.0f; + } + glTranslatef(getLinkPos().x,getLinkPos().y,0); glRotatef(getLinkRot(),0,0,1); -- cgit v1.2.3