当前位置:网站首页>Drawing for example study of flashcc
Drawing for example study of flashcc
2022-06-27 16:29:00 【One kylin son one】
FlasCC Example study Drawing
This example is mainly to show you voronoi Drawing method of graph .
Voronoi chart , Also called Tyson polygon or Dirichlet chart , Please refer to here for details http://baike.baidu.com/view/501103.htm, This is not the point of this example .
This example doesn't show you much ,AS3 Related calls and C API Use , And there is not much difference between them . only One difference is , In this case voronoi Graph generation , Used C++ class. in other words , This example , Let's see FlasCC Yes C++ Support for .
The following code , Is the example native code , There is no comment in the middle . This is because , There is no need for comments . Used , It's all in the front Interop Has been described in .
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include "VoronoiDiagramGenerator.h"
#include "AS3/AS3.h"
int main(int argc,char **argv)
{
int stagewidth, stageheight;
inline_as3(
"import flash.display.Stage;\n"
"import flash.display.Graphics;\n"
"import com.adobe.flascc.CModule;\n"
"var gfx = CModule.rootSprite.graphics;\n"
"gfx.lineStyle(1, 0);\n"
"gfx.beginFill(0, 0.0);\n"
"%0 = CModule.rootSprite.stage.stageWidth;\n"
"%1 = CModule.rootSprite.stage.stageHeight;\n"
: "=r"(stagewidth),"=r"(stageheight) :
);
const int cellcount = 512;
float xvals[cellcount], yvals[cellcount];
for(int i=0; i<cellcount; i++) {
xvals[i] = stagewidth * ((float)rand()/(float)RAND_MAX);
yvals[i] = stageheight * ((float)rand()/(float)RAND_MAX);
}
VoronoiDiagramGenerator vdg;
vdg.generateVoronoi(xvals, yvals, cellcount, 0, stagewidth, 0, stageheight, 3);
vdg.resetIterator();
float x1,y1,x2,y2;
while(vdg.getNext(x1,y1,x2,y2))
{
inline_as3("gfx.moveTo(%0,%1);\n" : : "r"(x1), "r"(y1));
inline_as3("gfx.lineTo(%0,%1);\n" : : "r"(x2), "r"(y2));
}
inline_as3("gfx.endFill();\n");
}
Take a picture !
posted @ 2013-05-16 00:03 Kirinko (Alex) read (
...) Comment on ( ...) Collection
边栏推荐
- 华为云首次解读云原生2.0十大典型架构,加速构建现代化应用
- #yyds干货盘点#简述chromeV8引擎垃圾回收
- #yyds干货盘点# 解决剑指offer:二叉树中和为某一值的路径(三)
- Sigkdd22 | graph generalization framework of graph neural network under the paradigm of "pre training, prompting and fine tuning"
- Leetcode daily practice (main elements)
- 特殊函数计算器
- Scrapy framework (I): basic use
- 等保2.0密码要求是什么?法律依据有哪些?
- Li Chuang EDA learning notes 16: array copy and array distribution
- 带你认识图数据库性能和场景测试利器LDBC SNB
猜你喜欢

# Cesium实现卫星在轨绕行

Raspberry pie preliminary use

IDE Eval reset unlimited trial reset

Open source 23 things shardingsphere and database mesh have to say

10分钟掌握mysql的安装步骤

EMQ 助力青岛研博建设智慧水务平台

Hierarchical clustering and case analysis

Mihayou sued Minmetals trust, which was exposed to product thunderstorms

Redis Series 2: data persistence improves availability

LeetCode每日一练(无重复字符的最长子串)
随机推荐
字节跳动埋点数据流建设与治理实践
NFT双币质押流动性挖矿dapp合约定制
树莓派初步使用
C language teacher workload management system
郎酒两大王牌产品成都联动共振,持续带动光瓶酒消费浪潮
开源二三事|ShardingSphere 与 Database Mesh 之间不得不说的那些事
Taishan Office Technology Lecture: the first difficulty is vertical positioning
What is the open source compatibility of the current version of polardb-x? mysql8?
Smart wind power | Tupu software digital twin wind turbine equipment, 3D visual intelligent operation and maintenance
Leetcode daily practice (longest substring without repeated characters)
Nemo of pulseaudio (22)
事务的隔离级别详解
Domain name binding dynamic IP best practices
Yyds dry inventory solution sword finger offer: a path with a certain value in the binary tree (3)
一个机器人位于一个 m x n 网格的左上角 。机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角。问总共有多少条不同的路径?【LeetCodeHot100】
Deeply digitise, lead cloud nativity and serve more developers
Design of FIR digital filter
The interview lasted for half a year. Last month, I successfully got Alibaba p7offer. It was all because I chewed the latest interview questions in 2020!
QT5 之信号与槽机制(演示控件自带的信号与槽函数关联)
Qt5 signal and slot mechanism (basic introduction to signal and slot)