Skip to main content
deleted 46 characters in body
Source Link
cs = First@ Cases[ParametricPlot[ BSplineFunction[{{0., 0.}, {0.25, 0.25}, {0.25, 0.}, {0., 0.25}}, SplineClosed -> True][u] // Evaluate, {u, 0, 1}, MaxRecursion -> 1], Line[l_] :> l, Infinity];∞]; Graphics3D[{EdgeForm[], TubePolygons[path, cs]}, Boxed -> False] 
P[a_] := {-a, a, 1/2 a (8 - a)}; path = First@ Cases[ParametricPlot3D[P[a], {a, 0, 8}, MaxRecursion -> 1], Line[l_] :> l, Infinity];∞]; Graphics3D[{EdgeForm[], TubePolygons[path, 5 cs]}, Boxed -> False] 
cs = First@Cases[figureEightFirst @ Cases[figureEight, Line[l_] :> l, Infinity];∞]; Clear[t]; r[t_] := P[t] uT[t_] = Simplify[r'[t]/Norm[r'[t]], t \[Element] Reals]; vN[t_] = Simplify[uT'[t]/Norm[uT'[t]], t \[Element] Reals]; vB[t_] = Simplify[Cross[uT[t], vN[t]], t \[Element] Reals]; Show[ ParametricPlot3D[ {P[t]}, {t, 0, 8}, PlotStyle -> {Blue, Thick}], Table[ Graphics3D[{ Translate[ GeometricTransformation[Tube@Line[Map[Append[#, 0] &, 10 cs]], Transpose[{vN[s], vB[s], uT[s]}]], P[s]]}], {s, 0, 8}], PlotRange -> 10 {{-1.1, .2}, {-.2, 1.1}, {-.2, 1.1}}] 
cs = First@ Cases[ParametricPlot[ BSplineFunction[{{0., 0.}, {0.25, 0.25}, {0.25, 0.}, {0., 0.25}}, SplineClosed -> True][u] // Evaluate, {u, 0, 1}, MaxRecursion -> 1], Line[l_] :> l, Infinity]; Graphics3D[{EdgeForm[], TubePolygons[path, cs]}, Boxed -> False] 
P[a_] := {-a, a, 1/2 a (8 - a)}; path = First@ Cases[ParametricPlot3D[P[a], {a, 0, 8}, MaxRecursion -> 1], Line[l_] :> l, Infinity]; Graphics3D[{EdgeForm[], TubePolygons[path, 5 cs]}, Boxed -> False] 
cs = First@Cases[figureEight, Line[l_] :> l, Infinity]; Clear[t]; r[t_] := P[t] uT[t_] = Simplify[r'[t]/Norm[r'[t]], t \[Element] Reals]; vN[t_] = Simplify[uT'[t]/Norm[uT'[t]], t \[Element] Reals]; vB[t_] = Simplify[Cross[uT[t], vN[t]], t \[Element] Reals]; Show[ ParametricPlot3D[ {P[t]}, {t, 0, 8}, PlotStyle -> {Blue, Thick}], Table[ Graphics3D[{ Translate[ GeometricTransformation[Tube@Line[Map[Append[#, 0] &, 10 cs]], Transpose[{vN[s], vB[s], uT[s]}]], P[s]]}], {s, 0, 8}], PlotRange -> 10 {{-1.1, .2}, {-.2, 1.1}, {-.2, 1.1}}] 
cs = First@ Cases[ParametricPlot[ BSplineFunction[{{0., 0.}, {0.25, 0.25}, {0.25, 0.}, {0., 0.25}}, SplineClosed -> True][u] // Evaluate, {u, 0, 1}, MaxRecursion -> 1], Line[l_] :> l, ∞]; Graphics3D[{EdgeForm[], TubePolygons[path, cs]}, Boxed -> False] 
P[a_] := {-a, a, 1/2 a (8 - a)}; path = First@ Cases[ParametricPlot3D[P[a], {a, 0, 8}, MaxRecursion -> 1], Line[l_] :> l, ∞]; Graphics3D[{EdgeForm[], TubePolygons[path, 5 cs]}, Boxed -> False] 
cs = First @ Cases[figureEight, Line[l_] :> l, ∞]; Clear[t]; r[t_] := P[t] uT[t_] = Simplify[r'[t]/Norm[r'[t]], t  Reals]; vN[t_] = Simplify[uT'[t]/Norm[uT'[t]], t  Reals]; vB[t_] = Simplify[Cross[uT[t], vN[t]], t  Reals]; Show[ ParametricPlot3D[ {P[t]}, {t, 0, 8}, PlotStyle -> {Blue, Thick}], Table[ Graphics3D[{ Translate[ GeometricTransformation[Tube@Line[Map[Append[#, 0] &, 10 cs]], Transpose[{vN[s], vB[s], uT[s]}]], P[s]]}], {s, 0, 8}], PlotRange -> 10 {{-1.1, .2}, {-.2, 1.1}, {-.2, 1.1}}] 
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

For this, you could use the answer by J.M.J.M. to the question "Extruding along a path""Extruding along a path". The question here isn't a duplicate because it makes use of features in J.M.'s excellent answer that go beyond what the linked question actually asked for. In particular, that answer can deal with self-intersecting cross sectional curves, which is what you need for this question:

Here is a discrete version where the shapes are inserted at positions given in a table. For the math behind the rotation transformation, have a look at "Finding unit tangent, normal, and binormal vectors for a given r(t)""Finding unit tangent, normal, and binormal vectors for a given r(t)":

For this, you could use the answer by J.M. to the question "Extruding along a path". The question here isn't a duplicate because it makes use of features in J.M.'s excellent answer that go beyond what the linked question actually asked for. In particular, that answer can deal with self-intersecting cross sectional curves, which is what you need for this question:

Here is a discrete version where the shapes are inserted at positions given in a table. For the math behind the rotation transformation, have a look at "Finding unit tangent, normal, and binormal vectors for a given r(t)":

For this, you could use the answer by J.M. to the question "Extruding along a path". The question here isn't a duplicate because it makes use of features in J.M.'s excellent answer that go beyond what the linked question actually asked for. In particular, that answer can deal with self-intersecting cross sectional curves, which is what you need for this question:

Here is a discrete version where the shapes are inserted at positions given in a table. For the math behind the rotation transformation, have a look at "Finding unit tangent, normal, and binormal vectors for a given r(t)":

Added discrete version of the shape
Source Link
Jens
  • 98.4k
  • 7
  • 217
  • 541
cs = First@Cases[figureEight, Line[l_] :> l, Infinity]; Clear[t]; r[t_] := P[t] uT[t_] = Simplify[r'[t]/Norm[r'[t]], t \[Element] Reals]; vN[t_] = Simplify[uT'[t]/Norm[uT'[t]], t \[Element] Reals]; vB[t_] = Simplify[Cross[uT[t], vN[t]], t \[Element] Reals]; Show[ ParametricPlot3D[ {P[t]}, {t, 0, 8}, PlotStyle -> {Blue, Thick}], Table[ Graphics3D[{ Translate[ GeometricTransformation[Tube@Line[Map[Append[#, 0] &, 10 cs]], Transpose[{vN[s], vB[s], uT[s]}]], P[s]]}], {s, 0, 8}], PlotRange -> 10 {{-1.1, .2}, {-.2, 1.1}, {-.2, 1.1}}] 

3d

The matrix in GeometricTransformation is made up of the three unit vectors tangent, normal, and bi-normal to the arc curve. The figure-eight shape is centered at the origin in a 2D coordinate system, so we have to first use Append to add a z-coordinate 0 to its points, and then align the orthogonal Cartesian axes with the normal and bi-normal vectors at a given point along the curve. Finally, the whole shape is translated to the location P[s] where s is the curve parameter.

cs = First@Cases[figureEight, Line[l_] :> l, Infinity]; Clear[t]; uT[t_] = Simplify[r'[t]/Norm[r'[t]], t \[Element] Reals]; vN[t_] = Simplify[uT'[t]/Norm[uT'[t]], t \[Element] Reals]; vB[t_] = Simplify[Cross[uT[t], vN[t]], t \[Element] Reals]; Show[ ParametricPlot3D[ {P[t]}, {t, 0, 8}, PlotStyle -> {Blue, Thick}], Table[ Graphics3D[{ Translate[ GeometricTransformation[Tube@Line[Map[Append[#, 0] &, 10 cs]], Transpose[{vN[s], vB[s], uT[s]}]], P[s]]}], {s, 0, 8}], PlotRange -> 10 {{-1.1, .2}, {-.2, 1.1}, {-.2, 1.1}}] 

3d

cs = First@Cases[figureEight, Line[l_] :> l, Infinity]; Clear[t]; r[t_] := P[t] uT[t_] = Simplify[r'[t]/Norm[r'[t]], t \[Element] Reals]; vN[t_] = Simplify[uT'[t]/Norm[uT'[t]], t \[Element] Reals]; vB[t_] = Simplify[Cross[uT[t], vN[t]], t \[Element] Reals]; Show[ ParametricPlot3D[ {P[t]}, {t, 0, 8}, PlotStyle -> {Blue, Thick}], Table[ Graphics3D[{ Translate[ GeometricTransformation[Tube@Line[Map[Append[#, 0] &, 10 cs]], Transpose[{vN[s], vB[s], uT[s]}]], P[s]]}], {s, 0, 8}], PlotRange -> 10 {{-1.1, .2}, {-.2, 1.1}, {-.2, 1.1}}] 

3d

The matrix in GeometricTransformation is made up of the three unit vectors tangent, normal, and bi-normal to the arc curve. The figure-eight shape is centered at the origin in a 2D coordinate system, so we have to first use Append to add a z-coordinate 0 to its points, and then align the orthogonal Cartesian axes with the normal and bi-normal vectors at a given point along the curve. Finally, the whole shape is translated to the location P[s] where s is the curve parameter.

Added discrete version of the shape
Source Link
Jens
  • 98.4k
  • 7
  • 217
  • 541
Loading
Source Link
Jens
  • 98.4k
  • 7
  • 217
  • 541
Loading