Triangle area in sphere

I have a triangle that intersects with the sphere

How to count triangle area, which is in sphere?

If you have solution for polygon too, it's awesome.

• Could you please provide some code with the above description. It would also be useful if you could give an example output you'd want to achieve :) – e.doroskevic Jan 12 '17 at 16:38
• By basic common sense the intersection of a plane and a sphere is a circle so... couldn't you mathematically solve this by finding the circular intersection and then use mathematica for the rest? – user64742 Jan 13 '17 at 3:32

Let's take

ball = Ball[];
triangle = Triangle[{{0, 0, 0}, {2, 0, 0}, {2, 3, 1}}];
Graphics3D[{ball, triangle}, Axes -> True]

Then

reg = RegionIntersection[ball, triangle];
DiscretizeRegion[reg]

RegionDimension[reg]

2

RegionMeasure[reg]

$\frac{1}{4} \left(\pi -2 \sin ^{-1}\left(\sqrt{\frac{2}{7}}\right)\right)$

N@%

0.503427

Similarly for Polygons. The coordinates of neither the ball, nor the triangle (nor Polygon) need to be integers - all work just as well when they are real numbers (the RegionMeasure is a real number too).

make a 2d projection to the plane of the triangle and use RegionIntersection.

triangle = Triangle[{{0, 0, 0}, {2, 0, 0}, {2, 3, 1}}];
ball = Ball[{1, 0, 0}, 1];
spherecenter = ball[[1]];