Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm attempting to draw $N$ cones on a 3D object, where each cone is specified by a pair of 3D coordinates. The first coordinate is for the cone's base, the second one for the cone's apex. Here, I have two lists - ConeBases and ConeVertices - where cone $k$ is specified by the pair of coordinates at the $k$th positions of the ConeBases and ConeVertices lists (i.e. ConeBases[[k]] and ConeVertices[[k]]).

To specify a single cone of base radius (ConeRadius = 1), we can write:

Graphics3D[Cone[{{0, 0, 0}, {0, 0, 1}}, ConeRadius]]  

However, how could I automatically generate the $N$ cones using my lists of base and apex coordinates? What if I also had a list of base radii for the cones?

The naive solution here, which is what I've been doing, is to generate a string individually specifying each cone. Is there a better way to proceed?

share|improve this question
up vote 2 down vote accepted

You might try something like this:

ConeBases = RandomReal[{-1, 1}, {20, 3}];
ConeVertices = RandomReal[{-1, 1}, {20, 3}];
ConeRadii = RandomReal[{0, .3}, {20}];

cones = Transpose[{ConeBases, ConeVertices, ConeRadii}]

Graphics3D[Cone[{#[[1]], #[[2]]}, #[[3]]] & /@ cones]

enter image description here

share|improve this answer
Or cones = Transpose[{Transpose@{ConeBases, ConeVertices}, ConeRadii}]; Graphics3D[Cone @@@ cones] – Dr. belisarius Mar 5 '13 at 11:02
Or Graphics3D[MapThread[Cone[{#1, #2}, #3] &, {ConeBases, ConeVertices, ConeRadii}]] – einbandi Mar 5 '13 at 16:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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