/* plotThreeD.m  by Mike Gravina	April 1992
 * Category extension to Plot class dealing with 3D plots
 *
 * Copyright (C)  1992, 1993  The Board of Trustees of
 * The Leland Stanford Junior University. All Rights Reserved.
 */

#import "Draw.subproj/draw.h"
#import "Plot.h"

const char plotThreeD_m_rcsid[] = "$Id: plotThreeD.m,v 2.7.2.1 1994/01/05 02:23:28 rensing Exp $";

#import "HGraphicView.h"
#import "InspectPlot.h"
#import "h3D.h"

@implementation Plot(ThreeD)

- mouseMoved:(const NXPoint *)offset withKey:(int *)flag
{
	[inspector mouseMoved:offset in:self withKey:*flag];
	return self;
}

- reset3D
{
    h3D_resetAngles(disp);
    return self;
}

- newGray3D:(grayValue_t *)grayValue
{
    disp->color[grayValue->faceNo] = grayValue->value;
    return self;
}

- newTheta3D:(float *)angle
{
    NXEvent            *thisEvent;
    threeD_t	       *threeD;  	  

    disp->theta = *angle;
    threeD = disp->threeDWorkArea;
    if (threeD != NULL) {
    	thisEvent = [NXApp currentEvent];
	if ((thisEvent->type == NX_MOUSEDOWN) ||
	    (thisEvent->type == NX_MOUSEDRAGGED)){    
	    disp->doSpeedy = YES;	
	} else {
	    disp->doSpeedy = NO;
	}    
    }
    h3D_newTheta(disp);
    return self;
}

- newPhi3D:(float *)angle
{
    NXEvent            *thisEvent;
    threeD_t	       *threeD;  	  

    disp->phi = -*angle;
    threeD = disp->threeDWorkArea;
    if (threeD != NULL) {
    	thisEvent = [NXApp currentEvent];
	if ((thisEvent->type == NX_MOUSEDOWN) ||
	    (thisEvent->type == NX_MOUSEDRAGGED)){    
	    disp->doSpeedy = YES;
	} else {
	    disp->doSpeedy = NO;
	}    
    }
    h3D_newPhi(disp);
    return self;
}

- newDist3D:(float *)distance
{
    NXEvent            *thisEvent;
    threeD_t	       *threeD;  	  

    disp->dist = *distance;
    threeD = disp->threeDWorkArea;
    if (threeD != NULL) {
    	thisEvent = [NXApp currentEvent];
	if ((thisEvent->type == NX_MOUSEDOWN) ||
	    (thisEvent->type == NX_MOUSEDRAGGED)){    
	    disp->doSpeedy = YES;
	} else {
	    disp->doSpeedy = NO;
	}    
    }
    h3D_newDist(disp);
    return self;
}

- toggleCube3D:(BOOL *)state
{
   disp->doCube = *state;
    return self;
}

- toggleWireFrame3D:(BOOL *)state
{
    disp->doWireFrame = *state;
    return self;
}

- toggleFill3D:(BOOL *)state
{
    disp->doFill = *state;
    return self;
}

- toggleMesh3D:(BOOL *)state
{
    disp->doMesh = *state;
    return self;
}

@end