Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 125995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:14:50+00:00 2026-05-11T05:14:50+00:00

I am attempting to build a .PLY parser to load 3d models stored as

  • 0

I am attempting to build a .PLY parser to load 3d models stored as .ply files into a half edge data structure mesh.

Sorry for the huge question, I’m very verbose and I wanted to make sure I laid out all the details. Because of this, I’ll restate my ultimate goals immediately, just so users can see can get an idea of what i want before reading the giant block of text to follow.

1) What would be a good hash for memoizing half-edges from a .PLY file’s vertex and face list

or

2) Is there a better approach to filling my half-edge structure from the data in a .PLY file?


The .PLY file lists the vertices, followed by the faces of the mesh. The obvious solution is to fill in the vertice table first, then generate the edge table using the faces list. The problem is that every edge has a partner edge, so for a quad-mesh, the first quad I load in will require 8 half edges. This isnt initially a problem, simply create the four half-edges for the face and reverse each edge to make their partner half edge. The problem here is that this creates 4 dangling half edges that associate with 4 different faces.

So there are two methods of attack: First generate all edges for the faces, then try to pair up partner edges. I really dont like this approach, it seems programmatically less efficient as it will involve a lot of searching and sorting.

Second: proceed as first stated: start with the first face specified and generate the edges required to create the polygon, and as the edges are created also create their twins. However, we’ll memoize the edge list, so all edges will hash into a table. Then, when we generate edges for the other faces, if an edge is already generated (because it’s a partner edge for a previous loaded face), we will simply grab the pointer out of the table.

This is where I’m stuck. I need an intelligent hashing function for memoizing my edge list. Collisions need to be minimized to increase efficiency. The scheme that I have in mind right now is to name* edges based on the two vertices that created them, IE edges 01 and 10 are twins. The worst case scenario would create a hash table in which all vertices could possibly be joined, and this would end up being size 2^n where n = number of vertices, which is completely unacceptible. My goal is to have the hash as close to the number of actual edges ( = sum of number of edges per face) while still minimizing collisions.

*Note: because half-edges enforce a ‘Counter-clockwise ONLY’ draw scheme, it is not possible to have a name collision. By naming edges based on the two vertices that draw them, we insure that all names are unique to a single half-edge.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:14:51+00:00Added an answer on May 11, 2026 at 5:14 am

    I’m very verbose

    You might want to to something about that.

    A trivial way to has an edge is by the indexes of its two vertices. To make it unique take the smaller index first and the larger index second. Something like this:

    uint hash(const Vertex& v1, const Vertex& v2) {     int i1 = v1.index;     int i2 = v2.index;     if (i1 > i2)         swap(i1, i2);     return (i1 | (i2 << 16)); } 

    In the actual data pointed by this hash table you will probably want to keep track of which pair you’ve seen already and which pair (the opposite one) you’re expecting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to build a relatively complex data structure (for me). My goal
I'm attempting to build a web app and I've run into a bit of
I'm attempting to build a search stored procedure. I want to search multiple tables
I'm attempting to build/install Cabal on my system and I'm running into the following
I am attempting to build a simple method that creates an XML file from
Hopefully some Custom Control Designers/Builders can help I'm attempting to build my first custom
Context: So, I am attempting to build a ridiculously complex domain model. Talking with
Attempting to insert an escape character into a table results in a warning. For
I am attempting to build a Tabbed side navigation menu using html/css. I am
I'm attempting to build Python 2.6.2 from source on my Linux system. It has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.