PistonDevelopers / geometry

A structure for storing and look up 3D geometry
MIT License
6 stars 2 forks source link

Formal editing semantics #18

Open bvssvni opened 9 years ago

bvssvni commented 9 years ago

Work out editing semantics using https://github.com/PistonDevelopers/piston/issues/736. This is necessary to prove that the API design is sufficient for editing applications.

Question: Will storing texture UV and normal with vertex position affect editing semantics?

bvssvni commented 9 years ago
copy(x) -> x, x' where x = x'
edit(x) -> x'
is_used(x, scene) -> bool
is_used_by(x, y) -> bool

A delete might be cancelled if there are objects using on it.

delete(x, scene) -> scene | scene'

A cascading delete removes all objects that depends on the object being deleted.

delete_cascade(x, scene) -> scene'

One action that is helpful for cleaning up a scene is to delete all unused objects.

delete_unused(scene) -> scene'
bvssvni commented 9 years ago

An naive vertex format containing a position, uv coordinates for a single texture, and a normal:

pos(vertex) -> x, y, z
uv(vertex) -> x, y
normal(vertex) -> x, y, z

Editing:

set_pos(vertex, x, y, z) -> vertex'
set_uv(vertex, x, y) -> vertex'
set_normal(vertex, x, y, z) -> vertex'

Can derive that set_pos, set_uv and set_normal matches editing functions:

d = vertex, x, y, z
d = vertex', x, y, z
set_pos(d) -> d'
edit(d) -> d'
edit(x) -> x'
bvssvni commented 9 years ago

The upper bound on information required to check whether an object is used in hierarchical contiguous arrays is the level where no range includes the object or points to a range that does.

bvssvni commented 9 years ago

In the case where two different geometries share a vertex, there must be some information that tells it is shared to move both vertices. This will happen when two edges of different materials meet.

bvssvni commented 9 years ago

When a triangle get subdivided into smaller triangles, it keeps the same position/uv/normal values for the corner vertices.