Author Topic: Moebius strip  (Read 950 times)

0 Members and 1 Guest are viewing this topic.

Offline (gile)

  • C#
  • *
  • Posts: 87
  • Karma: +8/-0
  • Gender: Male
    • prefered language: F
    • Prog expertise: Good
    • View Profile
Moebius strip
« on: February 24, 2013, 10:04:42 PM »
Code: [Select]
import("ProtoGeometry.dll");
import("Math.dll");

numPts = 60;
halfWid = 20;
angle = 0..360..#numPts;
radius = 100;
width = 2;

def pts(halfWid : double)
{
    x = (radius + halfWid * (Math.Cos(angle / 2))) * (Math.Cos(angle));
y = (radius + halfWid * (Math.Cos(angle / 2))) * (Math.Sin(angle));
z = halfWid * Math.Sin(angle / 2);
return = Point.ByCoordinates(x, y, z);
}

lines = Line.ByStartPointEndPoint(pts(halfWid), pts(-halfWid));
lines.SetVisibility(false);
surfs = Surface.LoftFromCrossSections({ lines[0..numPts / 2], lines[numPts / 2..numPts] });
surfs.Visible = false;
solids = surfs.Thicken(width, true);
solid = solids[0].Union(solids[1]);