Difference between revisions of "Extrusion Edge Cases"

From Web3D.org
Jump to: navigation, search
Line 23: Line 23:
 
=== Collinear spines ===
 
=== Collinear spines ===
  
1. The wording for generating the first (and only) SCP for collinear spines is unclear; specifically, "rotation along the axis" is a funny notion. I can imagine a translation along the axis and a rotation around an axis, but not a "rotation along something". Here's how I understand it: you calculate a rotation that takes the vector (0,1,0) to the spine direction vector (the first nonnull spine segment), then you apply the same rotation to the vector (0,0,1), and that's the Z for the SCP. Notably, that's *not* how the popular X3DOM implementation treats those cases.
+
If the spine is collinear (and thus allows for no SCP-Z calculation), the standard calls for generating the SCP in the following manner:
  
2. If the above interpretation is right, the algorithm is ill defined if the spine goes in the negative Y direction. The rotation between (0,1,0) and (0,-1,0) is not uniquely defined, and the resultant SCP Z can be anywhere in the XZ plane.
+
A. The direction of the spine is determined (as a vector)
 +
B. The rotation that takes the vector (0,1,0) to the said vector is calculated
 +
C. This rotation is applied to vectors (1,0,0) and (0,0,1), and those are the X and Z axes of the SCP.
 +
 
 +
There are some problems with that algorithm.
 +
 
 +
1. If the vector in step A happens to be (0,-1,0), the rotation in step B is not unique.
 +
 
 +
2. If the spine goes: (0,0,0) - (0,1,0) - (0,0,0), it's collinear, but the standard doesn't specify what constitutes the "spine direction". Common sense suggests the first nonzero length spine segment, but the standard doesn't say so.
 +
 
 +
Also, it's worth noting that the popular implementations out there don't follow those rules.
  
 
== Possible solutions ==
 
== Possible solutions ==

Revision as of 14:05, 28 October 2015

The Extrusion node specification has ambiguities [1]

This wiki page supports discussion on the x3d-public mailing list regarding Extrusion specification edge cases that make consistent modeling difficult.

Problem issues

The algorithm for generating the spine-aligned cross section plane (SCP) is ambiguous, hard to follow, sometimes ill-defined.

Coincident Spine Points

Conincident spine points are allowed under the spec.

1. The algorithm for generating Y for the SCP is ill defined if three spine points in a row are coincident. In the spirit of the spec, reusing the last value of Y makes sense, but the spec doesn't say so.

2. The algorithm for generating Y for the SCP at the first point of an open spine is ill defined if the first two spine points are coincident. Similarly, one may employ look-ahead to the first non-null spine segment, but the spec doesn't say so.

Conincident Spine Points with a Bend

Consider the following spine:

(0,0,0) - (0,1,0) - (0,1,0) - (0,1,1)

Collinear spines

If the spine is collinear (and thus allows for no SCP-Z calculation), the standard calls for generating the SCP in the following manner:

A. The direction of the spine is determined (as a vector) B. The rotation that takes the vector (0,1,0) to the said vector is calculated C. This rotation is applied to vectors (1,0,0) and (0,0,1), and those are the X and Z axes of the SCP.

There are some problems with that algorithm.

1. If the vector in step A happens to be (0,-1,0), the rotation in step B is not unique.

2. If the spine goes: (0,0,0) - (0,1,0) - (0,0,0), it's collinear, but the standard doesn't specify what constitutes the "spine direction". Common sense suggests the first nonzero length spine segment, but the standard doesn't say so.

Also, it's worth noting that the popular implementations out there don't follow those rules.

Possible solutions

Resolved issues

References

Resources