private void LocateVertex(IAxis axis, Vertex3D vertex, params double[] additionalOffset) { var coordinates = vertex.Position.CoordinatesValues.ToArray(); var vertexOffset = new Offset { CoordinateValue = coordinates[axis.IndexNumber], DistanceBetweenVertices = DistancesBetween[axis.IndexNumber], AdditionalOffset = additionalOffset.ElementAtOrDefault(axis.IndexNumber), VertexSize = vertex.Size }; double offset = vertexOffset.VertexOffset; if (!(vertex.Transform is TranslateTransform3D transform)) { string paramName = nameof(vertex.Transform); string requiredType = nameof(TranslateTransform3D); string message = $"{paramName} is not of type {requiredType}"; throw new Exception(message); } axis.Offset(transform, offset); }