{"id":19071089,"url":"https://github.com/mokiat/java-data-off","last_synced_at":"2025-08-22T01:03:41.450Z","repository":{"id":18106173,"uuid":"21175379","full_name":"mokiat/java-data-off","owner":"mokiat","description":"A Java library for reading OFF 3D model resources.","archived":false,"fork":false,"pushed_at":"2022-01-18T20:00:42.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-02T16:14:43.512Z","etag":null,"topics":["decoder","java","off","parser"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mokiat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-24T18:06:00.000Z","updated_at":"2023-11-27T01:02:34.000Z","dependencies_parsed_at":"2022-09-07T01:23:12.553Z","dependency_job_id":null,"html_url":"https://github.com/mokiat/java-data-off","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokiat%2Fjava-data-off","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokiat%2Fjava-data-off/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokiat%2Fjava-data-off/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokiat%2Fjava-data-off/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mokiat","download_url":"https://codeload.github.com/mokiat/java-data-off/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240122574,"owners_count":19751142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decoder","java","off","parser"],"created_at":"2024-11-09T01:22:20.011Z","updated_at":"2025-02-22T03:44:53.011Z","avatar_url":"https://github.com/mokiat.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"java-data-off\n=============\n\n![maven verify status](https://github.com/mokiat/java-data-off/actions/workflows/maven.yml/badge.svg?branch=master)\n\nA Java library that enables you to read Object File Format (*.OFF) files and resources.\n\nThe Object File Format allows one to store 3D models into simple plain text format. Though not as popular as the alternative OBJ file format, it is still used in some applications. Files of this format generally look something like the following.\n\n```\nOFF\n4 2 0\n-1.0 1.0 0.0\n-1.0 -1.0 0.0\n1.0 -1.0 0.0\n1.0 1.0 0.0\n3 0 1 2\n3 0 2 3\n```\n\nYou can find more information and sample models at these links:\n\n- [Wikipedia](http://en.wikipedia.org/wiki/OFF_\\(file_format\\))\n- [Princeton](http://shape.cs.princeton.edu/benchmark/documentation/off_format.html)\n- [Holmes3D](http://www.holmes3d.net/graphics/offfiles/)\n\n\n## Loading OFF models\n\nUsing this library is meant to be easy and straightforward. All you need to do is instantiate an\n`OffLoader` and pass it an `InputStream` to your OFF resource.\n\n**Example:**\n\n```java\n// Open a stream to your OFF resource\ntry (InputStream in = new FileInputStream(\"example.off\")) {\n\t// Create an OffLoader and parse the resource\n\tfinal IOffLoader loader = new OffLoader();\n\tfinal OffObject object = loader.load(in);\n\n\t// Use the model representation to get some basic info\n\tSystem.out.println(MessageFormat.format(\n\t\t\t\"OFF object loaded with {0} vertices and {1} faces.\",\n\t\t\tobject.getVertices().size(),\n\t\t\tobject.getFaces().size()));\n}\n```\n\nThe idea behind the library's API is that you end up with an `OffObject` Java model representation of the resource that is parsed. By navigating through the model, you could easily reconstruct the 3D model. Additionally, the Java model is mutable, so you are able to make corrections to the 3D object.\n\n**Example:**\n\n```java\ntry (InputStream in = new FileInputStream(\"example.off\")) {\n\tfinal IOffLoader loader = new OffLoader();\n\tfinal OffObject object = loader.load(in);\n\n\tSystem.out.println(\"OFF Object with faces:\");\n\tint faceIndex = 0;\n\tfor (OffFace face : object.getFaces()) {\n\t\tfaceIndex++;\n\t\tSystem.out.println(MessageFormat.format(\n\t\t\t\t\"\\tFace with vertices:\", faceIndex));\n\n\t\tfor (Integer reference : face.getVertexReferences()) {\n\t\t\tfinal OffVertex vertex = object.getVertex(reference);\n\t\t\tSystem.out.println(MessageFormat.format(\n\t\t\t\t\t\"\\t\\tVertex with coordinates: ({0}, {1}, {2})\", vertex.x, vertex.y, vertex.z));\n\t\t}\n\t}\n}\n```\n\n\n## Setting Up\n\nEven though this project relies on Maven for packaging, it has not been published to the central Maven repository. Following are a number of approaches to get the library imported in your project.\n\n### JitPack\n\nAn amazing web page that allows one to import Maven projects directly from GitHub. It is ideal for publishing new and small projects like this one.\nOne only needs to add the following configuration in their `pom.xml` file to get the library included.\n\n```xml\n\u003crepositories\u003e\n\t\u003crepository\u003e\n\t\t\u003cid\u003ejitpack.io\u003c/id\u003e\n\t\t\u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n\t\u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependencies\u003e\n\t\u003cdependency\u003e\n\t\t\u003cgroupId\u003ecom.github.mokiat\u003c/groupId\u003e\n\t\t\u003cartifactId\u003ejava-data-off\u003c/artifactId\u003e\n\t\t\u003cversion\u003ev2.0.1\u003c/version\u003e\n\t\u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\nJitPack works with other packaging frameworks as well. Check the [official webpage](https://jitpack.io/) for more information.\n\n### Packaging\n\nIf `JitPack` is not an option for your use case, then you could package the `jar` files into your project. They are available for download from the [Releases](https://github.com/mokiat/java-data-off/releases) section of the repository.\n\n\n### Local Maven repository\n\nYou can use a set of commands to import the `jar` files into your local Maven repository. Following are two available approaches. (I find the first one to do the job)\n\n* [http://maven.apache.org/plugins/maven-install-plugin/examples/custom-pom-installation.html](http://maven.apache.org/plugins/maven-install-plugin/examples/custom-pom-installation.html)\n* [http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html](http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmokiat%2Fjava-data-off","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmokiat%2Fjava-data-off","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmokiat%2Fjava-data-off/lists"}