Processing中shapes3d库的utils包中的Bezier2与Shape3D包中的BezShape类
来源:互联网 发布:精锐摇杆淘宝店 编辑:程序博客网 时间:2024/06/05 19:50
Processing中shapes3d库的utils包中的Bezier2D类的帮助文档是这样写的
This class is used to represent a single Bezier curve of degree >= 2 in 2D space.
这个类用来描述大于等于2 degree的Bezier 曲线
Note the degree of a Bezier curve equals the number of control points.
degree的值和控制点的值相等
Its primary purpose is to act as a convenience class to maintain a collection bezier controls points in 2 dimensions.
主要设计目的是保持一个2维空间的控制点集
In this library the Bezier2D object is used by the BezierShape class to create a 3D shape by rotating it about the Y axis [0,1,0].
这shapes3d库中主要是用来创建3D形状,方法是通过在xy平面上使用Bezier2D创建的曲线绕y轴旋转,得到一个3维形状
下面是degree与二维形状之间的对应关系
Degree Shape
2 straight line (直线)
3 quadratic bezier (二次bezier曲线)
4 cubic bezier (三次bezier曲线)
……
Bezier2D与BezShape结合实现了bezier曲线二维图形旋转建模
以下是本人写的一个示例程序:
import peasy.*;import shapes3d.*;import shapes3d.utils.*;PeasyCam cam;Bezier2D bz;PVector[] v;BezShape bzs;int slice, seg;void setup(){ cam=new PeasyCam(this, 500); v=new PVector[]{ new PVector(0, 0, 0), new PVector(100, 0, 0), new PVector(200, 0, 0) }; size(800, 600, P3D);}void draw(){ background(0); lights(); bz=new Bezier2D(v, v.length); bzs=new BezShape(this, bz, slice, seg); bzs.stroke(color(255)); bzs.drawMode(BezShape.WIRE); bzs.draw();}void mouseMoved(){ slice=int(map(mouseX, 0, width, 0, 100)); seg=int(map(mouseY, 0, width, 0, 100));}void keyPressed(){ if (keyCode%3==0) { v=new PVector[]{ new PVector(0, 0, 0), new PVector(100, 0, 0), new PVector(200, 0, 0) }; } if (keyCode%3==1) { v=new PVector[]{ new PVector(0, 0, 0), new PVector(100, 100, 0), new PVector(200, 0, 0) }; } if (keyCode%3==2) { v=new PVector[]{ new PVector(0, 0, 0), new PVector(100, 100, 0), new PVector(200, 0, 0), new PVector(300, 100, 0) }; }}
- Processing中shapes3d库的utils包中的Bezier2与Shape3D包中的BezShape类
- Processing中shapes3d库的utils包中的P_BezierSpline类
- Processing的shapes3d库中的shapes3d.utils.P_Bezier3D类
- Processing的shapes3d库animation包AbstractVectorChangeAction类及其子类ShapeMover和ShapeRotator
- Java.utils.concurrent包中的几个有用的类(CountDownLatch、CyclicBarrier、Semaphore)
- java.utils包的认识
- easyUI中tab中的html片段导包与父页面的包冲突
- Java类库中的包
- 使用MyBatis框架,dao层中的类与mapping包中xml配置文件的关系
- python中的装包与拆包
- Jquery库与js中的闭包
- *****MapReduce连接:重分区连接【里面分析了org.apache.hadoop.contrib.utils.join包中的基础数据join原理和优化后的抽象类】
- java中import默认包中的类
- JDK中logging包中的类
- JDK中zip包中的类
- Apache中的poi包中的XSSFWorkbook与HSSFWorkbook的区别
- Apache中的poi包中的XSSFWorkbook与HSSFWorkbook的区别
- Apache中的poi包中的XSSFWorkbook与HSSFWorkbook的区别
- iOS 开发之支付宝调起出现 ALI40247 解决方案
- 项目在总是报mysql表不存在的问题
- 站在巨人的肩膀上,C++开源库大全
- Bluebird 高性能揭秘
- java实现Json格式美化
- Processing中shapes3d库的utils包中的Bezier2与Shape3D包中的BezShape类
- 动态规划算法的个人理解
- Nginx使用Memcached
- 银行账号同步多线程处理
- list列表去除重复项以及查询某个字符串在list的出现次数
- IO 端口和IO 内存
- 高一寒假竞赛知识点梳理1
- iOS开发之支付宝集成问题 'openssl/asn1.h' file not found
- Java高并发编程:使用JDK5中同步技术的3个面试题