Handling Tables for Rays with Hits Close to Edges Conventions: Character Meaning ------------------------------------------------------ H Unambiguous hit - clearly untrimmed c Close to trim (within tolerance) - ambiguous hit, may be trimmed + Hit is entering the surface - Hit is leaving the surface ------------------------------------------------------ Hits Per Ray Cases: Different decisions must be made in different situations; here we spell out the various cases and how to handle them. The convention is leftmost H/c character on a line is the first hit point in the sorted hit list, and points to the right are ordered in the order they would be encountered by the ray. Single Hit: Degenerate regardless of ambiguity - reject General Rules for All Multi-Hit Cases: 1. First hit point may only be exiting a surface if it is ambigous - otherwise, return an error. 2. First hit point which is exiting a surface and ambiguous should be disgarded. 3. Last hit point may only be entering a surface if it is ambiguous - otherwise, return error 4. Last hit point which is entering a surface and is ambiguous should be disgarded. 5. If, after application of rules 2 and 4, a hit list contains only a single hit, return an error. 6. If a list contains a sequence of two unambiguous hits that are both entering or both leaving a surface with no ambiguous cases of opposite parity between them, return error. 7. If two unambiguous hit points at the beginning of a ray constitute a valid in/out pair, accept the pair and begin again with list of remaining hit points. Now we come to the more difficult cases. If a non-ambiguous hit point is has no matching non-ambiguous hit point in the list, one or more of the ambiguous points must be used to complete the pair - the reasoning being that the unambiguous hit is proof positive there should be a solid surface, and thus one of the ambiguous points is intended to be a true hit point. Even more difficult is the situation where TWO cracks are hit - in that case, a miss would be returned if an all-ambiguous hit list were ignored. By the same token, multiple ambiguous hits could complicate the situation - a crack may return two hit points and a grazing hit on a trim could return a third, but only the two from the crack are important for ensuring solidity. To ensure this is not a problem, the following steps must be taken: 1. Do a preliminary pass on the hit list looking for pairs of ambiguous hit points with a shared in/out hit status and close 3D space hit coordinates - combine these two ambiguous hit points into a single merged hit point. May want to "average" the normals of the two hits to get an intermediate normal, since the resulting point will not technically be on either surface. 2. Merged hit points have an elevated status as compared to ambiguous points - they will be favored over ambiguous hit points when in/out pair identification is done, but a single unpaired merged point at the end of list processing will be discarded rather than generating an error. Merged points will still rank below unambiguous hit points - given the choice of paring with an unambiguous hit vs a merged hit, pick the unambiguous hit. For some specific examples of these rules, see following tables: Double Hit: Case Decision (H+)(c-) Accept ambiguous hit point Triple Hit: Case Decision (c+)(c+)(H-) If points didn't merge, reject the first ambiguous point, accept the second unless the first shares a surface with the unambiguous point and the second does not. (c+)(c-)(H-) Accept first ambiguous point, reject second (c+)(H+)(c-) Reject first ambiguous point, accept second (c+)(H-)(c-) Accept first ambiguous point, reject second (c+)(H+)(H-) Reject ambiguous point (H+)(c+)(c-) Reject first ambiguous point, accept second (H+)(c+)(H-) Reject ambiguous point (H+)(c-)(c-) If points didn't merge, accept first ambiguous point and reject the second unless the second shares a surface with the unambiguous point and the first does not. (H+)(c-)(H-) Reject ambiguous point