/****************************************************************************************

		ScrewConstraint.h

		Copyright (c)1990 - 1999 MetaCreations. All rights reserved.

		Author:	Guillaume Chermette

		Date:	11/11/99

		Revision History

		when		who			what & why
		=========== ===========	===========================================================

******************************************************************************************/

#ifndef __ScrewConstraint__
#define __ScrewConstraint__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "Basic3DCOMImplementations.h"
#include "ScrewConstraintDef.h"

//****** Globally Unique Id *************************************************

extern const MCGUID CLSID_ScrewConstraint;


//***************************************************************************

struct ScrewConstraintData
{
	int32	fAxis;			// ID of the axis
	real32	fStep;			// Step of the screw (1 turn -> translation of fStep)
	real32	fFreedomValue; 
};

class ScrewConstraint : public TBasicConstraint 
{
	public :
		ScrewConstraint();
  
		// IUnknown Interface :
		STANDARD_RELEASE;
		
		// I3DExDataExchanger methods :
		virtual void*	 MCCOMAPI GetExtensionDataBuffer		();
		virtual int32	 MCCOMAPI GetParamsBufferSize			() const	{ return sizeof(fData);}
		virtual MCCOMErr MCCOMAPI ExtensionDataChanged			();
		virtual int16	 MCCOMAPI GetResID						();

		// I3DExConstraint methods
		virtual int16 	 MCCOMAPI GetNbrFreedom					() const;
		virtual MCCOMErr MCCOMAPI IncrementFreedomValue			(int16 index, real& increment);
		virtual MCCOMErr MCCOMAPI GetFreedomRange				(int16 index, real& min, real& max) const;
		virtual MCCOMErr MCCOMAPI GetTransform					(TTransform3D& transform)const;
		virtual MCCOMErr MCCOMAPI GetTransformPartialDerivate	(int16 index, TTransform3D& transform) const;
	 	virtual MCCOMErr MCCOMAPI GetMotionLimit				(int16 index, ELimitType& limit) const;

	private :
		ScrewConstraintData fData;         // Screw Link Data

		enum
		{
			kRadioX_id	= IDTYPE('X', 'A', 'X', 'I'), //IDs from .rsr
			kRadioY_id	= IDTYPE('Y', 'A', 'X', 'I'),
			kRadioZ_id	= IDTYPE('Z', 'A', 'X', 'I'),
		};

};


#endif