MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / MoveVert

Function MoveVert

editor/HRoom.cpp:3059–3083  ·  view source on GitHub ↗

Moves a vertex along its two adjacent edges Only moves if the two adjacent edges are colinear

Source from the content-addressed store, hash-verified

3057// Moves a vertex along its two adjacent edges
3058// Only moves if the two adjacent edges are colinear
3059void MoveVert(room *rp, int facenum, int vertnum, float new_position) {
3060 face *fp = &rp->faces[facenum];
3061 vector normal;
3062 float mag;
3063 int prev_vertnum = (vertnum + fp->num_verts - 1) % fp->num_verts;
3064 int next_vertnum = (vertnum + 1) % fp->num_verts;
3065 vector *v0, *v1, newv;
3066
3067 mag = vm_GetNormal(&normal, &rp->verts[fp->face_verts[prev_vertnum]], &rp->verts[fp->face_verts[vertnum]],
3068 &rp->verts[fp->face_verts[next_vertnum]]);
3069
3070 if (mag >= MIN_NORMAL_MAG) {
3071 OutrageMessageBox("Can't move point: edges aren't colinear.");
3072 return;
3073 }
3074
3075 v0 = &rp->verts[fp->face_verts[prev_vertnum]];
3076 v1 = &rp->verts[fp->face_verts[next_vertnum]];
3077
3078 newv = *v0 + (*v1 - *v0) * new_position;
3079
3080 rp->verts[fp->face_verts[vertnum]] = newv;
3081
3082 World_changed = 1;
3083}
3084
3085#include "polymodel.h"
3086

Callers 1

Calls 2

OutrageMessageBoxFunction · 0.85
vm_GetNormalFunction · 0.50

Tested by

no test coverage detected