您的位置:首页 > 其它

test for windows live writer plugins

2013-04-27 16:50 627 查看
Trituple    internal struct TriTuple : ICloneable
{
public double X;
public double Y;
public double Z;
public TriTuple(double x, double y, double z)
{
// TODO: Complete member initialization
this.X = x;
this.Y = y;
this.Z = z;
}

public override string ToString()
{
return string.Format("{0:f2},{1:f2},{2:f2}", X, Y, Z);
}

public void Add(TriTuple diff)
{
this.X = this.X + diff.X;
this.Y = this.Y + diff.Y;
this.Z = this.Z + diff.Z;
}

/// <summary>
/// make this trituple's length to 1.
/// </summary>
public void Normalize()
{
var length = Math.Sqrt(this.X * this.X + this.Y * this.Y + this.Z * this.Z);
this.X = this.X / length;
this.Y = this.Y / length;
this.Z = this.Z / length;
}

public object Clone()
{
var result = new TriTuple(this.X, this.Y, this.Z);
return result;
}
}


7. 插入代码

internal struct TriTuple
{
public double X;
public double Y;
public double Z;
public TriTuple(double x, double y, double z)
{
// TODO: Complete member initialization
this.X = x;
this.Y = y;
this.Z = z;
}

public override string ToString()
{
return string.Format("{0:f2},{1:f2},{2:f2}", X, Y, Z);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: