没有合适的资源?快使用搜索试试~ 我知道了~
ASM算法实现对齐功能代码 经典算法asm,内部对齐部分代码,就是求解那个矩阵代码
资源推荐
资源详情
资源评论
using UnityEngine;
using System.Collections;
public class myscript_jiaozheng : MonoBehaviour {
private Matrix4x4 OutMat = Matrix4x4.identity;
//get the weights
float [] GetWeightofPerPoint(Vector2 [] _glassPoints, Vector2 [] _facePoints)
{
int PointSize = _glassPoints.Length;
if (PointSize != _facePoints.Length)
return null;
double Epsilon = 1.0E-6;
float [] weightsPoint =new float[PointSize];//out
for (int i = 0; i < PointSize; i++)
{
float totalvariance = 0.0f;
for (int j = 0; j < PointSize; j++)
{
if (j == i)
continue;
float dis_glass = Vector2.Distance (_glassPoints[i], _glassPoints[j]);
float dis_face = Vector2.Distance (_facePoints[i], _facePoints[j]);
using System.Collections;
public class myscript_jiaozheng : MonoBehaviour {
private Matrix4x4 OutMat = Matrix4x4.identity;
//get the weights
float [] GetWeightofPerPoint(Vector2 [] _glassPoints, Vector2 [] _facePoints)
{
int PointSize = _glassPoints.Length;
if (PointSize != _facePoints.Length)
return null;
double Epsilon = 1.0E-6;
float [] weightsPoint =new float[PointSize];//out
for (int i = 0; i < PointSize; i++)
{
float totalvariance = 0.0f;
for (int j = 0; j < PointSize; j++)
{
if (j == i)
continue;
float dis_glass = Vector2.Distance (_glassPoints[i], _glassPoints[j]);
float dis_face = Vector2.Distance (_facePoints[i], _facePoints[j]);
float mean_dis = (dis_glass + dis_face) / 2.0f;
float variance = ((mean_dis - dis_glass) * (mean_dis - dis_glass) + (mean_dis - dis_face) * (mean_dis - dis_face)) / 2.0f;
totalvariance += variance;
}
totalvariance += (float)Epsilon;
weightsPoint [i] = 1.0f / totalvariance;
}
//normalize the weights.
float totalweightsPoint = 0.0f;
totalweightsPoint += (float)Epsilon;
for (int i = 0; i < PointSize; i++) {
totalweightsPoint += weightsPoint [i];
}
for (int i = 0; i < PointSize; i++) {
weightsPoint [i] = weightsPoint [i] / totalweightsPoint;
}
return weightsPoint;
}
Matrix4x4 Get_axaytxty(Vector2 [] _glassPoints, Vector2 [] _facePoints)
float variance = ((mean_dis - dis_glass) * (mean_dis - dis_glass) + (mean_dis - dis_face) * (mean_dis - dis_face)) / 2.0f;
totalvariance += variance;
}
totalvariance += (float)Epsilon;
weightsPoint [i] = 1.0f / totalvariance;
}
//normalize the weights.
float totalweightsPoint = 0.0f;
totalweightsPoint += (float)Epsilon;
for (int i = 0; i < PointSize; i++) {
totalweightsPoint += weightsPoint [i];
}
for (int i = 0; i < PointSize; i++) {
weightsPoint [i] = weightsPoint [i] / totalweightsPoint;
}
return weightsPoint;
}
Matrix4x4 Get_axaytxty(Vector2 [] _glassPoints, Vector2 [] _facePoints)
剩余9页未读,继续阅读
资源评论
aaronwxj
- 粉丝: 2
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功