Exemple #1
0
        /**
         * Intersect
         *
         * @param ray
         * @param pt
         * @return boolean
         */
        public override bool Intersect(Ray ray, IntersectPt pt)
        {
            double vd = Normal.Dot(ray.GetDirection());
            double vo, t;
            Vector origVec = new Vector(ray.GetOrigin().GetX(), ray.GetOrigin().GetY(), ray.GetOrigin().GetZ());

            if (vd == 0.0f)
            {
                return(false);
            }
            vo = -Normal.Dot(origVec) - D;
            t  = vo / vd;
            if (t < pt.GetThreshold())
            {
                return(false);
            }
            pt.GetIntersection().Combine(ray.GetOrigin(), ray.GetDirection(), 1.0f, t);
            if (!Check(ray, pt))
            {
                return(false);
            }
            pt.SetT(t);
            pt.SetIntersectObj(this);
            if (GetObjID() == pt.GetOriginal())
            {
                pt.SetEnter(false);
            }
            else
            {
                pt.SetEnter(true);
            }
            GetCachePt().Set(ray.GetID(), pt);
            return(true);
        }
Exemple #2
0
	/**
	 * SetIsectPt
	 *
	 * @param isectpt
	 */
	protected void SetIsectPt(IntersectPt isectpt)
	{
		t = isectpt.GetT();
		Enter = isectpt.GetEnter();
		IntersectObj = isectpt.GetIntersectObj();
		OriginalObjID = isectpt.GetOriginal();
		Intersection.Set(isectpt.GetIntersection().GetX(), isectpt.GetIntersection().GetY(), isectpt.GetIntersection().GetZ());
	}
Exemple #3
0
 /**
  * SetIsectPt
  *
  * @param isectpt
  */
 protected void SetIsectPt(IntersectPt isectpt)
 {
     t             = isectpt.GetT();
     Enter         = isectpt.GetEnter();
     IntersectObj  = isectpt.GetIntersectObj();
     OriginalObjID = isectpt.GetOriginal();
     Intersection.Set(isectpt.GetIntersection().GetX(), isectpt.GetIntersection().GetY(), isectpt.GetIntersection().GetZ());
 }
Exemple #4
0
	/**
	 * Intersect
	 *
	 * @param ray
	 * @param pt
	 * @return boolean
	 */
	public override bool Intersect(Ray ray, IntersectPt pt)
	{
		double vd = Normal.Dot(ray.GetDirection());
		double vo, t;
		Vector origVec = new Vector(ray.GetOrigin().GetX(), ray.GetOrigin().GetY(), ray.GetOrigin().GetZ());

		if(vd == 0.0f)
		{
			return (false);
		}
		vo = -Normal.Dot(origVec) - D;
		t = vo / vd;
		if(t < pt.GetThreshold())
		{
			return (false);
		}
		pt.GetIntersection().Combine(ray.GetOrigin(), ray.GetDirection(), 1.0f, t);
		if(!Check(ray, pt))
		{
			return (false);
		}
		pt.SetT(t);
		pt.SetIntersectObj(this);
		if(GetObjID() == pt.GetOriginal())
		{
			pt.SetEnter(false);
		}
		else
		{
			pt.SetEnter(true);
		}
		GetCachePt().Set(ray.GetID(), pt);
		return (true);
	}