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 }
face
face(linetab, int mi, int m, int r, int n)
Definition: face.c:5
cone
cone(MATRIX x, int n, int p, w)
Definition: cone.c:3
ssvdc
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)
Definition: contrib/contact/clib/ssvdc.c:11
s
short s
Definition: structsize.c:2
arith.h
TRUE
#define TRUE
Definition: arith.h:19
face_init
face_init(linetab, int m, int r)
Definition: face_init.c:3
cone_pre
cone_pre(MATRIX x, int n, int p, MATRIX u, MATRIX s, MATRIX v, r, MATRIX f)
Definition: cone_pre.c:7
update_edge
int update_edge(linetab, int en, int start)
Definition: update_edge.c:6
line::face
int face[MAXRANK]
Definition: arith.h:37
line::plane
unsigned int plane
Definition: arith.h:38
cone_post
cone_post(MATRIX s, MATRIX v, r, n, linetab, int start, int m, w)
Definition: cone_post.c:5
EPS
#define EPS
Definition: arith.h:15
MAXEDGE
#define MAXEDGE
Definition: arith.h:14
line
Definition: arith.h:33
edge
edge(MATRIX f, int n, unsigned int planetab, unsigned int planework, int r, linetab, int m)
Definition: edge.c:5
f
f
REAL
double REAL
Definition: arith.h:25
start
static time_stamp_t start
Definition: rgc_utils.c:75
MATRIX
VECTOR MATRIX[MAX]
Definition: arith.h:27
fugo_calc
REAL fugo_calc(MATRIX f, linetab, int i, int en, int r)
Definition: fugo_calc.c:3
EMPTY
#define EMPTY
Definition: arith.h:21
MAX
#define MAX
Definition: arith.h:12
index
char * index(char *sp, char c)
Definition: eustags.c:1669
line::next
int next
Definition: arith.h:35
MAXRANK
#define MAXRANK
Definition: arith.h:13
n
GLfloat n[6][3]
Definition: cube.c:15
v
GLfloat v[8][3]
Definition: cube.c:21


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43