
/* Generated by Interface Builder */

#import "Car_main.h"
#import "Wheels.h"
#import "Car.h"

@implementation Wheels

- init
{
    [super init];
    wheel = self;
    return self;
}

- read:(NXTypedStream *)stream
{
    [super read:stream];
    NXReadTypes(stream,"fff",&diameter,&mass,&rollingResistance);
    return self;
}

- write:(NXTypedStream *)stream
{
    [super write:stream];
    NXWriteTypes(stream,"fff",&diameter,&mass,&rollingResistance);
    return self;    
}

- (float)diameter
{
    return diameter;
}

- setDiameter:(float)aNumber
{
    diameter = aNumber;
    return self;
}

- (float)mass
{
    return mass;
}

- setMass:(float)aNumber
{
    mass = aNumber;
    return self;
}

- (float)rollingResistance
{
    return rollingResistance;
}

- setRollingResistance:(float)aNumber
{
    rollingResistance = aNumber;
    return self;
}

- (float)speed
{
float carSpeed;
float angVelocity;

    carSpeed = [car currentVelocity];
    angVelocity = carSpeed / ( diameter / 2 );
    return angVelocity;
}

- inputTorque:(float)torque
{
float force;

    force = torque / ( diameter / 2 );
    [car setRoadForce:force];
    return self;
}

@end
