edge.c
Go to the documentation of this file.
1 /* Oct.12, 1990. Bug fix. when r==1, skip ssvdc() because r-1 becomes 0 */
2 
3 #include "arith.h"
4 
5 edge(f,n,planetab,planework,r,linetab,m)
6 MATRIX f;
7 int n; /* n = the row number of C */
8 unsigned int planetab;
9 unsigned int planework;
10 int r; /* r = rankC */
11 LINE linetab[MAXEDGE];
12 int m;
13 {
14  MATRIX fwork,s,e,u,v,work;
15  VECTOR fugo;
16  register int positive,negative;
17  register int i,ii,j,job,info;
18 
19  if(r == 1){
20  v[0][0]= f[0][0]/fabs(f[0][0]);
21  }
22  else{
23  ii=0;
24  for(i=0; ii<r-1; i++)
25  if((planework & (1<<i)) != 0){
26  for(j=0; j<r; j++)
27  fwork[ii][j]= f[i][j];
28  ii += 1;
29  }
30  job=11;
31  info=ssvdc(fwork,r-1,r-1,r,s,e,u,r-1,v,r,work,job);
32  }
33 
34 /*
35  if(s[r-2][r-2] < EPS)
36  return(FALSE);
37 */
38 
39  /* check the new edge is not outside the cone */
40  /* however it may has no meaning, only sign for the edge is required */
41 
42  positive=0;
43  negative=0;
44  for(i=0; i<n; i++){
45  if((planetab & (1<<i)) != 0){
46  fugo[i]=0.0e0;
47  for(j=0; j<r; j++)
48  fugo[i] += f[i][j] * v[j][r-1];
49  if(fugo[i]>EPS){
50  positive = 1;
51  }
52  if(fugo[i]<-EPS){
53  negative = -1;
54  }
55  if((positive * negative) != 0)
56  return(FALSE);
57  }
58  }
59 
60  if(negative == -1){
61  for(j=0; j<r; j++){
62  v[j][r-1]= -v[j][r-1];
63  }
64  }
65 
66  linetab[m].index=TRUE;
67  linetab[m].next=m+1;
68  linetab[m].last=m-1;
69  linetab[m].plane=planework;
70  for(j=0; j<r; j++)
71  linetab[m].s[j]= v[j][r-1];
72  return(TRUE);
73 }
GLfloat n[6][3]
Definition: cube.c:15
REAL VECTOR[MAX]
Definition: arith.h:26
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)
#define MAXEDGE
Definition: arith.h:14
#define TRUE
Definition: arith.h:19
Definition: arith.h:33
#define FALSE
Definition: arith.h:20
short s
Definition: structsize.c:2
VECTOR MATRIX[MAX]
Definition: arith.h:27
GLfloat v[8][3]
Definition: cube.c:21
#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 Thu Jun 6 2019 20:00:43