tensorflow / tensorflow/graphics

Plan to implement Mesh Class

Open
#213 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.8k
Forks
374
PR merge metrics
No merged PRs in 30d

Description

Currently, a mesh is expressed as a dictionary object that has numpy arrays of vertices and faces as elements. However, it is more convenient if we can deal with mesh as object. Some properties and operations related to meshes should be combined as a class, like this:

import trimesh
import numpy as np

class Mesh(object):
    def __init__(self, vertices: np.ndarray, faces: np.ndarray):
        self.vertices = vertices
        self.faces = faces
        # other variables... 

    @classmethod
    def load_obj(cls, filepath: str):
        mesh = trimesh.load(filepath)
        vertices = mesh.vertices.view(np.ndarray)
        faces = mesh.faces.view(np.ndarray)
        return cls(vertices, faces)

   # other methods... 

If we implement such a class, we can use mesh objects as the arguments of the function to compute metrics and losses about the mesh (e.g., Chamfer Distance).

Do you have any idea?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the current dictionary-based mesh representations and the metric and loss APIs mentioned in the issue, including Chamfer Distance. No files or tests are named; done would require an agreed mesh-object design that supports the stated vertices, faces, loading, and metric or loss integration.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.