triggers for a drawing tool ( code) :
The main trigger for events are holes. Triggers are dependent on which side (left or right) the hole is found.
The actual effect of the drawing tool needs some work since I haven't been able to get quite the right effect yet, but it's an interesting start.
|
/* these are the main triggering functions */
for(int b = 0; b < contourFinder.nBlobs; b++){
if(!contourFinder.blobs[b].hole){
centx = contourFinder.blobs[b].centroid.y;
centy = contourFinder.blobs[b].centroid.x;
break;
}
}
if(rightTrigger){
for(int i = 0; i < 320; i++){
for(int j = 0; j < 240; j++){
int i_off = abs(int(1.02*(centx - i)));
int j_off = abs(int(0.99*(centy - j)));
pixelator2[i * 240 + j] = pixelator[(i - i_off) * 240 + j - j_off];
}
}
}
if(leftTrigger){
for(int i = 0; i < 320; i++){
for(int j = 0; j < 240; j++){
int i_off = abs(int(0.99*(centx - i)));
int j_off = abs(int(0.98*(centy - j)));
pixelator2[i * 240 + j] = pixelator[(i + int(i_off/(1+j_off))) * 240 + j + 0*j_off];
}
}
}
|