/* obj.h -- ASpringies object handling - defines, types and external variables
 * Copyright (C) 1991  Douglas M. DeCarlo
 *
 * Modifications for the Amiga port Copyright (C) 1994  Torsten Klein
 *
 * This file is part of ASpringies, a mass and spring simulation system for the Amiga
 *
 * ASpringies is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 1, or (at your option)
 * any later version.
 *
 * ASpringies is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ASpringies; see the file COPYING.  If not, write to
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: obj.h,v 1.4 1994/06/26 20:48:28 Torsten_Klein Exp $
 */

#define S_ALIVE		0x01
#define S_SELECTED	0x02
#define S_FIXED		0x04
#define S_TEMPFIXED	0x08

#define ALLOC_SIZE	32

typedef struct {
    /* Current position, velocity, acceleration */
    double x, y;
    double vx, vy;
    double ax, ay;

    /* Mass and radius of mass */
    double mass;
    double elastic;
    int radius;

    /* Connections to springs */
    int *pars;
    int num_pars;

    int status;

    /* RK temporary space */
    double cur_x, cur_y, cur_vx, cur_vy;
    double old_x, old_y, old_vx, old_vy;
    double test_x, test_y, test_vx, test_vy;
    double k1x, k1y, k1vx, k1vy;
    double k2x, k2y, k2vx, k2vy;
    double k3x, k3y, k3vx, k3vy;
    double k4x, k4y, k4vx, k4vy;
} mass;

typedef struct {
    /* Ks, Kd and rest length of spring */
    double ks, kd;
    double restlen;

    /* Connected to masses m1 and m2 */
    int m1, m2;

    int status;
} spring;

extern mass *masses;
extern spring *springs;
extern int num_mass, num_spring, fake_mass, fake_spring;

