//
//  MPT_Face.m
//  AUCoderDemo
//
//  Created by Andrew Salamon on 6/29/06.
//  Copyright 2006 __MyCompanyName__. All rights reserved.
//

#import "MPT_Face.h"


@implementation MPT_Face
- (id)initWithFace:(NSRect)_face left:(NSPoint)_left right:(NSPoint)_right
{
	if( self = [super init] )
	{
		[self setFace:_face];
		[self setLeftEye:_left];
		[self setRightEye:_right];
	}
	return self;
}

- (NSRect)face
{
    return face;
}

- (void)setFace:(NSRect)value
{
    face = value;
}

- (NSPoint)leftEye
{
    return leftEye;
}

- (void)setLeftEye:(NSPoint)value
{
    leftEye = value;
}

- (NSPoint)rightEye
{
    return rightEye;
}

- (void)setRightEye:(NSPoint)value
{
    rightEye = value;
}

- (float)headTilt
{
	float opposite = leftEye.y - rightEye.y;
	float adjacent = leftEye.x - rightEye.x;
	float angle = atan( opposite / adjacent ); // in radians
	return angle * 57.2957795; // (180.0*(r)/M_PI)
}
@end
