Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
魔术师Dix
Unity几何库:木蝴蝶
提交
b2551d25
Unity几何库:木蝴蝶
项目概览
魔术师Dix
/
Unity几何库:木蝴蝶
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Unity几何库:木蝴蝶
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b2551d25
编写于
11月 10, 2022
作者:
魔术师Dix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增数据结构 line3d,并移除重复的数据结构plane(使用Unity自带的即可);
上级
55d15f97
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
61 addition
and
23 deletion
+61
-23
Intersection/IntrLine3dPlane.cs
Intersection/IntrLine3dPlane.cs
+3
-1
Math/Line2d.cs
Math/Line2d.cs
+6
-0
Math/Line3d.cs
Math/Line3d.cs
+49
-0
Math/Line3d.cs.meta
Math/Line3d.cs.meta
+1
-1
Math/Plane.cs
Math/Plane.cs
+0
-21
OMath.cs
OMath.cs
+2
-0
未找到文件。
Intersection/IntrLine3dPlane.cs
浏览文件 @
b2551d25
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
*/
*/
using
Unity.Mathematics
;
namespace
Oroxylum
namespace
Oroxylum
{
{
/// <summary>
/// <summary>
...
@@ -16,6 +18,6 @@ namespace Oroxylum
...
@@ -16,6 +18,6 @@ namespace Oroxylum
public
struct
IntrLine3dPlane
public
struct
IntrLine3dPlane
{
{
}
}
}
}
Math/Line2d.cs
浏览文件 @
b2551d25
...
@@ -34,6 +34,12 @@ namespace Oroxylum
...
@@ -34,6 +34,12 @@ namespace Oroxylum
public
double
Project
(
float2
p
)
{
return
(
p
-
Origin
).
Dot
(
Direction
);
}
public
double
Project
(
float2
p
)
{
return
(
p
-
Origin
).
Dot
(
Direction
);
}
public
float2
ClosestPoint
(
float2
p
)
{
float
t
=
(
p
-
Origin
).
Dot
(
Direction
);
return
Origin
+
t
*
Direction
;
}
public
double
DistanceSquared
(
float2
p
)
public
double
DistanceSquared
(
float2
p
)
{
{
float
t
=
(
p
-
Origin
).
Dot
(
Direction
);
float
t
=
(
p
-
Origin
).
Dot
(
Direction
);
...
...
Math/Line3d.cs
0 → 100644
浏览文件 @
b2551d25
/*
*Copyright(C) 2020 by Cyf All rights reserved.
*Unity版本:2021.3.11f1c2
*作者:程一峰
*创建日期: 2022-11-10
*模块说明:木蝴蝶数学库:数据格式
*版本: 1.0
*/
using
Unity.Mathematics
;
namespace
Oroxylum
{
/// <summary>
/// 3d 直线
/// </summary>
public
struct
Line3d
{
public
float3
Origin
;
public
float3
Direction
;
public
Line3d
(
float3
origin
,
float3
direction
)
{
this
.
Origin
=
origin
;
this
.
Direction
=
direction
;
}
public
static
Line3d
FromPoints
(
float3
p0
,
float3
p1
)
{
return
new
Line3d
(
p0
,
math
.
normalize
(
p1
-
p0
));
}
public
float
Project
(
float3
p
)
{
return
(
p
-
Origin
).
Dot
(
Direction
);
}
public
float3
ClosestPoint
(
float3
p
)
{
float
t
=
(
p
-
Origin
).
Dot
(
Direction
);
return
Origin
+
t
*
Direction
;
}
public
float
DistanceSquared
(
float3
p
)
{
float
t
=
(
p
-
Origin
).
Dot
(
Direction
);
float3
proj
=
Origin
+
t
*
Direction
;
return
(
proj
-
p
).
LengthSquared
();
}
}
}
\ No newline at end of file
Math/
Plane
.cs.meta
→
Math/
Line3d
.cs.meta
浏览文件 @
b2551d25
fileFormatVersion: 2
fileFormatVersion: 2
guid: 4
ea5947ca82e2104da89c84439ced2f7
guid: 4
3c47208483b92d40b735849b69bfff2
MonoImporter:
MonoImporter:
externalObjects: {}
externalObjects: {}
serializedVersion: 2
serializedVersion: 2
...
...
Math/Plane.cs
已删除
100644 → 0
浏览文件 @
55d15f97
/*
*Copyright(C) 2020 by Cyf All rights reserved.
*Unity版本:2021.3.11f1c2
*作者:程一峰
*创建日期: 2022-11-10
*模块说明:木蝴蝶数学库:数据格式
*版本: 1.0
*/
namespace
Oroxylum
{
/// <summary>
/// 平面
/// </summary>
public
struct
Plane
{
}
}
\ No newline at end of file
OMath.cs
浏览文件 @
b2551d25
...
@@ -154,6 +154,8 @@ namespace Oroxylum
...
@@ -154,6 +154,8 @@ namespace Oroxylum
public
static
float
LengthSquared
(
this
float2
a
)
{
return
math
.
lengthsq
(
a
);
}
public
static
float
LengthSquared
(
this
float2
a
)
{
return
math
.
lengthsq
(
a
);
}
public
static
float
LengthSquared
(
this
float3
a
)
{
return
math
.
lengthsq
(
a
);
}
public
static
float
DotPerp
(
this
float2
a
,
float2
b
)
{
return
(
a
.
x
*
b
.
y
)
-
(
a
.
y
*
b
.
x
);
}
public
static
float
DotPerp
(
this
float2
a
,
float2
b
)
{
return
(
a
.
x
*
b
.
y
)
-
(
a
.
y
*
b
.
x
);
}
/// <summary>
/// <summary>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录