SIF Tori

This is a short comparison of how you would represent a square torus in SFF, DSG, and 2D SIF.


SIF_SFF

This example uses the Triangle Mesh facility of SIF_SFF.

(* Torus *)
(SIF_SFF 0 5
  (units 1)
  (coord_precision (e 1 -3))

  (body 
    (lump
      (shell
        (v 0 1 1 1)
        (v 1 -1 1 1)
        (v 2 -1 -1 1)
        (v 3 1 -1 1)
        (v 4 1 1 -1)
        (v 5 -1 1 -1)
        (v 6 -1 -1 -1)
        (v 7 1 -1 -1)
        (v 8 3 3 1)
        (v 9 -3 3 1)
        (v 10 -3 -3 1)
        (v 11 3 -3 1)
        (v 12 3 3 -1)
        (v 13 -3 3 -1)
        (v 14 -3 -3 -1)
        (v 15 3 -3 -1)

        (taf 
          (r 0 1 2 3 0)
          (r 8 9 10 11 8)
          (r 12 13 14 15 12)
          (r 4 5 6 7 4)
          (r 0 1 2 3 0)
        )
      )
    )
  )
)

SIF_SFF

This example uses the nested face loop facility of SIF_SFF.

(* Torus *)
(SIF_SFF 0 5
  (units 1)
  (coord_precision (e 1 -3))

  (* This is the Stock description *)
  (* Cube *)
  (body 
    (lump
      (shell
        (v 0 3 3 1)
        (v 1 3 -3 1)
        (v 2 3 -3 -1)
        (v 3 3 3 -1)
        (v 4 -3 3 1)
        (v 5 -3 -3 1)
        (v 6 -3 -3 -1)
        (v 7 -3 3 -1)
        (v 8 1 1 1)
        (v 9 -1 1 1)
        (v 10 -1 -1 1)
        (v 11 1 -1 1)
        (v 12 1 1 -1)
        (v 13 -1 1 -1)
        (v 14 -1 -1 -1)
        (v 15 1 -1 -1)

        (* Front Face *)
        (f 0 1 2 3) 
        (* Back Face *)
        (f 7 6 5 4) 
        (* Right Face *)
        (f 0 3 7 4) 
        (* Left Face *)
        (f 2 1 5 6) 
        (* Top Face *)
        (face (loop 1 0 4 5 (loop 11 10 9 8)) 
        (* Bottom Face *)
        (face (loop 3 2 6 7 (loop 12 13 14 15)) 

        (f 8 9 13 12)
        (f 9 10 14 13)
        (f 10 11 15 14)
        (f 11 8 12 15)
      )
    )
  )
)

SIF_DSG

(* Torus *)
(SIF_DSG 0 5
  (units 1)
  (coord_precision (e 1 -3))
  (corner_radius (e 1 -3))

  (* This is the Stock description *)
  (* Cube *)
  (body 
    (lump
      (shell
        (v 0 3 3 1)
        (v 1 3 -3 1)
        (v 2 3 -3 -1)
        (v 3 3 3 -1)
        (v 4 -3 3 1)
        (v 5 -3 -3 1)
        (v 6 -3 -3 -1)
        (v 7 -3 3 -1)

        (* Front Face *)
        (f 0 1 2 3) 
        (* Back Face *)
        (f 7 6 5 4) 
        (* Right Face *)
        (f 0 3 7 4) 
        (* Left Face *)
        (f 2 1 5 6) 
        (* Top Face *)
        (f 1 0 4 5) 
        (* Bottom Face *)
        (f 3 2 6 7) 
      )
    )
  )

  (* The Reference plane begins as the XY plane in space and its orientation and 
   * origin are transformed to a reference point on a face where features can then
   * be defined in that local coordinate system.
   * In this example the local origin will be in the middle of the face. 
   *)

  (* Top Face Features *)
  (refplane 
    (translate 0 0 1)

    (v 0 1 1 0)
    (v 1 -1 1 0)
    (v 2 -1 -1 0)
    (v 3 1 -1 0)

    (pocket (e 15 -1) (e 1 -3) (loop 0 1 2 3))
  )

  (* Top Face Features *)
  (refplane 
    (rotate 1 0 0 180)
    (translate 0 0 -1)

    (v 0 1 1 0)
    (v 1 -1 1 0)
    (v 2 -1 -1 0)
    (v 3 1 -1 0)

    (pocket (e 15 -1) (e 1 -3) (loop 0 1 2 3))
  )
)

SIF_2D

(* Torus *)
(SIF_2D 0 5
  (units 1)
  (coord_precision (e 1 -3))
  (stock_depth 2)

  (body 
    (v 0 3 3 0)
    (v 1 -3 3 0)
    (v 2 -3 -3 0)
    (v 3 3 -3 0)
    (v 4 1 1 0)
    (v 5 1 -1 0)
    (v 6 -1 -1 0)
    (v 7 -1 1 0)

    (face (loop 0 1 2 3 (loop 4 5 6 7)) 
  )
)