自己写了个Box类,是unity自带的Rect类的3D升级版,功能还很少~~
来源:互联网 发布:2016网络流行伤感情歌 编辑:程序博客网 时间:2024/04/28 23:50
using UnityEngine;using System.Collections;public class Box{ public Vector3 center; public Vector3 size; public Vector3 halfSize; public float left; public float right; public float top; public float down; public float front; public float back; public Box(Vector3 center, Vector3 size) { this.center = center; this.size = size; this.halfSize = size / 2f; this.right = center.x + halfSize.x; this.left = center.x - halfSize.x; this.top = center.y + halfSize.y; this.down = center.y - halfSize.y; this.front = center.z + halfSize.z; this.back = center.z - halfSize.z; } public Box(float right, float left, float top, float down, float front, float back) { this.right = right; this.left = left; this.top = top; this.down = down; this.front = front; this.back = back; this.center = new Vector3((left + right) / 2f, (down + top) / 2f, (back + front) / 2f); this.size = new Vector3((right - left) / 2f, (top - down) / 2f, (front - back) / 2f); this.halfSize = size / 2; } public static Box combineBox(Box box1, Box box2) { float left = box1.left < box2.left ? box1.left : box2.left; float down = box1.down < box2.down ? box1.down : box2.down; float back = box1.back < box2.back ? box1.back : box2.left; float right = box1.right > box2.right ? box1.right : box2.right; float top = box1.top > box2.top ? box1.top : box2.top; float front = box1.front > box2.front ? box1.front : box2.front; return new Box(right, left, top, down, front, back); }}
0 0
- 自己写了个Box类,是unity自带的Rect类的3D升级版,功能还很少~~
- 是时候写个自己的网站了!!
- Codeforces 14D 求树的直径(网上大多数是DFS于是自己写了个BFS)
- 写个dll,引用了自己的lib,lib引用进去了,还老是报错
- 利用OpenCV创建自己的Rect类
- AS3 没有2D向量类,自己随手写个简化版的先用着
- Delphi自带的SpinEdit控件太丑了,自己写一个替换它
- c自带的排序函数qsort,再也不用自己麻烦写排序函数了
- 自己写了一个链表功能还不完善但是简单的增删改查功能都已经实现了
- JSP 带竖直和水平滚动条的表格,找了好几天,还不如自己写一个。
- 发现自己很少写Blog了
- 自定义标签实现分页功能[看了点网上的,自己在写的。还不错。欢迎点评]
- 自己写了一个上传类,实现了常用的功能
- 写了个自己的bigint
- flatMap功能不只是wordcount,不知不觉用flatmap实现了hive的自带函数explode功能
- 自己配置了一天的opencv 从自带的库到编译成功的库写
- 自带3D全景漫游神技能的H5是如何炼成的
- 自己写了个complex类
- epoll的ET模式和LT模式
- XTU Monthly, April 2014
- 开源flashplayer汇总.
- Makefile中的静态模式
- XML 特殊字符处理
- 自己写了个Box类,是unity自带的Rect类的3D升级版,功能还很少~~
- Android 数据存储之_SharedPreferences
- FastJson定制序列化
- java中&和&&的区别
- 回忆的老墙
- 配置ArcGIS Server10.0之后,报错ManagedPipelineHandler,如何解决?
- IE兼容模式及客户端兼容模式、服务器端兼容模式设置
- Sql Server 添加删除字段判断表或字段是否存在得到字段描述
- 虚拟运营商品牌扎堆发布 新盈利模式将倒逼改革