<commit_before>3p: Progressive Triangle Streams
================================

**WORK IN PROGRESS**

Progressive triangle streams are an implementation of [<NAME>'s progressive meshes](http://research.microsoft.com/en-us/um/people/hoppe/proj/pm/) with minor modifications favoring fast decoding over visual fidelity. The format is flexible and different codecs can choose different strategies for splitting vertices. This module documents progressive triangle streams and implements reference codecs for the binary and JSON formats.

## Why use 3p?

Progressive meshes have two advantages over standard mesh representations like indexed face lists:

1. They are typically much smaller.  In a binary 3P file, the topology data of the mesh uses 1/4 as much space as in a binary indexed triangle mesh and up to 1/10 as much space as an ASCII encoded equivalent.
2. They can be loaded incrementally.  It is possible to process a truncated 3P file and recover an approximate geometry immediately. This decreases the amount of time spent waiting for geometry to load.

Like the PLY file format, 3P files can specify arbitrary vertex and face data. 3P is also a lossless encoding, so attributes like vertex positions are not truncated in intermediate representations. 3P can be combined with standard HTTP compression schemes like gzip for further size reductions.

## Other implementations

* TODO: Implement separate streaming parser

# Reference Codec API

These reference codecs are installable via npm:

```
npm install 3p
```

Once installed, they can be required and used as CommonJS modules.

**Note** Reference codecs are not optimized.

## Encoder

### JSON

##### `require('3p/encode-json')(vertexCount, cells[, vertexAttributes, cellAttributes, vertexTypes, cellTypes])`

Compresses a triangulated mesh into a JSON formatted progressive triangle stream.

* `cells` is a list of triangles, each encoded as a list of 3 vertex indices
* `vertexAttributes` is an optional array of vertex attributes
* `cellAttributes` is an optional array of per-face attributes

**Returns** A 3PJ encoded mesh object

### Binary

##### `require('3p/encode-binary')(vertexCount, cells[, vertexAttributes, cellAttributes, vertexTypes, cellTypes])`
<commit_msg>added note on objective<commit_after>3p: Progressive Triangle Streams
================================

Progressive triangle streams are an implementation of [<NAME>'s progressive meshes](http://research.microsoft.com/en-us/um/people/hoppe/proj/pm/) with minor modifications favoring fast decoding over visual fidelity. The format is flexible and different codecs can choose different strategies for splitting vertices. This module documents progressive triangle streams and implements reference codecs for the binary and JSON formats.  The intention of this file format is to provide a basic container format for experimenting with different strategies for performing edge collapses on meshes, and to provide a common language for processing progressive mesh data.

## Why use 3p?

Progressive meshes have two advantages over standard mesh representations like indexed face lists:

1. They are typically much smaller.  In a binary 3P file, the topology data of the mesh uses 1/4 as much space as in a binary indexed triangle mesh and up to 1/10 as much space as an ASCII encoded equivalent.
2. They can be loaded incrementally.  It is possible to process a truncated 3P file and recover an approximate geometry immediately. This decreases the amount of time spent waiting for geometry to load.

Like the PLY file format, 3P files can specify arbitrary vertex and face data. 3P is also a lossless encoding, so attributes like vertex positions are not truncated in intermediate representations. 3P can be combined with standard HTTP compression schemes like gzip for further size reductions.

## Other implementations

# Reference Codec API

These reference codecs are installable via npm:

```
npm install 3p
```

Once installed, they can be required and used as CommonJS modules.

**Note** Reference codecs are not optimized.

## Encoder

### JSON

##### `require('3p/encode-json')(vertexCount, cells[, vertexAttributes, cellAttributes, vertexTypes, cellTypes])`

Compresses a triangulated mesh into a JSON formatted progressive triangle stream.

* `cells` is a list of triangles, each encoded as a list of 3 vertex indices
* `vertexAttributes` is an optional array of vertex attributes
* `cellAttributes` is an optional array of per-face attributes

**Returns** A 3PJ encoded mesh object

### Binary

##### `require('3p/encode-binary')(vertexCount, cells[, vertexAttributes, cellAttributes, vertexTypes, cellTypes])`

{'fraction_non_alphanumeric': 0.07159699892818863, 'fraction_numerical': 0.008145766345123259, 'mean_word_length': 5.139473684210526, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '33803', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1060, 'n_words': 614}