#include <collision_outline.h>
Attributes | |
| const CL_Contour & | get_object_bounding_box () const |
| Returns the contour used as an object bounding box. (an rotated rectangle). | |
| CL_Circlef | get_minimum_enclosing_disc () const |
| Returns the radius of the outline. | |
| bool | get_inside_test () const |
| Returns true if completely-inside test is used. | |
| std::vector< CL_Contour > & | get_contours () |
| Returns the contours in the outline. | |
| const std::vector< CL_Contour > & | get_contours () const |
| CL_Pointf | get_translation () const |
| Returns the position of the outline. | |
| CL_Pointf | get_scale () const |
| Returns the scaling factor. | |
| float | get_angle () const |
| Returns the rotation angle. | |
| unsigned int | get_width () const |
| Returns the width of the image this outline was created from. | |
| unsigned int | get_height () const |
| Returns the height of the image this outline was created from. | |
| void | get_alignment (CL_Origin &origin, float &x, float &y) const |
| Get the translation origin and hotspot of the outline. | |
| void | get_rotation_hotspot (CL_Origin &origin, float &x, float &y) const |
| Get the rotation hotspot of the outline. | |
| const std::vector< CL_CollidingContours > & | get_collision_info () const |
| Return the info about the collisions. (collision points, normals, pointers to contours, and indexes to lines that intersected). | |
| void | get_collision_info_state (bool &points, bool &normals, bool &metadata, bool &pendepth) const |
| Fetch the state of the collision testing variables. | |
| CL_Resource | resource |
| Resource owning this outline, if any. | |
Operations | |
| void | load (const CL_StringRef &fullname) |
| Load the outline from file replacing the current data. | |
| void | load (const CL_StringRef &filename, const CL_VirtualDirectory &directory) |
| Load. | |
| void | load (CL_IODevice &file) |
| Load. | |
| CL_CollisionOutline & | copy (const CL_CollisionOutline &other) |
| Copy. | |
| void | optimize (unsigned char check_distance=3, float corner_angle=CL_PI/5.0) |
| Optimize the outline by removing redundant points. | |
| void | draw (float x, float y, const CL_Colorf &color, CL_GraphicContext &gc) |
| Draw outline on graphic context. | |
| void | draw_sub_circles (float x, float y, const CL_Colorf &color, CL_GraphicContext &gc) |
| Draw the subcircles surrounding the linesegments on graphic context. | |
| void | draw_smallest_enclosing_disc (float x, float y, const CL_Colorf &color, CL_GraphicContext &gc) |
| Draw the disc enclosing the entire outline. | |
| void | set_alignment (CL_Origin origin, float x=0, float y=0) |
| Set the translation hotspot of the outline. | |
| void | set_rotation_hotspot (CL_Origin origin, float x=0, float y=0) |
| Set the rotation hotspot of the outline. | |
| void | set_translation (float x, float y) |
| Set the position of the outline. | |
| void | set_scale (float x, float y) |
| Set the scale of the outline. | |
| void | set_angle (const CL_Angle &angle) |
| Set the angle (in degrees) of the outline. | |
| void | rotate (const CL_Angle &angle) |
| Rotate the outline by angle (in degrees). | |
| void | set_inside_test (bool value) |
| Set to true if completely-inside test should be done. | |
| void | enable_collision_info (bool points=true, bool normals=false, bool metadata=false, bool pen_depth=false) |
| Enable collision info gathering. | |
| void | set_collision_info (const std::vector< CL_CollidingContours > &colinfo) |
| This will set the collision info of the outline. | |
| void | clean_collision_info () |
| This will empty the collision-info vector. | |
| void | calculate_radius () |
| (Re)calculate the radius of the outline. | |
| void | calculate_sub_circles (float radius_multiplier=3.5) |
| (Re)calculate the subcircle segmentation of the outline. | |
| void | calculate_smallest_enclosing_discs () |
| (Re)calculate the smallest circles enclosing every contour in the outline. | |
| void | calculate_convex_hulls () |
| (Re)calculate the convex hull for every contour in the outline | |
| void | save (const CL_StringRef &fullname) const |
| Write the outline to a file. | |
| void | save (const CL_StringRef &filename, CL_VirtualDirectory &directory) const |
| Save. | |
| void | save (CL_IODevice &file) const |
| Save. | |
| bool | collide (const CL_CollisionOutline &outline, bool remove_old_collision_info=true) |
| Returns true if outlines overlap. | |
| bool | point_inside (const CL_Pointf &point) const |
| Returns true if a point is inside the outline. | |
| static void | calculate_penetration_depth (std::vector< CL_CollidingContours > &collision_info) |
| Will calculate the penetration_depth and penetration_normal for all colliding contours. | |
Public Member Functions | |
Construction | |
| CL_CollisionOutline () | |
| Construct a collision outline. | |
| CL_CollisionOutline (const CL_PixelBufferRef &pbuf, int alpha_limit=128, CL_OutlineAccuracy accuracy=accuracy_medium) | |
| Construct a collision outline. | |
| CL_CollisionOutline (const CL_StringRef &fullname, int alpha_limit=128, CL_OutlineAccuracy accuracy=accuracy_medium, bool get_insides=true) | |
| Construct a collision outline. | |
| CL_CollisionOutline (CL_IODevice &file, const CL_String &file_extension, int alpha_limit=128, CL_OutlineAccuracy accuracy=accuracy_medium, bool get_insides=true) | |
| Constructs a CollisionOutline. | |
| CL_CollisionOutline (const CL_StringRef &filename, const CL_VirtualDirectory &directory, int alpha_limit=128, CL_OutlineAccuracy accuracy=accuracy_medium, bool get_insides=true) | |
| Constructs a CollisionOutline. | |
| CL_CollisionOutline (const CL_StringRef &resource_id, CL_ResourceManager *manager) | |
| Construct a collision outline. | |
| CL_CollisionOutline (std::vector< CL_Contour > contours, int width, int height) | |
| Construct a collision outline. | |
| ~CL_CollisionOutline () | |
A collision outline is used in collision detection
|
|
Construct a collision outline.
|
|
||||||||||||||||
|
Construct a collision outline.
|
|
||||||||||||||||||||
|
Construct a collision outline.
|
|
||||||||||||||||||||||||
|
Constructs a CollisionOutline.
|
|
||||||||||||||||||||||||
|
Constructs a CollisionOutline.
|
|
||||||||||||
|
Construct a collision outline.
|
|
||||||||||||||||
|
Construct a collision outline.
|
|
|
|
|
|
(Re)calculate the convex hull for every contour in the outline
|
|
|
Will calculate the penetration_depth and penetration_normal for all colliding contours.
|
|
|
(Re)calculate the radius of the outline.
|
|
|
(Re)calculate the smallest circles enclosing every contour in the outline.
|
|
|
(Re)calculate the subcircle segmentation of the outline.
|
|
|
This will empty the collision-info vector.
|
|
||||||||||||
|
Returns true if outlines overlap.
|
|
|
Copy.
|
|
||||||||||||||||||||
|
Draw outline on graphic context. Actual rendering position depends on the anchor and the alignment mode.
|
|
||||||||||||||||||||
|
Draw the disc enclosing the entire outline. Actual rendering position depends on the anchor and the alignment mode.
|
|
||||||||||||||||||||
|
Draw the subcircles surrounding the linesegments on graphic context. Actual rendering position depends on the anchor and the alignment mode.
|
|
||||||||||||||||||||
|
Enable collision info gathering.
|
|
||||||||||||||||
|
Get the translation origin and hotspot of the outline.
|
|
|
Returns the rotation angle.
|
|
|
Return the info about the collisions. (collision points, normals, pointers to contours, and indexes to lines that intersected).
|
|
||||||||||||||||||||
|
Fetch the state of the collision testing variables.
|
|
|
|
|
|
Returns the contours in the outline.
|
|
|
Returns the height of the image this outline was created from.
|
|
|
Returns true if completely-inside test is used.
|
|
|
Returns the radius of the outline. float get_radius() const; |
|
|
Returns the contour used as an object bounding box. (an rotated rectangle).
|
|
||||||||||||||||
|
Get the rotation hotspot of the outline.
|
|
|
Returns the scaling factor.
|
|
|
Returns the position of the outline.
|
|
|
Returns the width of the image this outline was created from.
|
|
|
Load.
|
|
||||||||||||
|
Load.
|
|
|
Load the outline from file replacing the current data. Loads precompiled outlines |
|
||||||||||||
|
Optimize the outline by removing redundant points.
|
|
|
Returns true if a point is inside the outline.
|
|
|
Rotate the outline by angle (in degrees).
|
|
|
Save.
|
|
||||||||||||
|
Save.
|
|
|
Write the outline to a file.
|
|
||||||||||||||||
|
Set the translation hotspot of the outline.
|
|
|
Set the angle (in degrees) of the outline.
|
|
|
This will set the collision info of the outline.
|
|
|
Set to true if completely-inside test should be done.
|
|
||||||||||||||||
|
Set the rotation hotspot of the outline.
|
|
||||||||||||
|
Set the scale of the outline.
|
|
||||||||||||
|
Set the position of the outline.
|
|
|
Resource owning this outline, if any.
|
1.4.6