| | 2101 | int all_adjacency_regression( iMesh_Instance mesh ) |
| | 2102 | { |
| | 2103 | int err; |
| | 2104 | |
| | 2105 | double coords[] = { 0,0,0, 1,1,1 }; |
| | 2106 | |
| | 2107 | iBase_EntityHandle *verts = NULL; |
| | 2108 | int verts_alloc = 0,verts_size; |
| | 2109 | |
| | 2110 | iBase_EntityHandle line; |
| | 2111 | int status; |
| | 2112 | |
| | 2113 | iBase_EntityHandle *adj = NULL; |
| | 2114 | int adj_alloc = 0,adj_size; |
| | 2115 | |
| | 2116 | iMesh_newMesh("",&mesh,&err,0); |
| | 2117 | if (iBase_SUCCESS != err) return 0; |
| | 2118 | |
| | 2119 | iMesh_createVtxArr(mesh,2,iBase_INTERLEAVED,coords,6,&verts,&verts_alloc, |
| | 2120 | &verts_size,&err); |
| | 2121 | if (iBase_SUCCESS != err) return 0; |
| | 2122 | |
| | 2123 | iMesh_createEnt(mesh,iMesh_LINE_SEGMENT,verts,2,&line,&status,&err); |
| | 2124 | if (iBase_SUCCESS != err || status != iBase_NEW) return 0; |
| | 2125 | |
| | 2126 | iMesh_getEntAdj(mesh,verts[0],iBase_ALL_TYPES,&adj,&adj_alloc,&adj_size, |
| | 2127 | &err); |
| | 2128 | if (iBase_SUCCESS != err) return 0; |
| | 2129 | if(adj_size != 1 || adj[0] != line) { |
| | 2130 | printf("Bad: couldn't find adjacency for vertex\n"); |
| | 2131 | return 0; |
| | 2132 | } |
| | 2133 | free(adj); |
| | 2134 | |
| | 2135 | adj_alloc = adj = 0; |
| | 2136 | iMesh_getEntAdj(mesh,line,iBase_ALL_TYPES,&adj,&adj_alloc,&adj_size, |
| | 2137 | &err); |
| | 2138 | if (iBase_SUCCESS != err) return 0; |
| | 2139 | if(adj_size != 2 || ((adj[0] != verts[0] || adj[1] != verts[1]) && |
| | 2140 | (adj[0] != verts[1] || adj[1] != verts[0])) ) { |
| | 2141 | printf("Bad: couldn't find adjacencies for line\n"); |
| | 2142 | return 0; |
| | 2143 | } |
| | 2144 | free(adj); |
| | 2145 | |
| | 2146 | return 1; |
| | 2147 | } |
| | 2148 | |