本文整理汇总了C#中System.Matrix.MakeTrans方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix.MakeTrans方法的具体用法?C# Matrix.MakeTrans怎么用?C# Matrix.MakeTrans使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Matrix
的用法示例。
在下文中一共展示了Matrix.MakeTrans方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HollowSphere
public HollowSphere(double wide)
{
Shadow = true;
Render = true;
Matrix trans = new Matrix();
Matrix invTrans = new Matrix();
double xtrans = ((double)wide) / 2.0;
double ytrans = ((double)wide) / 2.0;
double ztrans = ((double)wide) / 2.0;
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
Matrix scale = new Matrix();
Matrix invScale = new Matrix();
double xsc = (double)wide;
double ysc = (double)wide;
double zsc = (double)wide;
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
Sphere body = new Sphere();
body.ApplyMatrix(scale, invScale);
body.ApplyMatrix(trans, invTrans);
Sphere bodycutout = new Sphere();
xtrans = ((double)wide) / 2.0;
ytrans = ((double)wide) / 2.0;
ztrans = ((double)wide) / 2.0;
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
xsc *= 0.0005;
ysc *= 0.0005;
zsc *= 0.0005;
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
bodycutout.ApplyMatrix(scale, invScale);
bodycutout.ApplyMatrix(trans, invTrans);
Parts = new CSGDiff(body, bodycutout);
Bounds = Parts.Bounds;
}
示例2: Tile
public Tile(int wide, int length)
{
Shadow = true;
Render = true;
Matrix trans = new Matrix();
Matrix invTrans = new Matrix();
double xtrans = ((double)wide) / 2.0;
double ytrans = ((double)length) / 2.0;
double ztrans = 0.5 * 2.0 / 5.0;
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
Matrix scale = new Matrix();
Matrix invScale = new Matrix();
double xsc = 0.5 * wide;
double ysc = 0.5 * length;
double zsc = 0.5 * 2.0 / 5.0;
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
Box body = new Box();
if (Rounded)
{
body.Rounded = true;
body.XRounding = roundFactor / xsc;
body.YRounding = roundFactor / ysc;
body.ZRounding = roundFactor / zsc;
}
body.ApplyMatrix(scale, invScale);
body.ApplyMatrix(trans, invTrans);
Box bodycutout = new Box();
xtrans = ((double)wide) / 2.0;
ytrans = ((double)length) / 2.0;
ztrans = 0.5 * (2.0 / 5.0 - 3.0 / 16.0);
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
xsc = 0.5 * (wide - 6.0 / 16.0);
ysc = 0.5 * (length - 6.0 / 16.0);
zsc = 0.5 * (2.0 / 5.0 - 3.0 / 16.0) * (1 + ToyTracer.EPSILON * 3);
if (Rounded)
{
bodycutout.Rounded = true;
bodycutout.RoundedTopOnly = true;
bodycutout.XRounding = roundFactor / xsc;
bodycutout.YRounding = roundFactor / ysc;
bodycutout.ZRounding = roundFactor / zsc;
}
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
bodycutout.ApplyMatrix(scale, invScale);
bodycutout.ApplyMatrix(trans, invTrans);
Parts = new CSGDiff(body, bodycutout);
if (wide == 1 || length == 1)
{
throw new NotSupportedException("Width or length 1 tiles are not supported.");
//cerr << "Tile of width/length 1 - error!" << endl;
}
else
{
Primative cyls = null;
for (int i = 0; i < wide; i++)
{
Primative cylrow = null;
for (int j = 0; j < length; j++)
{
if (wide == i + 1)
continue;
if (length == j + 1)
continue;
Cylinder cyl = new Cylinder();
if (Rounded)
{
cyl.Rounded = true;
cyl.RRounding = roundFactor / xsc;
cyl.ZRounding = roundFactor / zsc;
}
xsc = 0.5 * 0.789;
ysc = 0.5 * 0.789;
zsc = 0.5 * (2.0 / 5.0 - 3.0 / 16.0) * (1 + ToyTracer.EPSILON * 10);
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
xtrans = 1 + i;
ytrans = 1 + j;
ztrans = 0.5 * (2.0 / 5.0 - 3.0 / 16.0);
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
cyl.ApplyMatrix(scale, invScale);
cyl.ApplyMatrix(trans, invTrans);
Cylinder cylcut = new Cylinder();
xsc = 0.5 * 5.0 / 8.0;
ysc = 0.5 * 5.0 / 8.0;
zsc = 0.5 * (2.0 / 5.0 - 3.0 / 16.0) * (1 + ToyTracer.EPSILON * 15);
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
xtrans = 1 + i;
ytrans = 1 + j;
ztrans = 0.5 * (2.0 / 5.0 - 3.0 / 16.0);
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
cylcut.ApplyMatrix(scale, invScale);
cylcut.ApplyMatrix(trans, invTrans);
CSGDiff cylpart = new CSGDiff(cyl, cylcut);
//.........这里部分代码省略.........
示例3: Brick
public Brick(int wide, int length)
{
Shadow = true;
Render = true;
Matrix trans = new Matrix();
Matrix invTrans = new Matrix();
double xtrans = ((double)wide) / 2.0;
double ytrans = ((double)length) / 2.0;
double ztrans = 0.5 * 6.0 / 5.0;
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
Matrix scale = new Matrix();
Matrix invScale = new Matrix();
double xsc = 0.5 * wide;
double ysc = 0.5 * length;
double zsc = 0.5 * 6.0 / 5.0 * (1 + ToyTracer.EPSILON * 2);
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
Box body = new Box();
if (Rounded)
{
body.Rounded = true;
body.XRounding = roundFactor / xsc;
body.YRounding = roundFactor / ysc;
body.ZRounding = roundFactor / zsc;
}
body.ApplyMatrix(scale, invScale);
body.ApplyMatrix(trans, invTrans);
Box bodycutout = new Box();
xtrans = ((double)wide) / 2.0;
ytrans = ((double)length) / 2.0;
ztrans = 0.5 * (6.0 / 5.0 - 3.0 / 16.0);
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
xsc = 0.5 * (wide - 6.0 / 16.0);
ysc = 0.5 * (length - 6.0 / 16.0);
zsc = 0.5 * (6.0 / 5.0 - 3.0 / 16.0) * (1 + ToyTracer.EPSILON * 4);
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
if (Rounded)
{
bodycutout.Rounded = true;
bodycutout.RoundedTopOnly = true;
bodycutout.XRounding = roundFactor / xsc;
bodycutout.YRounding = roundFactor / ysc;
bodycutout.ZRounding = roundFactor / zsc;
}
bodycutout.ApplyMatrix(scale, invScale);
bodycutout.ApplyMatrix(trans, invTrans);
Parts = new CSGDiff(body, bodycutout);
Primative unstuds = null;
Primative studs = null;
for (int i = 0; i < wide; i++)
{
Primative unstudrow = null;
Primative studrow = null;
for (int j = 0; j < length; j++)
{
Cylinder undstud = new Cylinder();
xsc = 0.5 * 1.0 / 4.0;
ysc = 0.5 * 1.0 / 4.0;
zsc = 0.5 * 3.0 / 16.0 * (1 + ToyTracer.EPSILON * 4);
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
xtrans = 0.5 + i;
ytrans = 0.5 + j;
ztrans = 6.0 / 5.0 - 0.5 * 3.0 / 16.0;
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
undstud.ApplyMatrix(scale, invScale);
undstud.ApplyMatrix(trans, invTrans);
if (unstudrow == null)
unstudrow = undstud;
else
unstudrow = new CSGUnion(unstudrow, undstud, true);
Cylinder stud = new Cylinder();
xsc = 0.5 * 5.0 / 8.0;
ysc = 0.5 * 5.0 / 8.0;
zsc = 0.5 * 17.0 / 80.0 * (1 + 2 * ToyTracer.EPSILON);
if (Rounded)
{
stud.Rounded = true;
stud.RoundedTopOnly = true;
stud.RRounding = roundFactor / xsc;
stud.ZRounding = roundFactor / zsc;
}
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
xtrans = 0.5 + i;
ytrans = 0.5 + j;
ztrans = 6.0 / 5.0 + 0.5 * 17.0 / 80.0;
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
stud.ApplyMatrix(scale, invScale);
stud.ApplyMatrix(trans, invTrans);
if (studrow == null)
studrow = stud;
else
studrow = new CSGUnion(studrow, stud, true);
}
//.........这里部分代码省略.........
示例4: BasePlate
public BasePlate(int wide, int length)
{
Shadow = true;
Render = true;
Matrix trans = new Matrix();
Matrix invTrans = new Matrix();
double xtrans = ((double)wide) / 2.0;
double ytrans = ((double)length) / 2.0;
double ztrans = -0.5 * 2.0 / 15.0;
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
Matrix scale = new Matrix();
Matrix invScale =new Matrix();
double xsc = 0.5 * wide;
double ysc = 0.5 * length;
double zsc = 0.5 * 2.0 / 15.0;
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
Parts = new Box();
if (Rounded)
{
((Box)Parts).Rounded = true;
((Box)Parts).XRounding = roundFactor / xsc;
((Box)Parts).YRounding = roundFactor / ysc;
((Box)Parts).ZRounding = roundFactor / zsc;
}
Parts.ApplyMatrix(scale, invScale);
Parts.ApplyMatrix(trans, invTrans);
Primative unstuds = null;
Primative studs = null;
for (int i = 0; i < wide; i++)
{
Primative undstudrow = null;
Primative studrow = null;
for (int j = 0; j < length; j++)
{
Cylinder undstud = new Cylinder();
xsc = 0.5 * 1.0 / 4.0;
ysc = 0.5 * 1.0 / 4.0;
zsc = 0.5 * 2.0 / 15.0 * (1 + ToyTracer.EPSILON * 2);
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
xtrans = 0.5 + i;
ytrans = 0.5 + j;
ztrans = -0.5 * 2.0 / 15.0;
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
undstud.ApplyMatrix(scale, invScale);
undstud.ApplyMatrix(trans, invTrans);
if (undstudrow == null)
undstudrow = undstud;
else
undstudrow = new CSGUnion(undstudrow, undstud, true);
Cylinder stud = new Cylinder();
xsc = 0.5 * 5.0 / 8.0;
ysc = 0.5 * 5.0 / 8.0;
zsc = 0.5 * 17.0 / 80.0 * (1 + ToyTracer.EPSILON * 2);
if (Rounded)
{
stud.Rounded = true;
stud.RoundedTopOnly = true;
stud.RRounding = roundFactor / xsc;
stud.ZRounding = roundFactor / zsc;
}
scale.MakeScale(xsc, ysc, zsc);
invScale.MakeScale(1 / xsc, 1 / ysc, 1 / zsc);
xtrans = 0.5 + i;
ytrans = 0.5 + j;
ztrans = 0.5 * 17.0 / 80.0;
trans.MakeTrans(xtrans, ytrans, ztrans);
invTrans.MakeTrans(-xtrans, -ytrans, -ztrans);
stud.ApplyMatrix(scale, invScale);
stud.ApplyMatrix(trans, invTrans);
if (studrow == null)
studrow = stud;
else
studrow = new CSGUnion(studrow, stud, true);
}
if (studs == null)
studs = studrow;
else
studs = new CSGUnion(studs, studrow, true);
if (unstuds == null)
unstuds = undstudrow;
else
unstuds = new CSGUnion(unstuds, undstudrow, true);
}
Parts = new CSGDiff(Parts, unstuds);
Parts = new CSGUnion(Parts, studs);
Bounds = Parts.Bounds;
}