本文整理汇总了C#中Layer.IsValidPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Layer.IsValidPosition方法的具体用法?C# Layer.IsValidPosition怎么用?C# Layer.IsValidPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layer
的用法示例。
在下文中一共展示了Layer.IsValidPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPosition
public void AddPosition(Layer layer, Vector2D vPosition, HalfAxis.HAxis lengthAxis, HalfAxis.HAxis widthAxis)
{
Matrix4D matRot = Matrix4D.Identity;
Vector3D vTranslation = Vector3D.Zero;
if (_swapped && !layer.Inversed)
{
matRot = new Matrix4D(
0.0, -1.0, 0.0, 0.0
, 1.0, 0.0, 0.0, 0.0
, 0.0, 0.0, 1.0, 0.0
, 0.0, 0.0, 0.0, 1.0
);
vTranslation = new Vector3D(layer.PalletLength, 0.0, 0.0);
}
else if (!_swapped && layer.Inversed)
{
matRot = new Matrix4D(
-1.0, 0.0, 0.0, 0.0
, 0.0, -1.0, 0.0, 0.0
, 0.0, 0.0, 1.0, 0.0
, 0.0, 0.0, 0.0, 1.0
);
vTranslation = new Vector3D(layer.PalletLength, layer.PalletWidth, 0.0);
}
else if (_swapped && layer.Inversed)
{
matRot = new Matrix4D(
0.0, 1.0, 0.0, 0.0
, -1.0, 0.0, 0.0, 0.0
, 0.0, 0.0, 1.0, 0.0
, 0.0, 0.0, 0.0, 1.0
);
vTranslation = new Vector3D(0.0, layer.PalletWidth, 0.0);
}
Transform3D transfRot = new Transform3D(matRot);
HalfAxis.HAxis lengthAxisSwapped = StackBuilder.Basics.HalfAxis.ToHalfAxis(transfRot.transform(StackBuilder.Basics.HalfAxis.ToVector3D(lengthAxis)));
HalfAxis.HAxis widthAxisSwapped = StackBuilder.Basics.HalfAxis.ToHalfAxis(transfRot.transform(StackBuilder.Basics.HalfAxis.ToVector3D(widthAxis)));
matRot.M14 = vTranslation[0];
matRot.M24 = vTranslation[1];
matRot.M34 = vTranslation[2];
Transform3D transfRotTranslation = new Transform3D(matRot);
Vector3D vPositionSwapped = transfRotTranslation.transform(new Vector3D(vPosition.X, vPosition.Y, 0.0));
if (!layer.IsValidPosition(new Vector2D(vPositionSwapped.X, vPositionSwapped.Y), lengthAxisSwapped, widthAxisSwapped))
{
_log.Warn(string.Format("Attempt to add an invalid position in pattern = {0}, Variant = {1}, Swapped = true", this.Name, _variantIndex));
return;
}
layer.AddPosition(new Vector2D(vPositionSwapped.X, vPositionSwapped.Y), lengthAxisSwapped, widthAxisSwapped);
}