1
$\begingroup$

I want to draw a triangulation of a sphere starting from the following data. I have a collection of triangles represented by three points $(p1,p2,p3)$ on a sphere of radius 1. I would like to draw in a different color (or maybe even with a texture) each curvy triangle. Any ideas?

EDIT

Thanks for the first answers. Both method works fine, but there is something else that now bothers me.

For each triangle I have a picture that I would like to use as a Texture, each picture has a central "body" surrounded by white empty space that can be increased at pleasure. I would like the Texture to be added so that the central body ends up on the barycenter of the triangle and I would like it not to be too deformed. In other words, what I would like to happen is to cut a triangle out of the original picture and use it as a texture so that the vertices and barycenter (the central body) are mapped to vertices and barycenter of the spherical triangles. Here is an example of a picture

enter image description here

Also, I would like to be able to "see through" the regions, so that one can see the central body drawn on the far side of the sphere without rotating it. If I use PlotStyle->{Texture[Image],Opacity[.5]} from your first Method, the texture completely disappears.

$\endgroup$
1
  • $\begingroup$ The surface of a sphere is two-dimensional. Only two coordinates are needed. You already specified the radius. Or, have you computed already the three dimensional. $\endgroup$
    – anon
    Mar 22, 2023 at 1:23

1 Answer 1

3
$\begingroup$

Method-1

  • ConicHullRegion[{{0, 0, 0}}, {p1, p2, p3}] generate the infinite pyramid. $$\{ t_1p1+t_2p_2+t_3p_3, t_1,t_2,t_3\geq 0 \}$$

  • The spherical triangle is the intersection of theConicHullRegion region and Sphere[].

SeedRandom[1];
sphere = Sphere[];
{p1, p2, p3} = RandomPoint[sphere, 3];
viewpoint = Mean[{p1, p2, p3}];
reg = DiscretizeRegion[
   RegionIntersection[{sphere, 
     ConicHullRegion[{{0, 0, 0}}, {p1, p2, p3}]}], {{-1.2, 
     1.2}, {-1.2, 1.2}, {-1.2, 1.2}}, MaxCellMeasure -> 10^-5, 
   AccuracyGoal -> 3];
sphericaltriangle = 
 RegionPlot3D[reg, 
  PlotStyle -> Texture[ExampleData[{"ColorTexture", "WhiteMarble"}]], 
  Mesh -> None]
Graphics3D[{sphere, sphericaltriangle[[1]]}, ViewPoint -> viewpoint, 
 ViewProjection -> "Orthographic", PlotRange -> All, Boxed -> False]

enter image description here

Method-2

  • For three points{p1,p2,p3}, we parametric the space triangle by
{1 - t, t} . {p1, {1 - s, s} . {p2, p3}}

where 0<=t<=1 and 0<=s<=1. After that we Normalize all of the points of triangle to projecte it to the unit-sphere.

SeedRandom[1];
sphere = Sphere[];
{p1, p2, p3} = RandomPoint[sphere, 3];
ParametricPlot3D[{1 - t, t} . {p1, {1 - s, s} . {p2, p3}} // 
  Normalize, {t, 0, 1}, {s, 0, 1}, 
 PlotStyle -> Texture@ExampleData[{"ColorTexture", "GoldenOak"}], 
 Mesh -> None]

enter image description here

$\endgroup$
1
  • $\begingroup$ The second method is very elegant. And nice use of the texture data! $\endgroup$
    – alex
    Mar 22, 2023 at 13:34

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.