How to display a finer sphere in Graphics3D?
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
I'm trying to display two highly zoomed-in spheres with the following code:
src = -49.276947, -7.02026463, 8334.27539;
R = 6371000;
Ha = 50000;
Graphics3D[Point[src], Opacity[0.1], Green, Sphere[0, 0, -R, R],
Lighter@Blue, Sphere[0, 0, -R, R + Ha],
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha)]
As you can see in the output, the sphere mesh is quite coarse. How can I make it finer, so that the image I get really looked like containing spheres, not some connected triangles?
plotting graphics3d
add a comment |Â
up vote
4
down vote
favorite
I'm trying to display two highly zoomed-in spheres with the following code:
src = -49.276947, -7.02026463, 8334.27539;
R = 6371000;
Ha = 50000;
Graphics3D[Point[src], Opacity[0.1], Green, Sphere[0, 0, -R, R],
Lighter@Blue, Sphere[0, 0, -R, R + Ha],
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha)]
As you can see in the output, the sphere mesh is quite coarse. How can I make it finer, so that the image I get really looked like containing spheres, not some connected triangles?
plotting graphics3d
Try alsoMethod -> "SpherePoints" -> 85
â b3m2a1
Aug 8 at 21:06
1
@b3m2a1 You beat me to it. :)
â Michael E2
Aug 8 at 21:08
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I'm trying to display two highly zoomed-in spheres with the following code:
src = -49.276947, -7.02026463, 8334.27539;
R = 6371000;
Ha = 50000;
Graphics3D[Point[src], Opacity[0.1], Green, Sphere[0, 0, -R, R],
Lighter@Blue, Sphere[0, 0, -R, R + Ha],
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha)]
As you can see in the output, the sphere mesh is quite coarse. How can I make it finer, so that the image I get really looked like containing spheres, not some connected triangles?
plotting graphics3d
I'm trying to display two highly zoomed-in spheres with the following code:
src = -49.276947, -7.02026463, 8334.27539;
R = 6371000;
Ha = 50000;
Graphics3D[Point[src], Opacity[0.1], Green, Sphere[0, 0, -R, R],
Lighter@Blue, Sphere[0, 0, -R, R + Ha],
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha)]
As you can see in the output, the sphere mesh is quite coarse. How can I make it finer, so that the image I get really looked like containing spheres, not some connected triangles?
plotting graphics3d
asked Aug 8 at 20:21
Ruslan
3,09911238
3,09911238
Try alsoMethod -> "SpherePoints" -> 85
â b3m2a1
Aug 8 at 21:06
1
@b3m2a1 You beat me to it. :)
â Michael E2
Aug 8 at 21:08
add a comment |Â
Try alsoMethod -> "SpherePoints" -> 85
â b3m2a1
Aug 8 at 21:06
1
@b3m2a1 You beat me to it. :)
â Michael E2
Aug 8 at 21:08
Try also
Method -> "SpherePoints" -> 85
â b3m2a1
Aug 8 at 21:06
Try also
Method -> "SpherePoints" -> 85
â b3m2a1
Aug 8 at 21:06
1
1
@b3m2a1 You beat me to it. :)
â Michael E2
Aug 8 at 21:08
@b3m2a1 You beat me to it. :)
â Michael E2
Aug 8 at 21:08
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
7
down vote
accepted
There's Method -> "SpherePoints" -> n
:
src = -49.276947, -7.02026463, 8334.27539;
R = 6371000;
Ha = 50000;
Graphics3D[Point[src], Opacity[0.1], Green, Sphere[0, 0, -R, R],
Lighter@Blue, Sphere[0, 0, -R, R + Ha],
Method -> "SpherePoints" -> 100,
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha),
ViewPoint -> Front]
Huh, that's neat! I've never got the idea to inspect theMethod
option ofGraphics3D
.
â Henrik Schumacher
Aug 8 at 21:19
1
@HenrikSchumacher Look around the site. There are other ones, too (cylinder, tube, maybe more).
â Michael E2
Aug 8 at 21:46
add a comment |Â
up vote
5
down vote
You can obtain a piece of the sphere in customizable discretization with
DiscretizeRegion[
RegionIntersection[
Cuboid @@
Transpose[src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha],
Sphere[0, 0, -R, R]
],
MaxCellMeasure -> 1 -> R/600
]
You can get the underlying GraphicsComplex
with
GraphicsComplex[
MeshCoordinates[S],
EdgeForm, MeshCells[S, 2, "Multicells" -> True]
]
This seems to work, but for some reason appears to not respect the color specifications (Green
andLighter@Blue
in the OP). Any remedy for this?
â Ruslan
Aug 8 at 20:43
Yes; I added a way to get a "undecorated"GraphicsComplex
.
â Henrik Schumacher
Aug 8 at 21:09
add a comment |Â
up vote
3
down vote
You can make a smoother sphere with NURBS.
ClearAll@nurbsSphere;
nurbsSphere[c : _?NumberQ, _, _, r_: 1] :=
Module[
base = r
0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1,
0,-1,-1, 1,-1,-1, 1,1,-1, 0,1,-1, -1,1,-1, -1,-1,-1, 0,-1,-1,
0,-1,1, 1,-1,1, 1,1,1, 0,1,1, -1,1,1, -1,-1,1, 0,-1,1,
0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1
/. p : _?NumberQ, _, _ :> p + c,
weights = 1, 0.5, 0.5, 1, 0.5, 0.5, 1,
knots = 0, 0, 0, 1/4, 1/2, 1/2, 3/4, 1, 1, 1
,
BSplineSurface[base, SplineDegree -> 2,
SplineKnots -> Automatic, knots,
SplineWeights -> weights, 0.5 weights, 0.5 weights, weights,
SplineClosed -> False, True]
]
Use it just like a normal Sphere:
Graphics3D@nurbsSphere@0, 0, 0
Graphics3D[Point[src], Opacity[0.1], Green,
nurbsSphere[0, 0, -R, R], Lighter@Blue,
nurbsSphere[0, 0, -R, R + Ha],
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha)]
Although you end up right on the balloon knot.
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
7
down vote
accepted
There's Method -> "SpherePoints" -> n
:
src = -49.276947, -7.02026463, 8334.27539;
R = 6371000;
Ha = 50000;
Graphics3D[Point[src], Opacity[0.1], Green, Sphere[0, 0, -R, R],
Lighter@Blue, Sphere[0, 0, -R, R + Ha],
Method -> "SpherePoints" -> 100,
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha),
ViewPoint -> Front]
Huh, that's neat! I've never got the idea to inspect theMethod
option ofGraphics3D
.
â Henrik Schumacher
Aug 8 at 21:19
1
@HenrikSchumacher Look around the site. There are other ones, too (cylinder, tube, maybe more).
â Michael E2
Aug 8 at 21:46
add a comment |Â
up vote
7
down vote
accepted
There's Method -> "SpherePoints" -> n
:
src = -49.276947, -7.02026463, 8334.27539;
R = 6371000;
Ha = 50000;
Graphics3D[Point[src], Opacity[0.1], Green, Sphere[0, 0, -R, R],
Lighter@Blue, Sphere[0, 0, -R, R + Ha],
Method -> "SpherePoints" -> 100,
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha),
ViewPoint -> Front]
Huh, that's neat! I've never got the idea to inspect theMethod
option ofGraphics3D
.
â Henrik Schumacher
Aug 8 at 21:19
1
@HenrikSchumacher Look around the site. There are other ones, too (cylinder, tube, maybe more).
â Michael E2
Aug 8 at 21:46
add a comment |Â
up vote
7
down vote
accepted
up vote
7
down vote
accepted
There's Method -> "SpherePoints" -> n
:
src = -49.276947, -7.02026463, 8334.27539;
R = 6371000;
Ha = 50000;
Graphics3D[Point[src], Opacity[0.1], Green, Sphere[0, 0, -R, R],
Lighter@Blue, Sphere[0, 0, -R, R + Ha],
Method -> "SpherePoints" -> 100,
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha),
ViewPoint -> Front]
There's Method -> "SpherePoints" -> n
:
src = -49.276947, -7.02026463, 8334.27539;
R = 6371000;
Ha = 50000;
Graphics3D[Point[src], Opacity[0.1], Green, Sphere[0, 0, -R, R],
Lighter@Blue, Sphere[0, 0, -R, R + Ha],
Method -> "SpherePoints" -> 100,
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha),
ViewPoint -> Front]
answered Aug 8 at 21:08
Michael E2
140k11190454
140k11190454
Huh, that's neat! I've never got the idea to inspect theMethod
option ofGraphics3D
.
â Henrik Schumacher
Aug 8 at 21:19
1
@HenrikSchumacher Look around the site. There are other ones, too (cylinder, tube, maybe more).
â Michael E2
Aug 8 at 21:46
add a comment |Â
Huh, that's neat! I've never got the idea to inspect theMethod
option ofGraphics3D
.
â Henrik Schumacher
Aug 8 at 21:19
1
@HenrikSchumacher Look around the site. There are other ones, too (cylinder, tube, maybe more).
â Michael E2
Aug 8 at 21:46
Huh, that's neat! I've never got the idea to inspect the
Method
option of Graphics3D
.â Henrik Schumacher
Aug 8 at 21:19
Huh, that's neat! I've never got the idea to inspect the
Method
option of Graphics3D
.â Henrik Schumacher
Aug 8 at 21:19
1
1
@HenrikSchumacher Look around the site. There are other ones, too (cylinder, tube, maybe more).
â Michael E2
Aug 8 at 21:46
@HenrikSchumacher Look around the site. There are other ones, too (cylinder, tube, maybe more).
â Michael E2
Aug 8 at 21:46
add a comment |Â
up vote
5
down vote
You can obtain a piece of the sphere in customizable discretization with
DiscretizeRegion[
RegionIntersection[
Cuboid @@
Transpose[src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha],
Sphere[0, 0, -R, R]
],
MaxCellMeasure -> 1 -> R/600
]
You can get the underlying GraphicsComplex
with
GraphicsComplex[
MeshCoordinates[S],
EdgeForm, MeshCells[S, 2, "Multicells" -> True]
]
This seems to work, but for some reason appears to not respect the color specifications (Green
andLighter@Blue
in the OP). Any remedy for this?
â Ruslan
Aug 8 at 20:43
Yes; I added a way to get a "undecorated"GraphicsComplex
.
â Henrik Schumacher
Aug 8 at 21:09
add a comment |Â
up vote
5
down vote
You can obtain a piece of the sphere in customizable discretization with
DiscretizeRegion[
RegionIntersection[
Cuboid @@
Transpose[src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha],
Sphere[0, 0, -R, R]
],
MaxCellMeasure -> 1 -> R/600
]
You can get the underlying GraphicsComplex
with
GraphicsComplex[
MeshCoordinates[S],
EdgeForm, MeshCells[S, 2, "Multicells" -> True]
]
This seems to work, but for some reason appears to not respect the color specifications (Green
andLighter@Blue
in the OP). Any remedy for this?
â Ruslan
Aug 8 at 20:43
Yes; I added a way to get a "undecorated"GraphicsComplex
.
â Henrik Schumacher
Aug 8 at 21:09
add a comment |Â
up vote
5
down vote
up vote
5
down vote
You can obtain a piece of the sphere in customizable discretization with
DiscretizeRegion[
RegionIntersection[
Cuboid @@
Transpose[src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha],
Sphere[0, 0, -R, R]
],
MaxCellMeasure -> 1 -> R/600
]
You can get the underlying GraphicsComplex
with
GraphicsComplex[
MeshCoordinates[S],
EdgeForm, MeshCells[S, 2, "Multicells" -> True]
]
You can obtain a piece of the sphere in customizable discretization with
DiscretizeRegion[
RegionIntersection[
Cuboid @@
Transpose[src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha],
Sphere[0, 0, -R, R]
],
MaxCellMeasure -> 1 -> R/600
]
You can get the underlying GraphicsComplex
with
GraphicsComplex[
MeshCoordinates[S],
EdgeForm, MeshCells[S, 2, "Multicells" -> True]
]
edited Aug 8 at 21:09
answered Aug 8 at 20:32
Henrik Schumacher
33.7k247100
33.7k247100
This seems to work, but for some reason appears to not respect the color specifications (Green
andLighter@Blue
in the OP). Any remedy for this?
â Ruslan
Aug 8 at 20:43
Yes; I added a way to get a "undecorated"GraphicsComplex
.
â Henrik Schumacher
Aug 8 at 21:09
add a comment |Â
This seems to work, but for some reason appears to not respect the color specifications (Green
andLighter@Blue
in the OP). Any remedy for this?
â Ruslan
Aug 8 at 20:43
Yes; I added a way to get a "undecorated"GraphicsComplex
.
â Henrik Schumacher
Aug 8 at 21:09
This seems to work, but for some reason appears to not respect the color specifications (
Green
and Lighter@Blue
in the OP). Any remedy for this?â Ruslan
Aug 8 at 20:43
This seems to work, but for some reason appears to not respect the color specifications (
Green
and Lighter@Blue
in the OP). Any remedy for this?â Ruslan
Aug 8 at 20:43
Yes; I added a way to get a "undecorated"
GraphicsComplex
.â Henrik Schumacher
Aug 8 at 21:09
Yes; I added a way to get a "undecorated"
GraphicsComplex
.â Henrik Schumacher
Aug 8 at 21:09
add a comment |Â
up vote
3
down vote
You can make a smoother sphere with NURBS.
ClearAll@nurbsSphere;
nurbsSphere[c : _?NumberQ, _, _, r_: 1] :=
Module[
base = r
0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1,
0,-1,-1, 1,-1,-1, 1,1,-1, 0,1,-1, -1,1,-1, -1,-1,-1, 0,-1,-1,
0,-1,1, 1,-1,1, 1,1,1, 0,1,1, -1,1,1, -1,-1,1, 0,-1,1,
0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1
/. p : _?NumberQ, _, _ :> p + c,
weights = 1, 0.5, 0.5, 1, 0.5, 0.5, 1,
knots = 0, 0, 0, 1/4, 1/2, 1/2, 3/4, 1, 1, 1
,
BSplineSurface[base, SplineDegree -> 2,
SplineKnots -> Automatic, knots,
SplineWeights -> weights, 0.5 weights, 0.5 weights, weights,
SplineClosed -> False, True]
]
Use it just like a normal Sphere:
Graphics3D@nurbsSphere@0, 0, 0
Graphics3D[Point[src], Opacity[0.1], Green,
nurbsSphere[0, 0, -R, R], Lighter@Blue,
nurbsSphere[0, 0, -R, R + Ha],
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha)]
Although you end up right on the balloon knot.
add a comment |Â
up vote
3
down vote
You can make a smoother sphere with NURBS.
ClearAll@nurbsSphere;
nurbsSphere[c : _?NumberQ, _, _, r_: 1] :=
Module[
base = r
0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1,
0,-1,-1, 1,-1,-1, 1,1,-1, 0,1,-1, -1,1,-1, -1,-1,-1, 0,-1,-1,
0,-1,1, 1,-1,1, 1,1,1, 0,1,1, -1,1,1, -1,-1,1, 0,-1,1,
0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1
/. p : _?NumberQ, _, _ :> p + c,
weights = 1, 0.5, 0.5, 1, 0.5, 0.5, 1,
knots = 0, 0, 0, 1/4, 1/2, 1/2, 3/4, 1, 1, 1
,
BSplineSurface[base, SplineDegree -> 2,
SplineKnots -> Automatic, knots,
SplineWeights -> weights, 0.5 weights, 0.5 weights, weights,
SplineClosed -> False, True]
]
Use it just like a normal Sphere:
Graphics3D@nurbsSphere@0, 0, 0
Graphics3D[Point[src], Opacity[0.1], Green,
nurbsSphere[0, 0, -R, R], Lighter@Blue,
nurbsSphere[0, 0, -R, R + Ha],
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha)]
Although you end up right on the balloon knot.
add a comment |Â
up vote
3
down vote
up vote
3
down vote
You can make a smoother sphere with NURBS.
ClearAll@nurbsSphere;
nurbsSphere[c : _?NumberQ, _, _, r_: 1] :=
Module[
base = r
0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1,
0,-1,-1, 1,-1,-1, 1,1,-1, 0,1,-1, -1,1,-1, -1,-1,-1, 0,-1,-1,
0,-1,1, 1,-1,1, 1,1,1, 0,1,1, -1,1,1, -1,-1,1, 0,-1,1,
0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1
/. p : _?NumberQ, _, _ :> p + c,
weights = 1, 0.5, 0.5, 1, 0.5, 0.5, 1,
knots = 0, 0, 0, 1/4, 1/2, 1/2, 3/4, 1, 1, 1
,
BSplineSurface[base, SplineDegree -> 2,
SplineKnots -> Automatic, knots,
SplineWeights -> weights, 0.5 weights, 0.5 weights, weights,
SplineClosed -> False, True]
]
Use it just like a normal Sphere:
Graphics3D@nurbsSphere@0, 0, 0
Graphics3D[Point[src], Opacity[0.1], Green,
nurbsSphere[0, 0, -R, R], Lighter@Blue,
nurbsSphere[0, 0, -R, R + Ha],
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha)]
Although you end up right on the balloon knot.
You can make a smoother sphere with NURBS.
ClearAll@nurbsSphere;
nurbsSphere[c : _?NumberQ, _, _, r_: 1] :=
Module[
base = r
0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1, 0,0,-1,
0,-1,-1, 1,-1,-1, 1,1,-1, 0,1,-1, -1,1,-1, -1,-1,-1, 0,-1,-1,
0,-1,1, 1,-1,1, 1,1,1, 0,1,1, -1,1,1, -1,-1,1, 0,-1,1,
0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1, 0,0,1
/. p : _?NumberQ, _, _ :> p + c,
weights = 1, 0.5, 0.5, 1, 0.5, 0.5, 1,
knots = 0, 0, 0, 1/4, 1/2, 1/2, 3/4, 1, 1, 1
,
BSplineSurface[base, SplineDegree -> 2,
SplineKnots -> Automatic, knots,
SplineWeights -> weights, 0.5 weights, 0.5 weights, weights,
SplineClosed -> False, True]
]
Use it just like a normal Sphere:
Graphics3D@nurbsSphere@0, 0, 0
Graphics3D[Point[src], Opacity[0.1], Green,
nurbsSphere[0, 0, -R, R], Lighter@Blue,
nurbsSphere[0, 0, -R, R + Ha],
PlotRange -> (src + -R/10, R/10, -R/10, R/10, -2 Ha, 2 Ha)]
Although you end up right on the balloon knot.
answered Aug 9 at 1:30
wxffles
11.4k13266
11.4k13266
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f179711%2fhow-to-display-a-finer-sphere-in-graphics3d%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Try also
Method -> "SpherePoints" -> 85
â b3m2a1
Aug 8 at 21:06
1
@b3m2a1 You beat me to it. :)
â Michael E2
Aug 8 at 21:08