// ****************************************************************************
//
//  $Id: cisReferenceSegment3D.h,v 1.1.1.1 2001/09/27 20:12:22 anton Exp $
//
//  Description:
//
//  Usage:
//
//  See Also:
//
//  Author(s):	Ofri Sadowsky
//  Created on: 2003-04-01
//
//
//              Developed by the Engineering Research Center for
//          Computer-Integrated Surgical Systems & Technology (CISST)
//
//               Copyright(c) 2001, The Johns Hopkins University
//                          All Rights Reserved.
//
//  Experimental Software - Not certified for clinical use.
//  For use only by CISST sponsored research projects.  For use outside of
//  CISST, please contact Dr. Russell Taylor, CISST Director, at rht@cs.jhu.edu
//  or Dr. Gabor Fichtinger, CISST Engineering Director, at gabor@cs.jhu.edu.
//  
// ****************************************************************************

#ifndef _cisReferenceSegment3D_h
#define _cisReferenceSegment3D_h

#include "cisAbstractSegment3D.h"

// class cisReferenceSegment3D
// Provides a concrete implementation for the cisAbstractSegment3D by storing
// references (pointers) to a pair of vertices. This means that if the
// coordinate values in the referenced cells are changed, an instance of
// cisReferenceSegment3D will re-evaluate the attributes based on the
// new coordinates.
class cisEXPORT cisReferenceSegment3D : public cisAbstractSegment3D
{
public:
	typedef cisAbstractSegment3D::ParametrizationType ParametrizationType;
	typedef cisAbstractSegment3D::AngleType AngleType;
	typedef cisAbstractSegment3D::LocalPointType LocalPointType;
	typedef cisAbstractSegment3D::LocalDirectionType LocalDirectionType;
	typedef cisAbstractSegment3D::GlobalPointType GlobalPointType;
	typedef cisAbstractSegment3D::GlobalDirectionType GlobalDirectionType;

protected:
	const LocalPointType * Vertices[NUM_VERTICES];

public:
	cisReferenceSegment3D(const LocalPointType * p0, const LocalPointType * p1)
	  {
	    Vertices[0] = p1;
	    Vertices[1] = p2;
	  }

	virtual const LocalPointType & GetVertex(unsigned int index) const
	  {
	    assert( (index >= 0) && (index < GetNumVertices()) );
	    return *(Vertices[index]);
	  }

	virtual const LocalPointType & GetVertex0() const
	  {
	    return *(Vertices[0]);
	  }

	virtual const LocalPointType & GetVertex1() const
	  {
	    return *(Vertices[1]);
	  }

	virtual ~cisReferenceSegment3D()
	  {}
};

#endif

