Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

First time posting here, although an experienced user of WM. I have a problem regarding graphics which I cannot seem to fix, so I am asking for your help.

  1. I start with a set of points $(x,y)$ in the range of $[0,1]\times[0,1]$, so a 2D rectangle. With these points I generate a triangle mesh which I later use with Finite Element Method for solving the eigenmodes of this rectangle OR a coat of cylinder, torus, or moebius, depending on what kind of boundary conditions I use in FEM.
  2. If the membrane is a coat of a 3D object, like in this case for a moebius strip, I want to draw the surface of a Moebius strip as a set of points $(x',y',z')$ in 3D. Normally I do this using parametrisation equations. I have found the equations for a moebius strip and they work perfectly. Here are the transformations

    • x' = (R+S*Cos[0.5*t])*Cos[t]
    • y' = (R+S*Cos[0.5*t])*Sin[t]
    • z' = S*Sin[0.5*t]

    where t$\in$ [0,2Pi] = 2Pi * x and S$\in$[-0.5,0.5] = y - 0.5.

  3. With these new 3D points I can now do a surface plot in 3D, which shoud look something like this for the case of a cylinder: Cylinder But if I draw these points as a moebius strip, I get weird anomalies. Here are the two cases I tried:

    • ListSurfacePlot3D -> I get weird anomalies. I tried tweaking MaxPlotPoints but it didn't do the trick. First case
    • ListPlot3D -> Works a bit better, but it also fills the hole in between and draws a weird joint. Second case

Here is the data sample of a 2D rectangle: Original

Here is the same data sample, but transformed for the case of moebius: Transformed

Plot codes for the data

p1=Graphics3D[Point[data3d], Boxed -> False, AspectRatio -> 1, 
  BoxRatios -> Automatic, SphericalRegion -> True, PlotRange -> All, 
  ImageSize -> 350]
p2= 
 ListPlot3D[data3d, Boxed -> False, Axes -> False, 
  SphericalRegion -> True, AspectRatio -> 1, BoxRatios -> Automatic, 
  MaxPlotPoints -> 30, PlotRange -> All, ImageSize -> 350, 
  Mesh -> Automatic, PlotStyle -> Magenta]


Show[{p1, p2}]

Where ListPlot3D can also be changed with ListSurfacePlot3D.

I really appreciate your help.

share|improve this question
    
Welcome! You can format your code, like I did for you, using the various controls that appear over the text entry box (there are also shortcuts). –  acl Jul 8 at 15:58
3  
There, I have added a few things. Thank you for the tips –  MasterApprentice Jul 8 at 16:18
1  
Have you seen this: mathematica.stackexchange.com/q/5783/131? –  Yves Klett Jul 8 at 16:23
1  
It seems that these are all continuous functions and I have a set of points. This is needed because I need to introduce some oscillation eigenmodes later. The information about these modes is stored in each point individually, so this is why I need points.. I need this, but for a Moebius strip: gfycat.com/DistantLameArrowworm –  MasterApprentice Jul 8 at 16:37
1  
MasterApprentice, it is not necessary to copy the answer you use into your question or add SOLVED to the title. Your Accept already floats that answer to the top and shows everyone that it solved your problem or was otherwise satisfying. –  Mr.Wizard Jul 8 at 20:20

2 Answers 2

up vote 5 down vote accepted

Let u be the list of 2D points on a rectangle and x their transformed 3D coordinates on the Möbius strip.

{u, x} =
  Import["http://pastebin.com/raw.php?i=" <> #, "Package"] & /@
    {"x4W9hB59", "3sfTBxhV"};

Because you were doing FEM, you must also have a triangulation of the points. But you haven't provided it, so I'll assume it to be the Delaunay triangulation of u.

t = First@Cases[ListDensityPlot[Join[#, {0}] & /@ u], Polygon[idx_] :> idx, Infinity];

Render x with this triangulation:

Graphics3D[GraphicsComplex[x, {EdgeForm[], Polygon /@ t}]]

enter image description here

share|improve this answer
    
It works! I knew there was a way of using the triangulation of the points, but I didn't know how. Thank you a million times and all thanks to others too! –  MasterApprentice Jul 8 at 20:08

You can generate your points and the strip as follows:

pts = Table[{4 Cos[a] + r Cos[a] Cos[a/2], 
    4 Sin[a] + r Sin[a] Cos[a/2], r Sin[a/2]}, {a, 0, 2 Pi, 
    Pi/32}, {r, -2, 2, .4}];

polys = Join[#[[1]], Reverse[#[[2]]]] & /@ Partition[pts, 2, 1];

{Polygon /@ polys, Point /@ pts} // Graphics3D

Mathematica graphics

share|improve this answer
    
Hmm.. I see that this works specifically for this kind of generated points. Could it be done for any set of 3D data? –  MasterApprentice Jul 8 at 17:23
    
So you are after a general meshing algorithm? –  Yves Klett Jul 8 at 17:29
    
Let me explain the whole situation: 1. I generate points on a rectangle, this is done for the generation of a mesh, which is later used for finite element method. If I calculate eigenmodes of a cylinder, i just correctly set the boundaries on this 2D mesh. 2. When I solve the eigensystem with FEM I get eigenmodes represented on a 2D membrane, which I then wish to parametrise as the corresponding 3D object (cylinder, mobius, torus) 3. When I do this for moebius, the surface is not nicely drawn for a general set of data, so this is the only thing that I need for now. –  MasterApprentice Jul 8 at 17:39
1  
@MasterApprentice you really should put that info into the question as detailed as possible. Show us your steps and the desired result. –  Yves Klett Jul 8 at 17:49
    
I hope I made it clearer now. Thanks! –  MasterApprentice Jul 8 at 18:23

Your Answer

 
discard

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.