X-Git-Url: https://git.cworth.org/git?p=akamaru;a=blobdiff_plain;f=akamaru.h;h=77f8d580646a4acf3ef09003295238fa50d4f18f;hp=bfec60f70e36f99926e78188c492430d58124f64;hb=HEAD;hpb=9bdb07522bfbb2611a7e70f1204d96b98bc0e615 diff --git a/akamaru.h b/akamaru.h index bfec60f..77f8d58 100644 --- a/akamaru.h +++ b/akamaru.h @@ -12,6 +12,8 @@ typedef struct _Stick Stick; typedef struct _String String; typedef struct _Spring Spring; typedef struct _OffsetSpring OffsetSpring; +typedef struct _Spacer Spacer; +typedef struct _Anchor Anchor; typedef struct _Polygon Polygon; typedef struct _Offset Offset; typedef struct _Model Model; @@ -53,11 +55,21 @@ struct _OffsetSpring { int dx, dy; }; +struct _Spacer { + Object *a, *b; + int length; +}; + +struct _Anchor { + Object *object; + double x, y; +}; + struct _Polygon { int num_points; Point *points; Vector *normals; - int edge; + int enclosing; }; struct _Model { @@ -73,21 +85,35 @@ struct _Model { Spring *springs; int num_offset_springs; OffsetSpring *offset_springs; + int num_spacers; + Spacer *spacers; + int num_anchors; + Anchor *anchors; int num_polygons; Polygon *polygons; double k; double friction; - Object *anchor_object; - Vector anchor_position; + Anchor mouse_anchor; double theta; }; -void polygon_init (Polygon *p, int num_points, ...); +void object_init (Object *object, double x, double y, double mass); +void offset_spring_init (OffsetSpring *spring, + Object *a, Object *b, double dx, double dy); +void spring_init (Spring *spring, Object *a, Object *b, double length); +void stick_init (Stick *stick, Object *a, Object *b, double length); +void string_init (String *string, Object *a, Object *b, double length); +void spacer_init (Spacer *spacer, Object *a, Object *b, double length); +void anchor_init (Anchor *anchor, Object *object, double x, double y); + +void polygon_init (Polygon *p, int enclosing, int num_points, ...); void polygon_init_diamond (Polygon *polygon, double x, double y); void polygon_init_rectangle (Polygon *polygon, double x0, double y0, double x1, double y1); +void polygon_init_enclosing_rectangle (Polygon *polygon, double x0, double y0, + double x1, double y1); void model_fini (Model *model);