资源简介
图形voronoi图的自动生成算法,用vc做,是基于一般图形voronoi图的算法,结合数字图形处理里的轮廓跟踪算法,使一般图形voronoi图能够根据不同的生成元总动生成
代码片段和文件信息
#include
#include
#include “config.h“
#include “common.h“
#include “cell.h“
namespace voro {
voronoicell_base::voronoicell_base() :
current_vertices (init_vertices) current_vertex_order (init_vertex_order)
current_delete_size (init_delete_size) current_delete2_size (init_delete2_size)
ed (new int*[current_vertices]) nu (new int[current_vertices])
pts (new double[3 * current_vertices]) mem (new int[current_vertex_order])
mec (new int[current_vertex_order]) mep (new int*[current_vertex_order])
ds (new int[current_delete_size]) stacke (ds + current_delete_size)
ds2 (new int[current_delete2_size]) stacke2 (ds2 + current_delete_size)
current_marginal (init_marginal) marg (new int[current_marginal]) {
int i;
for (i = 0; i < 3; i++) {
mem[i] = init_n_vertices;
mec[i] = 0;
mep[i] = new int[init_n_vertices * ( (i << 1) + 1)];
}
mem[3] = init_3_vertices;
mec[3] = 0;
mep[3] = new int[init_3_vertices * 7];
for (i = 4; i < current_vertex_order; i++) {
mem[i] = init_n_vertices;
mec[i] = 0;
mep[i] = new int[init_n_vertices * ( (i << 1) + 1)];
}
}
voronoicell_base::~voronoicell_base() {
for (int i = current_vertex_order - 1; i >= 0; i--) if (mem[i] > 0) {
delete [] mep[i];
}
delete [] marg;
delete [] ds2;
delete [] ds;
delete [] mep;
delete [] mec;
delete [] mem;
delete [] pts;
delete [] nu;
delete [] ed;
}
template
void voronoicell_base::check_memory_for_copy (vc_class& vc voronoicell_base* vb) {
while (current_vertex_order < vb->current_vertex_order) {
add_memory_vorder (vc);
}
for (int i = 0; i < current_vertex_order; i++) while (mem[i] < vb->mec[i]) {
add_memory (vc i ds2);
}
while (current_vertices < vb->p) {
add_memory_vertices (vc);
}
}
void voronoicell_base::copy (voronoicell_base* vb) {
int i j;
p = vb->p;
up = 0;
for (i = 0; i < current_vertex_order; i++) {
mec[i] = vb->mec[i];
for (j = 0; j < mec[i] * (2 * i + 1); j++) {
mep[i][j] = vb->mep[i][j];
}
for (j = 0; j < mec[i] * (2 * i + 1); j += 2 * i + 1) {
ed[mep[i][j + 2 * i]] = mep[i] + j;
}
}
for (i = 0; i < p; i++) {
nu[i] = vb->nu[i];
}
for (i = 0; i < 3 * p; i++) {
pts[i] = vb->pts[i];
}
}
void voronoicell_neighbor::operator= (voronoicell& c) {
voronoicell_base* vb = ( (voronoicell_base*) &c);
check_memory_for_copy (*this vb);
copy (vb);
int i j;
for (i = 0; i < c.current_vertex_order; i++) {
for (j = 0; j < c.mec[i]*i; j++) {
mne[i][j] = 0;
}
for (j = 0; j < c.mec[i]; j++) {
ne[c.mep[i][ (2 * i + 1) *j + 2 * i]] = mne[i] + (j * i);
}
}
}
void voronoicell_neighbor::operator= (voronoicell_neighbor& c) {
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 61565 2013-06-15 22:38 cppsrc\cell.cpp
文件 8601 2013-06-15 23:14 cppsrc\cell.h
文件 1776 2013-06-15 22:49 cppsrc\common.cpp
文件 655 2013-06-15 23:12 cppsrc\common.h
文件 1031 2013-06-15 23:12 cppsrc\config.h
文件 10623 2013-06-15 22:48 cppsrc\container.cpp
文件 8302 2013-06-15 22:43 cppsrc\container.h
文件 19135 2013-06-15 22:46 cppsrc\container_prd.cpp
文件 7391 2013-06-15 23:11 cppsrc\container_prd.h
文件 4294 2013-06-15 22:50 cppsrc\c_loops.cpp
文件 5453 2013-06-15 23:20 cppsrc\c_loops.h
文件 1724 2013-06-15 22:30 cppsrc\main.cpp
文件 1506 2013-06-15 23:09 cppsrc\rad_option.h
文件 6685 2013-06-15 22:29 cppsrc\unitcell.cpp
文件 741 2013-06-15 23:17 cppsrc\unitcell.h
文件 48354 2013-06-15 22:28 cppsrc\v_ba
文件 908 2013-06-15 22:52 cppsrc\v_ba
文件 37170 2013-06-15 22:27 cppsrc\v_compute.cpp
文件 2487 2013-06-15 22:51 cppsrc\v_compute.h
文件 181 2013-06-15 22:50 cppsrc\worklist.h
文件 1071 2013-06-15 21:24 javasrc\CppInterface.java
文件 2089 2013-06-15 21:24 javasrc\frmAbout.java
文件 3772 2013-06-15 21:24 javasrc\frmAddPoint.java
文件 15327 2013-06-15 21:51 javasrc\MainForm.java
文件 5794 2013-06-15 21:24 javasrc\MathInterface.java
文件 275 2013-06-15 21:24 javasrc\Point.java
目录 0 2013-06-15 23:21 cppsrc
目录 0 2013-06-16 00:25 javasrc
----------- --------- ---------- ----- ----
256910 28
............此处省略1个文件信息
- 上一篇:倍福通过NC方式控制第三方伺服步科配置说明
- 下一篇:PathSim代码实现
评论
共有 条评论