<commit_before>package triangulations;
    // Created abstraction to make 't' cleaner to use.
    // Quote from 'findingEnclosedTriangle'
    // Indexing triangles here involves some evil hacking. 
    // A triangle is represented by an edge and a vertex of its co-edge.
    // Suppose the edge in question has number j, and k is 0 or 1 depending on which
    // co-edge vertex is chosen. Then the triangle index is t = 2 * j + k.
    
    // Introduced some abstracts to reduce the hack - t now uses TriangleIndex and j, k is EdgeVertexTriangle 
    
import triangulations.EdgeVertexTriangle;

abstract TriangleIndex( Int ) to Int from Int {
    inline public function new( t : Int) {
        this = t;
    }
    inline public function edgeVertexTriangle(){
        var vertexId = Std.int( this % 2 );
        var edgeId = Std.int( ( this - vertexId ) / 2 );
        return new EdgeVertexTriangle( edgeId, vertexId );
    }
    @:from
    static public function fromEdgeVertex( ev: EdgeVertexTriangle ) {
        return new TriangleIndex( 2 * ev.edgeId + ev.vertexId );
    }
}<commit_msg>add getFace<commit_after>package triangulations;
    // Created abstraction to make 't' cleaner to use.
    // Quote from 'findingEnclosedTriangle'
    // Indexing triangles here involves some evil hacking. 
    // A triangle is represented by an edge and a vertex of its co-edge.
    // Suppose the edge in question has number j, and k is 0 or 1 depending on which
    // co-edge vertex is chosen. Then the triangle index is t = 2 * j + k.
    
    // Introduced some abstracts to reduce the hack - t now uses TriangleIndex and j, k is EdgeVertexTriangle 
    
import triangulations.EdgeVertexTriangle;

abstract TriangleIndex( Int ) to Int from Int {
    inline public function new( t : Int) {
        this = t;
    }
    inline public function edgeVertexTriangle(){
        var vertexId = Std.int( this % 2 );
        var edgeId = Std.int( ( this - vertexId ) / 2 );
        return new EdgeVertexTriangle( edgeId, vertexId );
    }
    @:from
    static public function fromEdgeVertex( ev: EdgeVertexTriangle ) {
        return new TriangleIndex( 2 * ev.edgeId + ev.vertexId );
    }
    inline public function getFace( edges: Edges, coEdges: Edges ){
        var face: Face = null;
        if( this != null ) {
            var ev = edgeVertexTriangle();
            face = [  edges[ ev.edgeId ].p
                    , edges[ ev.edgeId ].q
                    , ( ev.vertexId == 0 )?coEdges[ ev.edgeId ].p: coEdges[ ev.edgeId ].q  ];
        }
        return face;    
    }
}
{'fraction_non_alphanumeric': 0.08560311284046693, 'fraction_numerical': 0.005058365758754864, 'mean_word_length': 2.3260025873221215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4531239', 'n_tokens_mistral': 766, 'n_tokens_neox': 727, 'n_words': 294}