本文整理汇总了C#中Point3.SetValues方法的典型用法代码示例。如果您正苦于以下问题:C# Point3.SetValues方法的具体用法?C# Point3.SetValues怎么用?C# Point3.SetValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3
的用法示例。
在下文中一共展示了Point3.SetValues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestInBox
public void TestInBox()
{
Random rnd = new Random();
Point3 pa = new Point3(), pb = new Point3(), pc = new Point3();
Triangle t = new Triangle(pa, pb, pc, null, null, null, null, null, null, null);
for(int i = 0x00; i < 100; i++) {
pa.SetValues(rnd.NextDouble(), rnd.NextDouble(), rnd.NextDouble());
pb.SetValues(rnd.NextDouble(), rnd.NextDouble(), rnd.NextDouble());
pc.SetValues(rnd.NextDouble(), rnd.NextDouble(), rnd.NextDouble());
double a = rnd.NextDouble(), b = rnd.NextDouble(), c = rnd.NextDouble(), d = rnd.NextDouble(), e = rnd.NextDouble(), f = rnd.NextDouble();
double mx = Math.Min(a, b), Mx = Math.Max(a, b), my = Math.Min(c, d), My = Math.Max(c, d), mz = Math.Min(e, f), Mz = Math.Max(e, f);
if(pa.InBox(mx, Mx, my, My, mz, Mz) || pb.InBox(mx, Mx, my, My, mz, Mz) || pc.InBox(mx, Mx, my, My, mz, Mz)) {
Assert.IsTrue(t.InBox(mx, Mx, my, My, mz, Mz));
}
}
}
示例2: PointAt
public void PointAt(double t, Point3 pt)
{
pt.SetValues(Offset.X+Direction.X*t, Offset.Y+Direction.Y*t, Offset.Z+Direction.Z*t);
}
示例3: CalculateImage
private void CalculateImage (int yfrom, int yto) {
double sd = this.screenDistance;
double sh = 2.0d*sd*Math.Tan(0.5d*this.foVH);
int w = this.Width;
int h = this.Height;
double sw = sh*w/h;
double dwh = sw/w;
Ray ray = new Ray(0.0d, 0.0d, 0.0d, 0.0d, 0.0d, 1.0d);
uint[] pixel = this.raster.Pixel;
int k = Width*yfrom, ks = Width*yto, kc;
uint l, m;
uint aasqrt = this.antialiasSqrt;
uint aadsqrt = this.dispersionAntialiasSqrt;
RayTracer rt = new RayTracer(this.acc, this.Lights, settings);
uint aa = aasqrt*aasqrt, aac, aad = aadsqrt*aadsqrt, aadc;
Point3 tmp = new Point3(0.0d, 0.0d, 0.0d);
double focusLength = Point3.DiffLength(this.position, this.lookAt);
double frac = 1.0d+focusLength/this.screenDistance;
uint aaaad = aa*aad;
double dwha = dwh/aasqrt;
double dwhad = dispersion*dwh;
double yp = dwh*yfrom-0.5d*sh-0.5d*dwha*aasqrt, xp;
double yd, xd;
double dis = this.displacement;
ColorCache cc;
#region PIXEL
for(; k < ks;) {
kc = k+Width;
xp = -0.5d*sw-0.5d*dwha*aasqrt-dis;
for(; k < kc;) {
l = 0x00;
cc = new ColorCache(0x00);
#region ANTIALIASING
for(; l < aa;) {
aac = l+aasqrt;
for(; l < aac; l++) {
m = 0x00;
tmp.SetValues(xp*frac, -yp*frac, focusLength);
yd = -0.5d*dwhad*(aadsqrt-0x01);
#region DISPERSION
for(; m < aad;) {
xd = -0.5d*dwhad*(aadsqrt-0x01);
aadc = m+aadsqrt;
for(; m < aadc; m++) {
ray.Offset.SetValues(xp+xd, -yp-yd, 0.0d);
ray.Direction.SetValues(ray.Offset, tmp);
ray.Direction.Normalize();
ray.NormalizeDirection();
ray.Transform(this.matrix);
#if FAST_COLOR_INTERSECTION
rt.CalculateColor(ray, 0, Color.White);
cc.AddColor(new Color(ColorUtils.FromWavelength(350+5*(int)SystemDiagnostics.Intersections)));
SystemDiagnostics.Intersections = 0x00;
#elif FAST_COLOR_MIGRATION
rt.CalculateColor(ray, 0, Color.White);
cc.AddColor(new Color(ColorUtils.FromWavelength(350+5*(int)SystemDiagnostics.Migrations)));
SystemDiagnostics.Migrations = 0x00;
#else
cc.AddColor(rt.CalculateColor(ray, 0, Color.White));
#endif
xd += dwhad;
}
yd += dwhad;
}
#endregion
xp += dwha;
}
yp += dwha;
xp -= dwh;
}
#endregion
yp -= dwh;
xp += dwh;
pixel[k++] = ColorUtils.AlphaChannel|cc.Mix(aaaad).RGB8;
}
#endregion
yp += dwh;
}
}