1
$\begingroup$

My main problem is: I plotted a curve here, but the tip of some arrows are missing. Why does this happen, and how can I fix this?

Not the main problem: Also, I once tried to make the arrows with different colors, but all of them would be of the same color as the first one. How can I make them different colors? And I have a strong impression that I'm not being intelligent using Graphics3D all this much, for every single arrow. It must have a cleaner way to do it. (Maybe I should ask a different question for this, but I don't want to flood the site. If you can help me with the main problem, I'll be happy already)

[EDIT: wxffles already helped me with this issue in the comments. What is left is the main problem now.]

enter image description here

The code as it is now, in case it helps:

a[t_] := {1 + Cos[t], Sin[t], 2 Sin[t/2]}
tf[t_] := {(-Sin[t])/(Sqrt[1 + Cos[t/2]^2]), (Cos[t])/(Sqrt[
     1 + Cos[t/2]^2]), (Cos[t/2])/(Sqrt[1 + Cos[t/2]^2])}
bf[t_] := 
 Rationalize@{(-0.5 Cos[t] Sin[t/2] + Cos[t/2] Sin[t])/ 
    Sqrt[1.625 + 0.375 Cos[t]], (-Cos[t/2] Cos[t] - 
      0.5 Sin[t/2] Sin[t])/Sqrt[1.625 + 0.375 Cos[t]], 
   1/Sqrt[1.625 + 0.375 Cos[t]]}
nf[t_] := {-((3 + 12 Cos[t] + Cos[2 t])/(
   2 Sqrt[3 + Cos[t]] Sqrt[13 + 3 Cos[t]])), -(((6 + Cos[t]) Sin[t])/(
   Sqrt[3 + Cos[t]] Sqrt[13 + 3 Cos[t]])), -((2 Sin[t/2])/(
   Sqrt[3 + Cos[t]] Sqrt[13 + 3 Cos[t]]))}    


Show[ParametricPlot3D[{1 + Cos[t], Sin[t], 2 Sin[t/2]}, {t, 0, 
       4 \[Pi]}, 
      PlotStyle -> Directive[RGBColor[0.91`, 0.`, 0.`], Opacity[1.`]], 
      BoxRatios -> {1, 1, 1}, Boxed -> False, AxesOrigin -> {0, 0, 0}], 
     Graphics3D[Arrowheads[0.02], Arrow[{a[0], a[0] + tf[0]}]], 
     Graphics3D[Arrow[{a[0], a[0] + tf[0]}]], 
     Graphics3D[Arrow[{a[1], a[1] + tf[1]}]], 
     Graphics3D[Arrow[{a[Pi/2], a[Pi/2] + tf[Pi/2]}]], 
     Graphics3D[Arrow[{a[2], a[2] + tf[2]}]], 
     Graphics3D[Arrow[{a[Pi], a[Pi] + tf[Pi]}]], 
     Graphics3D[Arrow[{a[3 Pi/2], a[3 Pi/2] + tf[3 Pi/2]}]], 
     Graphics3D[Arrow[{a[2 Pi], a[2 Pi] + tf[2 Pi]}]], 
     Graphics3D[Arrow[{a[0], a[0] + bf[0]}]], 
     Graphics3D[Arrow[{a[0], a[0] + bf[0]}]], 
     Graphics3D[Arrow[{a[1], a[1] + bf[1]}]], 
     Graphics3D[Arrow[{a[Pi/2], a[Pi/2] + bf[Pi/2]}]], 
     Graphics3D[Arrow[{a[2], a[2] + bf[2]}]], 
     Graphics3D[Arrow[{a[Pi], a[Pi] + bf[Pi]}]], 
     Graphics3D[Arrow[{a[3 Pi/2], a[3 Pi/2] + bf[3 Pi/2]}]], 
     Graphics3D[Arrow[{a[2 Pi], a[2 Pi] + bf[2 Pi]}]], 
     Graphics3D[Arrow[{a[0], a[0] + nf[0]}]], 
     Graphics3D[Arrow[{a[0], a[0] + nf[0]}]], 
     Graphics3D[Arrow[{a[1], a[1] + nf[1]}]], 
     Graphics3D[Arrow[{a[Pi/2], a[Pi/2] + nf[Pi/2]}]], 
     Graphics3D[Arrow[{a[2], a[2] + nf[2]}]], 
     Graphics3D[Arrow[{a[Pi], a[Pi] + nf[Pi]}]], 
     Graphics3D[Arrow[{a[3 Pi/2], a[3 Pi/2] + nf[3 Pi/2]}]], 
     Graphics3D[Arrow[{a[2 Pi], a[2 Pi] + nf[2 Pi]}]]]

Thanks for your time.

$\endgroup$
3
  • 1
    $\begingroup$ PlotRange -> All? $\endgroup$
    – wxffles
    Aug 25, 2014 at 21:15
  • 1
    $\begingroup$ Graphics3D can take a list of primitives, so you don't need a separate Graphics3D for each arrow. You can also have nested lists to provide scoping for your styling. E.g. Graphics3D[{{Red, Arrow[...]}, Arrow[...], ...}] $\endgroup$
    – wxffles
    Aug 25, 2014 at 21:22
  • $\begingroup$ Hey, thanks! Your comment really helped me (: $\endgroup$
    – Ivo Terek
    Aug 25, 2014 at 21:29

1 Answer 1

3
$\begingroup$

Let me shorten your example a little bit

par =
  ParametricPlot3D[{1 + Cos[t], Sin[t], 2 Sin[t/2]}, {t, 0, 4 \[Pi]},
   PlotStyle -> Red,
   Boxed -> False,
   AxesOrigin -> {0, 0, 0},
   AspectRatio -> 1];

arr =
  Graphics3D[
   {
    Arrowheads[0.02],
    {Red, Arrow[{a[0], a[0] + tf[0]}]},
    {Green, Arrow[{a[1], a[1] + tf[1]}]},
    {Blue, Arrow[{a[Pi/2], a[Pi/2] + tf[Pi/2]}]},
    {Black, Arrow[{a[2 Pi], a[2 Pi] + nf[3 Pi]}]}
    }];

Show[par, arr, PlotRange -> All]

enter image description here

$\endgroup$
2
  • $\begingroup$ Great. I didn't knew that you could name the graph and do something like Show[par, arr, PlotRange -> All], also. Very helpful and instructive. (: $\endgroup$
    – Ivo Terek
    Aug 25, 2014 at 21:40
  • $\begingroup$ @IvoTerek Thanks :) $\endgroup$
    – eldo
    Aug 25, 2014 at 21:43

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.