[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

intersection of enclosures



A few weeks ago Mark'M and I discussed the definition of intersection
for enclosures.  I came up with a semantics based on discovering
what's shared between the two enclosure: 

define an enclosure as a Dsp and a region in the coordinate system
defined by the Dsp.  The intersection of two enclosures A and B is the
Dsp shared by DspA and DspB and the region which is the intersection
of the transformation of the two original regions into the newly
defined coordinate space (by the shared Dsp). There is a definition
below.  Warning: the untransform operations might have to be transform
operations, I don't want to figure out now.

Enclosure * intersect(Enclosure * enclA, Enclosure * enclB) {
	PartiallyOrdered * dspC;

	dspC = enclA ->dsp() ->sharedWith(enclB ->dsp());
	return Enclosure(dspC,
	    intersect(regionA ->unTransform(enclA ->dsp() ->minus(dspC)),
		      regionB ->unTransform(enclB ->dsp() ->minus(dspC))));
}

Since my original idea for enclosures came from the Medium (now Warp)
manipulation stuff I did for Viewers, it finally struck me that I
already had a definition of intersect that is fairly clean and is
quite a bit more useful.

Enclosure * intersect(Enclosure * enclA, Enclosure * enclB) {
	return Enclosure(enclA ->dsp(),
	    intersect(regionA, regionB 
			->unTransform(enclB ->dsp() ->minus(enclA ->dsp()))));
}

The intersection of two enclosures in the intersection of region A and
the projection of region B into the coordinate system of enclosure A,
all set in the coordinate system of enclosure A.  Notice that this
makes intersection non-commutative, but only in the coordinate system
of the result.  The actual region cooresponding to the enclosure
(transform the enclosure's region by its dsp) is identical in either
case.

The new definition of intersect allows me to apply operations to an
enclosure that always produce results in the same coordinate system.
I think unionWith() should have the same property (commutative only
wrt the enclosures defined region).

dean