Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6072 > unrolled thread

Putting Points and Lines into RegionPlot3D

Started byBrentt <brenttnewman@gmail.com>
First post2011-10-31 12:09 +0000
Last post2011-11-04 11:08 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Putting Points and Lines into RegionPlot3D Brentt <brenttnewman@gmail.com> - 2011-10-31 12:09 +0000
    Re: Putting Points and Lines into RegionPlot3D Fred Klingener <jfklingener@gmail.com> - 2011-11-04 11:08 +0000

#6072 — Putting Points and Lines into RegionPlot3D

FromBrentt <brenttnewman@gmail.com>
Date2011-10-31 12:09 +0000
SubjectPutting Points and Lines into RegionPlot3D
Message-ID<j8m357$s2g$1@smc.vnet.net>
Hello,


How can one put points and lines into a 3D plot?

Here is my non-working code for having a unit sphere with a line inside of
it going from the origin to 1 on the x-axis.

origin = {0, 0, 0};
pBox = 1.5;
RegionPlot3D[
 x^2 + y^2 + z^2 <= 1, {x, -pBox, pBox}, {y, -pBox, pBox}, {z, -pBox,
  pBox}, PlotStyle -> Directive[Yellow, Opacity[0.2]], Mesh -> None,
 Epilog -> {Line[{origin, {0, 1, 0}}]}]

Epilog seems to expect only 2D graphics object, which makes me think its
not the right option to use. But what option would I use? Is there an
available option? Plot3D has the same problem.

[toc] | [next] | [standalone]


#6178

FromFred Klingener <jfklingener@gmail.com>
Date2011-11-04 11:08 +0000
Message-ID<j90h38$sm8$1@smc.vnet.net>
In reply to#6072
On Oct 31, 8:09 am, Brentt <brenttnew...@gmail.com> wrote:
> Hello,
>
> How can one put points and lines into a 3D plot?
>
> Here is my non-working code for having a unit sphere with a line inside of
> it going from the origin to 1 on the x-axis.
>
> origin = {0, 0, 0};
> pBox = 1.5;
> RegionPlot3D[
>  x^2 + y^2 + z^2 <= 1, {x, -pBox, pBox}, {y, -pBox, pBox}, {z, -pBox,
>   pBox}, PlotStyle -> Directive[Yellow, Opacity[0.2]], Mesh -> None,
>  Epilog -> {Line[{origin, {0, 1, 0}}]}]

If you look at the form of your RegionPlot3D

origin={0,0,0};
pBox=1.5;
rp=RegionPlot3D[x^2+y^2+z^2<=1,{x,-pBox,pBox},{y,-pBox,pBox},{z,-
pBox,pBox},PlotStyle->Directive[Yellow,Opacity[0.2]],Mesh->None
(* ,Epilog->{Line[{origin,{0,1,0}}]}*)];

Head[rp]
Dimensions[rp]
Head[rp[[1]]]
Head[rp[[2]]]

you'll see that rp is itself just a Graphics3D with two arguments, the
first a GraphicsComplex and the second is the option list. So if for
some reason you don't want to compose and Show graphics (or if it
drives you nuts figuring out how the composition order determines the
output), you can compose a single Graphics3D:

Graphics3D[
{
rp[[1]]                              (* the RegionPlot3D
GraphicsComplex *)
,Arrow[{origin,{1,1,1}}]    (* your stuff *)
}
,rp[[2]]                             (* original Options *)
]

hth,
Fred Klingener

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web