1
$\begingroup$

I am creating a cylinder, whose center disk is placed at position vector v1 and whose orientation is given by the disk's normal vector n1. The second object is a disk, embedded in the same box, but since I don't know how to draw disks in $3D$ in Mathematica, I use a very thin cylinder to approximate the disk, which is placed at v2 and orientation n2. Both have diameter d=4. Here's the setup:

v1 = {0.5, 0.5, 0.5};
n1 = {1, 1, 1};
v2 = {1, 1.5, 0};
n2 = {1, 1, 0};
d = 4;

ef1 = 5; (*elongation factor of cylinder 1 to find endpoints to draw*)
\
ef2 = 0.00001; (*elongation factor of cylinder 2, to approximate disk*)
\
cyl1 = Cylinder[{v1 - ef1*n1, v1 + ef1*n1}, d/2];
cyl2 = Cylinder[{v2 - ef2*n2, v2 + ef2*n2}, d/2];

And drawn together: Graphics3D[{Opacity[.5], cyl1, cyl2}]:

enter image description here

As we see in the image, the cylinder is crossing a portion of the disk, and I'm trying to learn if:

  • Is there way a to compute the area of the disk that is in intersection with the crossing cylinder? A naive approach using Area@RegionIntersection[cyl1, cyl2] seems not to work (returns Undefined).
$\endgroup$
2
  • $\begingroup$ If the axes of the cylinders are given by n1, n2 you should correct your formulas to cyl1 = Cylinder[{v1 - ef1*n1, v1 + ef1*n1}, d/2];cyl2 = Cylinder[{v2 - ef2*n2, v2 + ef2*n2}, d/2]; $\endgroup$ Commented Nov 27, 2019 at 13:38
  • $\begingroup$ @UlrichNeumann Done, thanks for spotting the typo! $\endgroup$
    – user52181
    Commented Nov 27, 2019 at 13:43

1 Answer 1

3
$\begingroup$

You consider tw0 3D-regions, that's why its onlye possible to calculate a volume!

Try

dV=Volume@RegionIntersection[cyl1, cyl2]
(*0.000249282 *) 

To get an approximation of the disk area divison by the thickness of your pseudo-disc gives the result!

addendum The workaround cyl2 isn't necessary. Try

disk = ImplicitRegion[({x, y, z} - v2).n2 == 0&&Norm[{x, y, z} - v2] <= d/2, {x, y, z}]
dA = RegionIntersection[cyl1, disk] 
Area@dA        
(*8.81346*)
$\endgroup$
7
  • $\begingroup$ Ah indeed, that makes sense now! By the way, didn't you mean to write RegionIntersection instead of RegionDifference? Computationally, is my approach with pseudo-discs as defined here a bit of overkill for estimating the intersection? $\endgroup$
    – user52181
    Commented Nov 27, 2019 at 13:51
  • $\begingroup$ You're right, I modified my answer! $\endgroup$ Commented Nov 27, 2019 at 13:59
  • $\begingroup$ Many thanks! In case you are interested, this question originated from discussions here. $\endgroup$
    – user52181
    Commented Nov 27, 2019 at 14:19
  • $\begingroup$ You're welcome, I'll have a look at the link. $\endgroup$ Commented Nov 27, 2019 at 14:23
  • $\begingroup$ Dear Ulrich, do you reckon our approach (using RegionIntersection) could be sped up if we didn't create the cylinder as we do currently, and instead used e.g. an implicit definition of it? I mean I assume RegionIntersection is the bottleneck here and it performs slower the larger ef1 is. $\endgroup$
    – user52181
    Commented Nov 28, 2019 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.