X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=akamaru.c;h=22b247736717e1b044216ad0763e136168a31044;hb=4e16902eb4a956c7ea79cb4d7f7e56419ea29012;hp=1d94281b269fc936dbeaa830ae44ab4e6e5fbcd1;hpb=6923ae2757901728f2bc4ef2162ca5d14ecfbd14;p=akamaru diff --git a/akamaru.c b/akamaru.c index 1d94281..22b2477 100644 --- a/akamaru.c +++ b/akamaru.c @@ -24,6 +24,50 @@ const double elasticity = 0.7; const double friction = 1; const double gravity = 20; +void +object_init (Object *object, double x, double y, double mass) +{ + object->position.x = x; + object->position.y = y; + object->previous_position.x = x; + object->previous_position.y = y; + object->mass = mass; +} + +void +spring_init (Spring *spring, Object *a, Object *b, double length) +{ + spring->a = a; + spring->b = b; + spring->length = length; +} + +void +stick_init (Stick *stick, Object *a, Object *b, double length) +{ + stick->a = a; + stick->b = b; + stick->length = length; +} + +void +string_init (String *string, Object *a, Object *b, double length) +{ + string->a = a; + string->b = b; + string->length = length; +} + +void +offset_spring_init (OffsetSpring *spring, Object *a, Object *b, + double dx, double dy) +{ + spring->a = a; + spring->b = b; + spring->dx = dx; + spring->dy = dy; +} + void polygon_init (Polygon *p, int num_points, ...) {