Skip to content

Triangulation creates new points instead of reusing old ones #22

Description

@JaminKoke

I'm trying to map the output points of the triangulation to the input points, but that is not easy apparently!

A simple example I thought would work:

#[derive(Copy, Clone)]
struct PointLink {
    x: f32,
    y: f32,
    // Index to the original point in the vertex buffer that was used to create this
    original_index: u32,
}

impl FloatPointCompatible for PointLink {
    type Scalar = f32;

    fn x(&self) -> Self::Scalar {
        self.x
    }

    fn y(&self) -> Self::Scalar {
        self.y
    }

    // This gets called inside of a triangulation despite not needing to create new points?
    fn from_xy(x: Self::Scalar, y: Self::Scalar) -> Self {
        panic!("Should not be creating new points; Otherwise we don't know where the point is in the vertex array");
    }
}

My use case is that I have a 3d model I want to triangulate, and then map the triangulation to 3d. However the from_xy function gets called, meaning we loose all context as to what the original vertex is.

Is there a different way to accomplish what I'm trying to do, or is this something that needs to be fixed?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions