Skip to content

Conversation

gdey
Copy link
Member

@gdey gdey commented Aug 22, 2018

This pull request is here to discuss the Proposed triangulation interface.
Add the description for an interface for triangulation.

Add the description for an interface for triangulation.
@gdey gdey assigned gdey, ARolek and jasonsurratt and unassigned gdey, ARolek and jasonsurratt Aug 22, 2018
@gdey
Copy link
Member Author

gdey commented Aug 22, 2018

@olt would love to get your input on this as well.


type Interface interface {
// SetPoints sets the nodes to be used in the triangulation
SetPoints(pts []geom.Point, data []interface{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is data?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should SetPoints overwrite all existing points? If not, then I would call it AddPoints.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about error handling? Could there be any conditions where the added points are invalid? When should the triangulation happen? I think either SetPoints or Triangles should be allowed to return an error (if not both).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data is arbitary data that maybe attached to the vertex.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can we access the data? Via geom.Triangle? Is the same data attached to all vertices that are build from pts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point. Maybe Triangles should return a [][3]interface{} for the data associated with each triangle? The more I think about this, the more I think we should drop the metadata, and allow the user to manage that outside of this interface.

Triangles() []geom.Triangle
}

type Constrainer interface {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably come with a bit more description. Maybe reference Constrained Delaunay triangulation?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If AddContraints is always tied to a Triangulator, then I would call this interface ContrainedTriangulator and embed the Triangulator interface:

type ContrainedTriangulator interface {
    Triangulator
    AddConstraints(constraints ...geom.Line) error
}


import "github.com/go-spatial/geom"

type Interface interface {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about Triangulator?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!


type Interface interface {
// SetPoints sets the nodes to be used in the triangulation
SetPoints(pts []geom.Point, data []interface{})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about error handling? Could there be any conditions where the added points are invalid? When should the triangulation happen? I think either SetPoints or Triangles should be allowed to return an error (if not both).

Triangles() []geom.Triangle
}

type Constrainer interface {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If AddContraints is always tied to a Triangulator, then I would call this interface ContrainedTriangulator and embed the Triangulator interface:

type ContrainedTriangulator interface {
    Triangulator
    AddConstraints(constraints ...geom.Line) error
}

@gdey gdey force-pushed the triangulation_interface branch 3 times, most recently from 5f8df51 to 0cdd71d Compare August 24, 2018 18:11
Updated interfaces according to feedback.
@gdey gdey force-pushed the triangulation_interface branch from 0cdd71d to fcb58ca Compare August 24, 2018 18:14
@gdey gdey closed this Mar 8, 2019
gdey added a commit that referenced this pull request Mar 19, 2019
@gdey gdey reopened this Mar 19, 2019
@ear7h
Copy link
Contributor

ear7h commented Nov 5, 2019

closed via #88

@ear7h ear7h closed this Nov 5, 2019
@ear7h ear7h deleted the triangulation_interface branch November 5, 2019 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants