Newbie trying to understand PeriodicWrap in ShapeJS2.0

Discussion in 'ShapeJS' started by boxthoughts, May 2, 2016.

  1. boxthoughts
    boxthoughts Member
    I thought PeriodicWrap would work something like array in blender, creating copies of an object and offsetting it by the vector3d. In the first tutorial for PeriodicWrap it creates a cylinder then does a PeriodicWrap and a translation. When I look at the results up close, the object being repeated is only half the cylinder with the flat side looking all weird and cut up. I was expecting to see a full cylinder being repeated. What am I not getting? What causes the half cylinder?
     
  2. AlanHudson
    AlanHudson Shapeways Employee Dev Team
    Our next blog posting will be on PeriodicWrap, so stay tuned. I'll post here when it's up, should be in a few days.

     
  3. bulatov
    bulatov Shapeways Employee Dev Team
    PeriodicWrap works by tiling the whole space by identical copies of single tile - the fundamental domain.
    The interior of that tile is replicated. Parts of the shape outside of fundamental domain are cropped.
    The trick is to correctly place shapes to be replicated inside of fundamental domain.
    In the simplest one dimensional case illustrated below
    Code:
    var pw = new PeriodicWrap(new Vector3d(a,0,0));
    the fundamental domain (yellow) is infinite slab orthogonal to the period vector a.
    Green circle is completely inside of fundamental domain and it perfectly replicated. Red circle is only partially inside. So, only it's part is replicated.
    Important parameter of PeriodicWrap is its origin. The code
    Code:
    pw.setOrigin(new Vector3d(x,y,z));
    can be used to place the fundamental domain in convenient location. Default value of origin is point (0,0,0).

    pw_diagram.png
     
  4. boxthoughts
    boxthoughts Member
    Thank you for that fantastic explanation, it really cleared things up for me. Can't wait for the blog post on PeriodicWrap.