From 24a23e477b6a7e098398fdee3fefe59da9c0a38f Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 25 Jul 2019 12:18:13 +0200 Subject: [PATCH] support for weighted 3dwalls --- hyper.h | 4 +++- polygons.cpp | 43 ++++++++++++++++++++++--------------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/hyper.h b/hyper.h index 0c9eb5ba..805278e0 100644 --- a/hyper.h +++ b/hyper.h @@ -4361,6 +4361,8 @@ static const int WINGS = (BADMODEL ? 1 : 4); typedef array hpcshape_animated; +extern vector equal_weights; + struct geometry_information { /* basic geometry parameters */ @@ -4577,7 +4579,7 @@ hpcshape void pushShape(usershapelayer& ds); void make_sidewalls(); void procedural_shapes(); - void make_wall(int id, vector vertices, bool force_triangles = false); + void make_wall(int id, const vector vertices, vector weights = equal_weights); void create_wall3d(); void configure_floorshapes(); diff --git a/polygons.cpp b/polygons.cpp index dd702d29..3926ed7b 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -682,12 +682,11 @@ void geometry_information::procedural_shapes() { #if CAP_BT && MAXMDIM >= 4 -// Make a wall for horocycle-based honeycombs -// flags: -// 1 = first edge should be doubled -// 2 = use POLY_TRIANGLES -// 4 = this is is a triangular face; otherwise, the face is rectangular, and x1+x2-x0 is the fourth vertex -void geometry_information::make_wall(int id, vector vertices, bool force_triangles) { +// Make a wall + +vector equal_weights(20, 1); + +void geometry_information::make_wall(int id, vector vertices, vector weights) { using namespace hyperpoint_vec; // orient correctly @@ -697,7 +696,8 @@ void geometry_information::make_wall(int id, vector vertices, bool f set_column(T, 2, vertices[2]); set_column(T, 3, C0); if(det(T) < 0) - reverse(vertices.begin(), vertices.end()); + reverse(vertices.begin(), vertices.end()), + reverse(weights.begin(), weights.end()); ld yy = log(2) / 2; @@ -705,9 +705,10 @@ void geometry_information::make_wall(int id, vector vertices, bool f last->flags |= POLY_TRIANGLES; hyperpoint center = Hypc; - for(auto v: vertices) center += v; int n = isize(vertices); - center /= n; + ld w = 0; + for(int i=0; i vertices; for(int a=0; a