Hi Martin,
> I'm trying to use the example Coop2.java (torus in 3D) and P6_09.java
> (intersection of cube) to create an intersection of the torus.
> Unfortunately I'm having problems with the FlatField.resample method which
> throws an "ManifoldDimension must be 3" exception.
> Debugging shows me that it's thrown in the Gridded3DSet.valueToGrid method,
> it shows DomainDimension == 3 but somehow ManifoldDimension == 2.
In the Field.resample() method, the domain Set of the
Field must have ManifoldDimension == DomainDimension.
To understand why, consider a Set with DomainDimension == 3
and ManifoldDimension == 2, defining a 2-D surface in 3-D.
To resample from this Set to a new sample of another, the
system needs to decide whether the new sample lies on the
2-D surface. But the new surface is not defined analytically
but by afinite number of samples that lie on it. Even if the
system assumed some surface, such as a collection of polygons
connecting the surface samples, new samples would only rarely
lie exactly on those polygons. To do it right, the system
would need to compute the intersections of polygons of the
2-D surface with the polygons (or lines or volume elements,
in 3-D) of the new Set being resmapled to. But then the system
would not resample to the samples of the new Set, but to a set
of sample locations that it would invent, whereas many
applications need to get Field values exactly on the new
samples they pass in the Set argument to resample().
If the domain Set of your Field is a Gridded2DSet, you might
consider constructing a Field with a 2-D domain in "grid
coordinates" (row and column indices into your grid), and then
resampling to a Set with ManifoldDimension = 1 (a line or curve)
in this 2-D domain. Then map back into your original 3-D domain.
It'll be a bit tricky.
Good luck,
Bill