Question: . ( Particle Representation ) Define a data type called Blob in blob.py to represent a particle ( aka blob ) . The data type
Particle Representation Define a data type called Blob in blob.py to represent a particle aka blob The data type must support the following API: Blob Blob constructs an empty blob b baddx y adds a pixel x y to b bmass bdistanceToc strb returns the mass of b ie the number of pixels in it returns the Euclidean distance between the center of mass of b and the center of mass of blob c returns a string representation of b Instance variables: xcoordinate of center of mass, x float ycoordinate of center of mass, y float Number of pixels, pixels int Blob Initialize the instance variables appropriately baddx y Use the idea of running average to update the center of mass of blob b Increment the number of pixels in blob b by bmass Return the number of pixels in the blob b bdistanceToc Return the Euclidean distance between the center of mass of blob b and the center of mass of blob c
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
