cone.c
Go to the documentation of this file.
1 #include "arith.h"
2 
3 cone(x,n,p,w)
4 MATRIX x;
5 int n,p;
7 {
8  MATRIX u,s,v,f;
9  REAL fugo,fugo_calc();
10  LINE linetab[MAXEDGE];
11  register int i,j,en,ii,mi,m,mm,det,start,nn;
12  register unsigned int planetab,planework;
13  int ssvdc(),r[MAX];
14 
15  /* pre process, f= U1Drr */
16  planetab=cone_pre(x,n,p,u,s,v,r,f);
17 
18  /* ask the edges of the initial cone */
19  m=0;
20  for(i=0; m<r[n]; i++){
21  if((planetab & (1<<i)) != 0){
22  planework=planetab & ~(1<<i);
23  det=edge(f,n,planetab,planework,r[n],linetab,m);
24  face_init(linetab,m,r[n]);
25  m += 1;
26  }
27  }
28 
29  /* cut the initial cone by the remaining hyperplane */
30  start=0; mi=m; mm=m;
31  for(i=0; i<n; i++){
32  /* check if hyperplane(i) is not used for the initial cone */
33  if((planetab & (1<<i)) == 0){
34  planetab= planetab | (1<<i);
35  for(en=start; en<m; en=linetab[en].next){
36  fugo= fugo_calc(f,linetab,i,en,r[n]);
37  /* when edge(en) is outside the hyperplane(i), create new edges */
38  if(fugo < -EPS){
39  /* delete edge(en) from the edge table and update the pointers */
40  start= update_edge(linetab,en,start);
41  for(ii=0; linetab[en].face[ii] != EMPTY; ii++){
42  /* nn is the edge number sharing a common face with edge(en) */
43  nn=linetab[en].face[ii];
44  /* when edge(nn) is not outside the cone, the index is TRUE */
45  if(linetab[nn].index == TRUE){
46  fugo= fugo_calc(f,linetab,i,nn,r[n]);
47  /* when edge(nn) is not outside the cone, create a new edge */
48  /* next test is (fugo >= 0.0) if no numerical error exists */
49  if(fugo > -EPS){
50  /* planework is the common hyperplane between en and nn, */
51  /* and the new hyperplane(i) */
52  planework = linetab[en].plane & linetab[nn].plane;
53  planework = planework | (1<<i);
54  det=edge(f,n,planetab,planework,r[n],linetab,mm);
55  if(det == TRUE){ /* det is always TRUE in this case */
56  /* update the pointers between edge(nn) and the new edge */
57  for(j=0; linetab[nn].face[j] != en; j++)
58  ;
59  linetab[nn].face[j]=mm;
60  linetab[mm].face[0]=nn;
61  mm += 1;
62  }
63  }
64  }
65  }
66  }
67  }
68  m=mm;
69  /* update the face pointers among new edges on the new hyperplane(i) */
70  face(linetab,mi,m,r[n],n);
71  }
72  mi=m;
73  }
74 
75  /* post process */
76  en=cone_post(s,v,r,n,linetab,start,m,w);
77  return(en);
78 }
f
#define EMPTY
Definition: arith.h:21
GLfloat n[6][3]
Definition: cube.c:15
unsigned int plane
Definition: arith.h:38
ssvdc(MATRIX xarg, int ldx, int n, int p, MATRIX s, MATRIX e, MATRIX u, int ldu, MATRIX v, int ldv, MATRIX work, int job)
double REAL
Definition: arith.h:25
#define MAXEDGE
Definition: arith.h:14
#define MAX
Definition: arith.h:12
face_init(linetab, int m, int r)
Definition: face_init.c:3
#define TRUE
Definition: arith.h:19
int face[MAXRANK]
Definition: arith.h:37
cone_pre(MATRIX x, int n, int p, MATRIX u, MATRIX s, MATRIX v, r, MATRIX f)
Definition: cone_pre.c:7
cone_post(MATRIX s, MATRIX v, r, n, linetab, int start, int m, w)
Definition: cone_post.c:5
Definition: arith.h:33
face(linetab, int mi, int m, int r, int n)
Definition: face.c:5
short s
Definition: structsize.c:2
cone(MATRIX x, int n, int p, w)
Definition: cone.c:3
#define MAXRANK
Definition: arith.h:13
static time_stamp_t start
Definition: rgc_utils.c:75
char * index(char *sp, char c)
Definition: eustags.c:1669
VECTOR MATRIX[MAX]
Definition: arith.h:27
int next
Definition: arith.h:35
GLfloat v[8][3]
Definition: cube.c:21
int update_edge(linetab, int en, int start)
Definition: update_edge.c:6
REAL fugo_calc(MATRIX f, linetab, int i, int en, int r)
Definition: fugo_calc.c:3
#define EPS
Definition: arith.h:15
edge(MATRIX f, int n, unsigned int planetab, unsigned int planework, int r, linetab, int m)
Definition: edge.c:5


euslisp
Author(s): Toshihiro Matsui
autogenerated on Mon Feb 28 2022 22:18:27