| 44 | } |
| 45 | |
| 46 | type B2ShapeInterface interface { |
| 47 | Destroy() |
| 48 | |
| 49 | /// Clone the concrete shape using the provided allocator. |
| 50 | Clone() B2ShapeInterface |
| 51 | |
| 52 | /// Get the type of this shape. You can use this to down cast to the concrete shape. |
| 53 | /// @return the shape type. |
| 54 | GetType() uint8 |
| 55 | |
| 56 | /// Get the type of this shape. You can use this to down cast to the concrete shape. |
| 57 | /// @return the shape type. |
| 58 | GetRadius() float64 |
| 59 | |
| 60 | /// Get the number of child primitives. |
| 61 | GetChildCount() int |
| 62 | |
| 63 | /// Test a point for containment in this shape. This only works for convex shapes. |
| 64 | /// @param xf the shape world transform. |
| 65 | /// @param p a point in world coordinates. |
| 66 | TestPoint(xf B2Transform, p B2Vec2) bool |
| 67 | |
| 68 | /// Cast a ray against a child shape. |
| 69 | /// @param output the ray-cast results. |
| 70 | /// @param input the ray-cast input parameters. |
| 71 | /// @param transform the transform to be applied to the shape. |
| 72 | /// @param childIndex the child shape index |
| 73 | RayCast(output *B2RayCastOutput, input B2RayCastInput, transform B2Transform, childIndex int) bool |
| 74 | |
| 75 | /// Given a transform, compute the associated axis aligned bounding box for a child shape. |
| 76 | /// @param aabb returns the axis aligned box. |
| 77 | /// @param xf the world transform of the shape. |
| 78 | /// @param childIndex the child shape |
| 79 | ComputeAABB(aabb *B2AABB, xf B2Transform, childIndex int) |
| 80 | |
| 81 | /// Compute the mass properties of this shape using its dimensions and density. |
| 82 | /// The inertia tensor is computed about the local origin. |
| 83 | /// @param massData returns the mass data for this shape. |
| 84 | /// @param density the density in kilograms per meter squared. |
| 85 | ComputeMass(massData *B2MassData, density float64) |
| 86 | } |
| 87 | |
| 88 | type B2Shape struct { |
| 89 | M_type uint8 |
no outgoing calls
no test coverage detected