Quote:
Originally Posted by nikhiljoshi122
I think I am not able to clarify my doubt
Actually My complex shape is similar to underlying image

now if i allow a user to draw a similar shape with pencil tool with high thickness.
How can I measure is the two shapes are similar and if not then ant way of calculating the percentage similarity between two of them.
|
Easy:
Just store for every individual obj (movieClip) properties into an object array.
For example that blob you have.
ActionScript Code:
private var _objectProps : Object = [];
function addObjectProps(targetObject:MovieClip) : void {
var userBlobProps:Object = {
"_userName": userBlobs.userName,
"_width":userBlobs.width,
"_height":userBlobs.height,
"_color":userBlobs.color,
"_rotation":userBlobs.rotation,
"_scaleX":userBlobs.scaleX,
"_scaleY":userBlobs.scaleY
}
_objectProps.push(userBlobProps );
}
So imagine am a user and i provided my name as magicTuscan, and I have created a new blob...via below
ActionScript Code:
private function newBlob() : void {
var thisBlobCreatedByUser: MovieClip = new UserBlob() as MovieClip;
//code to draw and add blob to stage here
userBlobs["userName"] = "magicTuscan";
//after all is done- now attach blob props to array & then you can compare later on!!!
addObjectProps(thisBlobCreatedByUser); // thats it
}
private function compareBlobs() : void {
// do your comparing here
}