Commit 2f64ad2c authored by TheNumbat's avatar TheNumbat
Browse files

change halfedge placement

parent c2535f0f
cmake_minimum_required(VERSION 3.17) cmake_minimum_required(VERSION 2.8)
# define project # define project
......
...@@ -283,11 +283,11 @@ void Model::halfedge_viz(Halfedge_Mesh::HalfedgeRef h, Mat4 &transform) { ...@@ -283,11 +283,11 @@ void Model::halfedge_viz(Halfedge_Mesh::HalfedgeRef h, Mat4 &transform) {
float v0s = vert_sizes[v_0->id()], v1s = vert_sizes[v_1->id()]; float v0s = vert_sizes[v_0->id()], v1s = vert_sizes[v_1->id()];
float s = 0.3f * (v0s < v1s ? v0s : v1s); float s = 0.3f * (v0s < v1s ? v0s : v1s);
// Move to center of edge and towards center of face // Move to center of edge and away from edge
Vec3 offset = (v1 - v0) * 0.2f; Vec3 offset = (v1 - v0) * 0.2f;
Vec3 face = h->face()->center(); Vec3 face_n = h->face()->normal();
Vec3 avg = 0.5f * (v0 + v1); Vec3 avg = 0.5f * (v0 + v1);
offset += (face - avg).unit() * s * 0.2f; offset += cross(face_n, dir).unit() * s * 0.2f + face_n * s * 0.05f;
// Align edge // Align edge
if (dir.y == 1.0f || dir.y == -1.0f) { if (dir.y == 1.0f || dir.y == -1.0f) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment