public void ObjectHitInfo(
     ObjectRayHit hit,
     ref ObjectHitInfo info
     )
 {
     info.Normal = (hit.RayHit.Point - Sphere3ds[hit.SetObject.Index].Center).Normalized;
 }
        /// <summary>
        /// Create an addtional data structure that contains information
        /// about the hit that is not already part of the IntersectionRayHit.
        /// </summary>
        public ObjectHitInfo GetIntersectionRayHitInfo()
        {
            ObjectHitInfo hitInfo = new ObjectHitInfo();

            SetObject.Set.ObjectHitInfo(this, ref hitInfo);
            return(hitInfo);
        }
Beispiel #3
0
        public void ObjectHitInfo(ObjectRayHit hit, ref ObjectHitInfo hitInfo)
        {
            int oi = hit.SetObject.Index;

            int[] fia = FirstIndexArray, via = VertexIndexArray;
            var   pa = PositionArray;
            int   fvi = fia[oi], fvc = fia[oi + 1] - fvi;

            V3d[] va = new V3d[fvc], ea = new V3d[fvc];
            V3d   p = pa[via[fvi++]], p0 = p;

            va[0] = p;
            for (int fs = 1; fs < fvc; fs++)
            {
                var p1 = pa[via[fvi++]];
                va[fs] = p1; ea[fs - 1] = p1 - p0;
                p1     = p0;
            }
            ea[fvc - 1]    = p - p0;
            hitInfo.Points = va;
            hitInfo.Edges  = ea;
            var faceNormals = FaceAttributeArray <V3d>(Property.Normals);

            if (faceNormals != null)
            {
                hitInfo.Normal = faceNormals[oi];
            }
            else if (fvc > 2)
            {
                hitInfo.Normal = ea[0].Cross(ea[1]).Normalized;
            }
        }
 public void ObjectHitInfo(
     ObjectRayHit hit,
     ref ObjectHitInfo hitInfo
     )
 {
     // this never needs to be called
     hit.SetObject.Set.ObjectHitInfo(hit, ref hitInfo);
 }
        public void ObjectHitInfo(
            ObjectRayHit hit,
            ref ObjectHitInfo info
            )
        {
            List <V3d> pl = Position3dList;
            int        pi = hit.SetObject.Index * 3;

            info.Points = new V3d[3] {
                pl[pi], pl[pi + 1], pl[pi + 2]
            };
            V3d e01 = info.Points[1] - info.Points[0];
            V3d e02 = info.Points[2] - info.Points[0];

            info.Edges = new V3d[2] {
                e01, e02
            };
            info.Normal = V3d.Cross(e01, e02).Normalized;
        }
Beispiel #6
0
 public void ObjectHitInfo(ObjectRayHit hit, ref ObjectHitInfo hitInfo)
 {
     // NO IDEA
 }
Beispiel #7
0
 public void ObjectHitInfo(ObjectRayHit hit, ref ObjectHitInfo hitInfo)
 {
     throw new NotImplementedException();
 }