public void SelectCells(RangeType range, Cell origin, int minRange, int maxRange, bool lineOfSight, bool mustBeEmpty, bool needPath, bool exceptLastCell, bool addCellToAoe, SelectionState state, RelativeRotation relativeOrientation = RelativeRotation.None, Rotation orientation = Rotation.NULL) { if (Selection == null) { Selection = new List <ProjectionRenderer>(); } if (lineOfSight && NotInLOS == null) { NotInLOS = new List <ProjectionRenderer>(); } if (addCellToAoe && AreaOfEffect == null) { AreaOfEffect = new List <Cell>(); } switch (range) { case RangeType.Square: SelectSquare(origin, minRange, maxRange, lineOfSight, mustBeEmpty, needPath, exceptLastCell, addCellToAoe); break; case RangeType.Circle: SelectCircle(origin, minRange, maxRange, lineOfSight, mustBeEmpty, needPath, exceptLastCell, addCellToAoe); break; case RangeType.Line: List <Rotation> lineOriList = GetLineOrientationFromRelative(relativeOrientation, orientation); foreach (Rotation ori in lineOriList) { SelectLine(origin, minRange, maxRange, lineOfSight, mustBeEmpty, needPath, exceptLastCell, addCellToAoe, ori); } break; case RangeType.Diagonal: List <Rotation> diagOriList = GetDiagOrientationFromRelative(relativeOrientation, orientation); foreach (Rotation ori in diagOriList) { SelectDiagonal(origin, minRange, maxRange, lineOfSight, mustBeEmpty, needPath, exceptLastCell, addCellToAoe, ori); } break; case RangeType.Single: SelectCell(origin, null, mustBeEmpty, false, addCellToAoe); break; } SelectionState = state; }
internal Matrix <double> BuildViewMatrix() { Matrix <double> result = Matrix <double> .Build.DenseIdentity(4); foreach (var obj in WalkToRoot()) { //Create local affine transformation matrix Matrix <double> affineRotation = Matrix <double> .Build.DenseIdentity(4); affineRotation.SetSubMatrix(0, 0, RelativeRotation.Invert().GetMatrix()); Matrix <double> affineTranslation = Matrix <double> .Build.DenseIdentity(4); affineTranslation.SetColumn(3, 0, RelativePosition.Count, (-1.0f * RelativePosition)); Matrix <double> localTransformation = affineTranslation.Multiply(affineRotation); result *= localTransformation; } return(result); }
public List <Rotation> GetDiagOrientationFromRelative(RelativeRotation relativeOrientation, Rotation current) { List <Rotation> ret = new List <Rotation>(); switch (relativeOrientation) { case RelativeRotation.Front: switch (current) { case Rotation.NE: ret.Add(Rotation.NE); ret.Add(Rotation.NO); break; case Rotation.SO: ret.Add(Rotation.SO); ret.Add(Rotation.SE); break; case Rotation.NO: ret.Add(Rotation.SO); ret.Add(Rotation.NO); break; case Rotation.SE: ret.Add(Rotation.SE); ret.Add(Rotation.NE); break; default: ret.Add(Rotation.NULL); break; } break; case RelativeRotation.Back: switch (current) { case Rotation.NE: ret.Add(Rotation.SO); ret.Add(Rotation.SE); break; case Rotation.SO: ret.Add(Rotation.NO); ret.Add(Rotation.NE); break; case Rotation.NO: ret.Add(Rotation.SE); ret.Add(Rotation.NE); break; case Rotation.SE: ret.Add(Rotation.SO); ret.Add(Rotation.NO); break; default: ret.Add(Rotation.NULL); break; } break; case RelativeRotation.All: ret.Add(Rotation.NE); ret.Add(Rotation.NO); ret.Add(Rotation.SE); ret.Add(Rotation.SO); break; default: break; } return(ret); }