5
$\begingroup$

I need to export a circle drawn in 3D with a specific point of view to a PDF file. This is easy to do. However, the exported circle is made of tons of non-connected small bits. I need the whole circle to be a single piece in vectorial form. How can we do this ? Take note that I also need the three axes to be exported too (they are not cutted into small parts, which is what I want).

Here's the code itself :

ParametricPlot3D[
    {Cos[p], Sin[p], 0}, {p, 0, 2 Pi},
    PlotStyle -> {Directive[AbsoluteThickness[1], GrayLevel[0.5]]},
    PlotPoints -> 100,
    PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}, {-0.5, 0.5}},
    Boxed -> False,
    Axes -> True,
    Ticks -> None,
    AxesStyle -> Directive[GrayLevel[0.5], Dashed],
    AxesOrigin -> {0, 0, 0},
    ImageSize -> {750, 750},
    ViewAngle -> 25 Pi/180,
    ViewPoint -> {1, 1, 1},
    SphericalRegion -> True,
    Method -> {"RotationControl" -> "Globe"}
    ]

Exporting to a PNG or JPG file is not an option here. I need the vectorial form of the curve, as a single piece (I'll also have to do the same with another curve, much more complicated than a simple circle).

$\endgroup$
22
  • $\begingroup$ You realize, that the circle is a primitive, easily parametrized and, in theory, its 3d form projected onto the 2d computer screen can be calculated to be some ellipse, while your "much more complicated curve" can only be calculated at a set of discrete points and the PDF format probably doesn't have these tools built in? I.e. your curve, at best, can be represented as some kind of spline which is not necessarily exactly what its real shape is. $\endgroup$ – LLlAMnYP Mar 18 '16 at 16:09
  • $\begingroup$ @LLlAMnYP, all my 2D curves (even if they are complicated) can be exported to a single piece in a PDF file. I don't have any problem with 2D. 3D is "special" in MMA, even to draw a simple circle. $\endgroup$ – Cham Mar 18 '16 at 16:17
  • $\begingroup$ I'm afraid, I don't follow your usage of the term "single-piece". I thought, you meant, that if you zoom in, the curve is not smooth, but a collection of straight segments. That is the case for 2d plots as well. (the Circle[] primitive is fundamentally different). $\endgroup$ – LLlAMnYP Mar 18 '16 at 16:20
  • $\begingroup$ @LLlAMnYP, single piece means connected small lines. Not just a pack of small unrelated bits. All of my 2D curves are exported fine as single entities. 3D doesn't. $\endgroup$ – Cham Mar 18 '16 at 16:21
  • 3
    $\begingroup$ This article media.pearsoncmg.com/aw/aw_lay_linearalg_updated_cw_3/cs_apps/… discusses 3d projection onto 2d in very simple terms. It's an interesting problem, but I really don't have the time to roll an implementation right now. $\endgroup$ – LLlAMnYP Mar 18 '16 at 16:55
1
$\begingroup$

This does the job

Graphics[{Circle[{0, 0}, {4, 2}], Dashed, Line[{{-3, -2}, {3, 2}}],Line[{{3, -2}, {-3, 2}}], Line[{{0, -1.5}, {0, 1.5}}]}]

circle

When exported to PDF the picture has a minimal number of elements. For the case of arbitrarily oriented in 3d circle one needs to work out formulas for the ellipse.

$\endgroup$
1
  • $\begingroup$ This can't work. The center of this ellipse is not the same as the center of a tilted circle in 3D. Perspective effects are more complicated. $\endgroup$ – Cham Mar 18 '16 at 23:27

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