Paste: GML

Author: slava
Mode: factor
Date: Mon, 31 May 2010 05:51:12
Plain Text |
[ ] [
    [
        0 1 make-vefs
        dup
        2 3 [ make-ev-one ] bi@
        [ opposite-edge>> ] dip make-ef

        7 make-ev-one
        dup face-ccw face-ccw


        4 5 6 [
            make-ev-one
            make-ef vertex-cw
            dup face-ccw face-ccw
        ] tri@
        face-ccw make-ef

        opposite-edge>> 8 make-ev-one
        dup opposite-edge>>
        '[
            dup face-ccw face-ccw
            dup _ eq? [ drop f ] [ make-ef opposite-edge>> t ] if
        ] loop
        drop
    ] make-b-rep
    {
        [ check-b-rep ]
        [ faces>> length 9 assert= ]
        [ vertices>> length 9 assert= ]
        [ edges>> length 32 assert= ]
    } cleave
] unit-test

Annotation: gml

Author: slava
Mode: factor
Date: Mon, 31 May 2010 05:53:18
Plain Text |
usereg

(1,1,1) !v0
(1,0,1) !v1
(0,0,1) !v2
(0,1,1) !v3

(1,1,0) !v4
(1,0,0) !v5
(0,0,0) !v6
(0,1,0) !v7

:v0 :v1 makeVEFS dup
[ :v2 :v3 ]
{ makeEVone } forall
exch edgemate exch makeEF

:v7 makeEVone
dup faceCCW faceCCW
[ :v4 :v5 :v6 ]
{
    makeEVone
    makeEF vertexCW
    dup faceCCW faceCCW
} forall
faceCCW makeEF

edgemate !e
:e :e facemidpoint
:e facenormal add

!p !e
:e :p makeEVone
dup edgemate !e
{
    dup faceCCW faceCCW
    dup :e eq { exit } if
    makeEF edgemate
} loop

pop pop

New Annotation

Summary:
Author:
Mode:
Body: