//------------------------------------------------------------
// $Id: sphereObject.h,v 1.3 2000/05/21 18:43:03 yamauchi Exp $
//------------------------------------------------------------
//	sphere object headder
//	1996/3/21 
//	(C) Copyright Hitoshi Yamauchi
//	球
//------------------------------------------------------------
#ifndef _sphereObject_h
#define _sphereObject_h 1

#include "ray.h"
#include "object.h"
#include "Vector3.h"
#include "mpi2exit.h"

class sphereObjectClass : public objBaseClass {
protected:
    Vector3 mCenter;
    double  mRadius;

protected:
    virtual Vector3 getNormal(void) const
    {
	cerr << "Error! : sphereObjectClass::getNormal(void) can't get norm" 
	    << endl;
	commMpi2_exit(1);
	return(Vector3(-1.0, -1.0, -1.0));
    }

public:
    sphereObjectClass(void);
    sphereObjectClass(int objectNumber, int materialID,
		      const Vector3& center, double radius, 
		      const Vector3& spcpos);
    sphereObjectClass(const sphereObjectClass& rhs);    
    const sphereObjectClass& operator=(const sphereObjectClass& rhs);

    // 物体までの距離(if ret PlusInfty =  not hit)
    virtual double getDistance(const Ray *const apRay, Vector3 *pHitPos);

    // friend ostream& operator<<(ostream& s, const sphereObjectClass& rhs); 
    virtual Vector3 getShadedRadiosityColor(const Vector3& hitPos);
    virtual Vector3 getFlatRadiosityColor(const Vector3& hitPos);
    virtual Vector3 getNormal(const Vector3& hitpos) const
    { 
	return((hitpos - this->mCenter).VNormalize());	
    }
    virtual void print(const char *pHead);
    virtual void getMpi2Form(int outtype, char *pRes);
    virtual int  who(void) const;
    virtual YorN checkSpcPos(const Vector3 &partmin, 
			     const Vector3 &subSpcSize,
			     int subdivnum) const;

//------------------------------
// for 2 dimension output 
#ifdef FOR_2DIM_OUT
    virtual int  get2dimPoiNumbers(void) const;
    virtual void get2dimPoint(int idx, double *x, double *y, double *z);
#endif
//------------------------------
};



#endif				// #ifndef _sphereObject_h 
