コード例 #1
0
/***************************************************************
 * Adds a lifeform with the specified pattern at the mouse coords
 ***************************************************************/
void Cellular_Automata :: add_lifeform(CA_PATTERN pattern,int mx,int my){
    
    // Round the mouse coordinates to a multiple of the cell diameter
    int x = to_nearest_multiple(mx-x_offset, diameter);
    int y = to_nearest_multiple(my-y_offset, diameter);
    
    // Create a new lifeform at the rounded coords and
    // draw it on the grid 
    CA_Lifeform lifeform(pattern, x, y, diameter);
    draw_lifeform(lifeform);
}
コード例 #2
0
/*
 * Create a new person from the provided stamped pose and point cloud, and insert them into the map.
 */
Person& PersonDetector::create_person(const geometry_msgs::Pose& pose, const sensor_msgs::PointCloud2& cloud) {
	// Make a new person with the trivial person classifier, for now, and then give them an initial pose.
	Person lifeform(_current_uid++);
	lifeform.push_pose(pose);

	// boost::shared_ptr<PersonClassifier> classifier(new ShirtColorPersonClassifier(cloud, 30.0));
	boost::shared_ptr<PersonClassifier> classifier(new TrivialPersonClassifier);

	// Then insert them.
	tracked()[lifeform.uid()] = lifeform;
	classifiers()[lifeform.uid()] = classifier;

	// Return a reference to the person in the map.
	return tracked()[lifeform.uid()];
}