# Copyright 2021 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""References used in the experiments."""

from fusion_tcv import ref_gen
from fusion_tcv import shape
from fusion_tcv import shapes_known
from fusion_tcv import tcv_common

# pylint: disable=bad-whitespace


# Used in TCV#70915
def fundamental_capability() -> ref_gen.AbstractReferenceGenerator:
  return ref_gen.ShapeFromShot([
      # Start at the handover state and hold for ~50ms.
      shape.ReferenceTimeSlice(
          time=0.0872,
          hold=0.15,
          shape=shape.Shape(
              ip=-110000,
              params=shapes_known.SHAPE_70166_0872.params,
              points=shapes_known.SHAPE_70166_0872.points,
              limit_point=shapes_known.SHAPE_70166_0872.limit_point,
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      # Ramp the Ip over 50ms then hold for 50ms.
      shape.ReferenceTimeSlice(
          time=0.2,
          hold=0.25,
          shape=shape.Shape(
              ip=-150000,
              params=shape.ParametrizedShape(
                  r0=0.8796,
                  z0=0.2339,
                  kappa=1.2441,
                  delta=0.2567,
                  radius=0.2390,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6299,  0.1413),
                  shape.Point( 0.6481,  0.0577),
                  shape.Point( 0.6804, -0.0087),
                  shape.Point( 0.7286, -0.0513),
                  shape.Point( 0.7931, -0.0660),
                  shape.Point( 0.8709, -0.0513),
                  shape.Point( 0.9543, -0.0087),
                  shape.Point( 1.0304,  0.0577),
                  shape.Point( 1.0844,  0.1413),
                  shape.Point( 1.1040,  0.2340),
                  shape.Point( 1.0844,  0.3267),
                  shape.Point( 1.0304,  0.4103),
                  shape.Point( 0.9543,  0.4767),
                  shape.Point( 0.8709,  0.5193),
                  shape.Point( 0.7931,  0.5340),
                  shape.Point( 0.7286,  0.5193),
                  shape.Point( 0.6804,  0.4767),
                  shape.Point( 0.6481,  0.4103),
                  shape.Point( 0.6299,  0.3267),
                  shape.Point( 0.6240,  0.2340),
              ],
              limit_point=shape.Point( 0.6240,  0.2340),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      # Transform the shape to the DM handover shape and hold for 50ms.
      shape.ReferenceTimeSlice(
          time=0.3,
          hold=0.35,
          shape=shape.Shape(
              ip=-150000,
              params=shape.ParametrizedShape(
                  r0=0.8822,
                  z0=0.2340,
                  kappa=1.4396,
                  delta=0.2760,
                  radius=0.2388,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6299,  0.1265),
                  shape.Point( 0.6481,  0.0295),
                  shape.Point( 0.6804, -0.0475),
                  shape.Point( 0.7286, -0.0970),
                  shape.Point( 0.7931, -0.1140),
                  shape.Point( 0.8709, -0.0970),
                  shape.Point( 0.9543, -0.0475),
                  shape.Point( 1.0304,  0.0295),
                  shape.Point( 1.0844,  0.1265),
                  shape.Point( 1.1040,  0.2340),
                  shape.Point( 1.0844,  0.3415),
                  shape.Point( 1.0304,  0.4385),
                  shape.Point( 0.9543,  0.5155),
                  shape.Point( 0.8709,  0.5650),
                  shape.Point( 0.7931,  0.5820),
                  shape.Point( 0.7286,  0.5650),
                  shape.Point( 0.6804,  0.5155),
                  shape.Point( 0.6481,  0.4385),
                  shape.Point( 0.6299,  0.3415),
                  shape.Point( 0.6240,  0.2340),
              ],
              limit_point=shape.Point( 0.6240,  0.2340),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      # Shift down by 20cm and hold for 50ms.
      shape.ReferenceTimeSlice(
          time=0.4,
          hold=0.45,
          shape=shape.Shape(
              ip=-150000,
              params=shape.ParametrizedShape(
                  r0=0.8822,
                  z0=0.0340,
                  kappa=1.4396,
                  delta=0.2760,
                  radius=0.2388,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6299, -0.0735),
                  shape.Point( 0.6481, -0.1705),
                  shape.Point( 0.6804, -0.2475),
                  shape.Point( 0.7286, -0.2970),
                  shape.Point( 0.7931, -0.3140),
                  shape.Point( 0.8709, -0.2970),
                  shape.Point( 0.9543, -0.2475),
                  shape.Point( 1.0304, -0.1705),
                  shape.Point( 1.0844, -0.0735),
                  shape.Point( 1.1040,  0.0340),
                  shape.Point( 1.0844,  0.1415),
                  shape.Point( 1.0304,  0.2385),
                  shape.Point( 0.9543,  0.3155),
                  shape.Point( 0.8709,  0.3650),
                  shape.Point( 0.7931,  0.3820),
                  shape.Point( 0.7286,  0.3650),
                  shape.Point( 0.6804,  0.3155),
                  shape.Point( 0.6481,  0.2385),
                  shape.Point( 0.6299,  0.1415),
                  shape.Point( 0.6240,  0.0340),
              ],
              limit_point=shape.Point( 0.6240,  0.0340),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      # Add an X-point and allow to be ANY.
      shape.ReferenceTimeSlice(
          time=0.451,
          shape=shape.Shape(
              ip=-150000,
              params=shape.ParametrizedShape(
                  r0=0.8822,
                  z0=0.0340,
                  kappa=1.4396,
                  delta=0.2760,
                  radius=0.2388,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6299, -0.0735),
                  shape.Point( 0.6481, -0.1705),
                  shape.Point( 0.6804, -0.2475),
                  shape.Point( 0.7286, -0.2970),
                  shape.Point( 0.7931, -0.3140),
                  shape.Point( 0.8709, -0.2970),
                  shape.Point( 0.9543, -0.2475),
                  shape.Point( 1.0304, -0.1705),
                  shape.Point( 1.0844, -0.0735),
                  shape.Point( 1.1040,  0.0340),
                  shape.Point( 1.0844,  0.1415),
                  shape.Point( 1.0304,  0.2385),
                  shape.Point( 0.9543,  0.3155),
                  shape.Point( 0.8709,  0.3650),
                  shape.Point( 0.7931,  0.3820),
                  shape.Point( 0.7286,  0.3650),
                  shape.Point( 0.6804,  0.3155),
                  shape.Point( 0.6481,  0.2385),
                  shape.Point( 0.6299,  0.1415),
                  shape.Point( 0.6240,  0.0340),
              ],
              x_points=[shape.Point( 0.6240, -0.7)],
              diverted=shape.Diverted.ANY,
          ),
      ),
      # Make diverted and hold for 350ms.
      shape.ReferenceTimeSlice(
          time=0.50,
          hold=0.85,
          shape=shape.Shape(  # based on 70519 @ 0.840
              ip=-150000,
              params=shape.ParametrizedShape(
                  r0=0.8618,
                  z0=0.0130,
                  kappa=1.5585,
                  delta=0.3175,
                  radius=0.232,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[
                  shape.Point(0.8286, -0.3612),
                  shape.Point(0.7722, -0.3807),
                  shape.Point(0.7512, -0.3375),
                  shape.Point(0.7246, -0.2900),
                  shape.Point(0.6995, -0.2425),
                  shape.Point(0.6783, -0.1950),
                  shape.Point(0.6627, -0.1475),
                  shape.Point(0.6531, -0.1000),
                  shape.Point(0.6469, -0.0288),
                  shape.Point(0.6461, 0.0425),
                  shape.Point(0.6509, 0.1137),
                  shape.Point(0.6594, 0.1612),
                  shape.Point(0.6738, 0.2087),
                  shape.Point(0.6970, 0.2562),
                  shape.Point(0.7327, 0.2991),
                  shape.Point(0.7722, 0.3243),
                  shape.Point(0.8117, 0.3348),
                  shape.Point(0.8709, 0.3290),
                  shape.Point(0.9104, 0.3143),
                  shape.Point(0.9499, 0.2912),
                  shape.Point(0.9893, 0.2597),
                  shape.Point(1.0164, 0.2325),
                  shape.Point(1.0486, 0.1932),
                  shape.Point(1.0696, 0.1612),
                  shape.Point(1.0938, 0.1137),
                  shape.Point(1.1084, 0.0662),
                  shape.Point(1.1078, -0.0050),
                  shape.Point(1.0937, -0.0525),
                  shape.Point(1.0721, -0.1000),
                  shape.Point(1.0486, -0.1416),
                  shape.Point(1.0288, -0.1720),
                  shape.Point(0.9935, -0.2187),
                  shape.Point(0.9696, -0.2464),
                  shape.Point(0.9301, -0.2856),
                  shape.Point(0.8961, -0.3137),
                  shape.Point(0.8641, -0.3375),
              ],
              x_points=[shape.Point(0.7722, -0.3807)],
              limit_point=shape.Point(0.7722, -0.3807),
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
      # Remove the X-point and let be ANY.
      shape.ReferenceTimeSlice(  # based on 70519 @ 0.840
          time=0.851,
          shape=shape.Shape(
              ip=-150000,
              params=shape.ParametrizedShape(
                  r0=0.8618,
                  z0=0.0130,
                  kappa=1.5585,
                  delta=0.3175,
                  radius=0.232,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[
                  shape.Point(0.8286, -0.3612),
                  shape.Point(0.7722, -0.3807),
                  shape.Point(0.7512, -0.3375),
                  shape.Point(0.7246, -0.2900),
                  shape.Point(0.6995, -0.2425),
                  shape.Point(0.6783, -0.1950),
                  shape.Point(0.6627, -0.1475),
                  shape.Point(0.6531, -0.1000),
                  shape.Point(0.6469, -0.0288),
                  shape.Point(0.6461, 0.0425),
                  shape.Point(0.6509, 0.1137),
                  shape.Point(0.6594, 0.1612),
                  shape.Point(0.6738, 0.2087),
                  shape.Point(0.6970, 0.2562),
                  shape.Point(0.7327, 0.2991),
                  shape.Point(0.7722, 0.3243),
                  shape.Point(0.8117, 0.3348),
                  shape.Point(0.8709, 0.3290),
                  shape.Point(0.9104, 0.3143),
                  shape.Point(0.9499, 0.2912),
                  shape.Point(0.9893, 0.2597),
                  shape.Point(1.0164, 0.2325),
                  shape.Point(1.0486, 0.1932),
                  shape.Point(1.0696, 0.1612),
                  shape.Point(1.0938, 0.1137),
                  shape.Point(1.1084, 0.0662),
                  shape.Point(1.1078, -0.0050),
                  shape.Point(1.0937, -0.0525),
                  shape.Point(1.0721, -0.1000),
                  shape.Point(1.0486, -0.1416),
                  shape.Point(1.0288, -0.1720),
                  shape.Point(0.9935, -0.2187),
                  shape.Point(0.9696, -0.2464),
                  shape.Point(0.9301, -0.2856),
                  shape.Point(0.8961, -0.3137),
                  shape.Point(0.8641, -0.3375),
              ],
              diverted=shape.Diverted.ANY,
          ),
      ),
      # Shift back to round shape.
      shape.ReferenceTimeSlice(
          time=0.90,
          shape=shape.Shape(
              ip=-150000,
              params=shapes_known.SHAPE_70166_0872.params,
              points=shapes_known.SHAPE_70166_0872.points,
              limit_point=shapes_known.SHAPE_70166_0872.limit_point,
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      # Ramp the Ip down.
      shape.ReferenceTimeSlice(
          time=1.00,
          shape=shape.Shape(
              ip=-70000,
              params=shapes_known.SHAPE_70166_0872.params,
              points=shapes_known.SHAPE_70166_0872.points,
              limit_point=shapes_known.SHAPE_70166_0872.limit_point,
              diverted=shape.Diverted.LIMITED,
          ),
      ),
  ])


# Used in TCV#70920
def elongation() -> ref_gen.AbstractReferenceGenerator:
  return ref_gen.ShapeFromShot([
      shape.ReferenceTimeSlice(
          time=0.45,
          hold=0.475,
          shape=shape.Shape(
              params=shapes_known.SHAPE_70166_0450.params,
              diverted=shapes_known.SHAPE_70166_0450.diverted,
              limit_point=shape.Point(tcv_common.INNER_LIMITER_R, 0.25),
              ip=shapes_known.SHAPE_70166_0450.ip)
      ),
      shape.ReferenceTimeSlice(
          time=0.55,
          shape=shape.Shape(
              params=shape.ParametrizedShape(
                  r0=0.875, z0=0.2, kappa=1.9, delta=0.3, radius=0.235,
                  lambda_=0, side=shape.ShapeSide.LEFT),
              ip=-190000,
              limit_point=shape.Point(tcv_common.INNER_LIMITER_R, 0.2),
              diverted=shape.Diverted.LIMITED)
      ),
  ])


# Used in TCV#70457
def negative_triangularity() -> ref_gen.AbstractReferenceGenerator:
  return ref_gen.ShapeFromShot([
      shape.ReferenceTimeSlice(
          time=0.45,
          shape=shape.Shape(
              ip=-120000,
              params=shape.ParametrizedShape(
                  r0=0.89, z0=0.15, kappa=1.4, delta=-0.8, radius=0.25,
                  lambda_=0, side=shape.ShapeSide.LEFT),
              x_points=[
                  shape.Point(tcv_common.OUTER_LIMITER_R - 0.03, 0.50),
                  shape.Point(tcv_common.OUTER_LIMITER_R - 0.03, -0.2),
              ],
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
  ])


# Used in TCV#70755
def snowflake() -> ref_gen.AbstractReferenceGenerator:
  return ref_gen.ShapeFromShot([
      shape.ReferenceTimeSlice(
          time=0.0872,
          shape=shape.Shape(
              ip=-110000,
              params=shapes_known.SHAPE_70166_0872.params,
              points=shapes_known.SHAPE_70166_0872.points,
              limit_point=shapes_known.SHAPE_70166_0872.limit_point,
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.15,  # 0.2680,
          shape=shape.Shape(
              ip=-120000,
              params=shape.ParametrizedShape(
                  r0=0.8713,
                  z0=0.0662,
                  kappa=1.6059,
                  delta=0.3814,
                  radius=0.2378,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6270,  0.0660),
                  shape.Point( 0.6290, -0.0840),
                  shape.Point( 0.6530, -0.2170),
                  shape.Point( 0.7500, -0.3114),
                  shape.Point( 0.9260, -0.2270),
                  shape.Point( 1.0530, -0.0930),
                  shape.Point( 1.1020,  0.0660),
                  shape.Point( 1.0530,  0.2250),
                  shape.Point( 0.9460,  0.3590),
                  shape.Point( 0.8100,  0.4340),
                  shape.Point( 0.7000,  0.4240),
                  shape.Point( 0.6500,  0.3490),
                  shape.Point( 0.6290,  0.2160),
              ],
              x_points=[
                  shape.Point( 0.7000, -0.4700),
              ],
              diverted=shape.Diverted.ANY,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.2,  # 0.4280,
          shape=shape.Shape(
              ip=-120000,
              params=shape.ParametrizedShape(
                  r0=0.8884,
                  z0=0.0319,
                  kappa=1.6229,
                  delta=0.3875,
                  radius=0.2261,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6550,  0.0080),
                  shape.Point( 0.6650, -0.1260),
                  shape.Point( 0.6840, -0.2600),
                  shape.Point( 0.7600, -0.3750),
                  shape.Point( 0.9400, -0.2790),
                  shape.Point( 1.0500, -0.1450),
                  shape.Point( 1.1060,  0.0080),
                  shape.Point( 1.0760,  0.1620),
                  shape.Point( 0.9780,  0.2960),
                  shape.Point( 0.8410,  0.3530),
                  shape.Point( 0.7300,  0.3380),
                  shape.Point( 0.6750,  0.2670),
                  shape.Point( 0.6550,  0.1430),
              ],
              x_points=[
                  shape.Point( 0.7600, -0.3750),
              ],
              limit_point=shape.Point( 0.7600, -0.3750),
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.25,  # 0.5000,
          shape=shape.Shape(
              ip=-120000,
              params=shape.ParametrizedShape(
                  r0=0.8886,
                  z0=0.0044,
                  kappa=1.5419,
                  delta=0.2430,
                  radius=0.2137,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 14 points
                  shape.Point( 0.6780, -0.1200),
                  shape.Point( 0.7200, -0.2360),
                  shape.Point( 0.7840, -0.3754),
                  shape.Point( 0.9090, -0.3040),
                  shape.Point( 1.0040, -0.2110),
                  shape.Point( 1.0660, -0.1110),
                  shape.Point( 1.0950, -0.0030),
                  shape.Point( 1.0800,  0.1070),
                  shape.Point( 1.0210,  0.2070),
                  shape.Point( 0.9250,  0.2740),
                  shape.Point( 0.8090,  0.2730),
                  shape.Point( 0.7170,  0.2040),
                  shape.Point( 0.6660,  0.1010),
                  shape.Point( 0.6570, -0.0100),
              ],
              x_points=[
                  shape.Point( 0.7840, -0.3754),
                  shape.Point( 0.8600, -0.7500),
              ],
              legs=[
                  shape.Point( 0.8220, -0.5627),
              ],
              limit_point=shape.Point( 0.7840, -0.3754),
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.4,  # 0.6000,
          hold=0.8,
          shape=shape.Shape(
              ip=-120000,
              params=shape.ParametrizedShape(
                  r0=0.8886,
                  z0=0.0044,
                  kappa=1.5419,
                  delta=0.2430,
                  radius=0.2137,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 14 points
                  shape.Point( 0.6780, -0.1200),
                  shape.Point( 0.7200, -0.2360),
                  shape.Point( 0.7840, -0.3754),
                  shape.Point( 0.9090, -0.3040),
                  shape.Point( 1.0040, -0.2110),
                  shape.Point( 1.0660, -0.1110),
                  shape.Point( 1.0950, -0.0030),
                  shape.Point( 1.0800,  0.1070),
                  shape.Point( 1.0210,  0.2070),
                  shape.Point( 0.9250,  0.2740),
                  shape.Point( 0.8090,  0.2730),
                  shape.Point( 0.7170,  0.2040),
                  shape.Point( 0.6660,  0.1010),
                  shape.Point( 0.6570, -0.0100),
              ],
              x_points=[
                  shape.Point( 0.7840, -0.3754),
                  shape.Point( 0.8028, -0.4153),
              ],
              legs=[
                  shape.Point( 0.7934, -0.3953),
              ],
              limit_point=shape.Point( 0.7840, -0.3754),
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.9,  # 0.5000,
          shape=shape.Shape(
              ip=-120000,
              params=shape.ParametrizedShape(
                  r0=0.8886,
                  z0=0.0044,
                  kappa=1.5419,
                  delta=0.2430,
                  radius=0.2137,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 14 points
                  shape.Point( 0.6780, -0.1200),
                  shape.Point( 0.7200, -0.2360),
                  shape.Point( 0.7840, -0.3754),
                  shape.Point( 0.9090, -0.3040),
                  shape.Point( 1.0040, -0.2110),
                  shape.Point( 1.0660, -0.1110),
                  shape.Point( 1.0950, -0.0030),
                  shape.Point( 1.0800,  0.1070),
                  shape.Point( 1.0210,  0.2070),
                  shape.Point( 0.9250,  0.2740),
                  shape.Point( 0.8090,  0.2730),
                  shape.Point( 0.7170,  0.2040),
                  shape.Point( 0.6660,  0.1010),
                  shape.Point( 0.6570, -0.0100),
              ],
              x_points=[
                  shape.Point( 0.7840, -0.3754),
                  shape.Point( 0.8600, -0.7500),
              ],
              legs=[
                  shape.Point( 0.8220, -0.5627),
              ],
              limit_point=shape.Point( 0.7840, -0.3754),
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.95,  # 0.4280,
          shape=shape.Shape(
              ip=-120000,
              params=shape.ParametrizedShape(
                  r0=0.8884,
                  z0=0.0319,
                  kappa=1.6229,
                  delta=0.3875,
                  radius=0.2261,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6550,  0.0080),
                  shape.Point( 0.6650, -0.1260),
                  shape.Point( 0.6840, -0.2600),
                  shape.Point( 0.7600, -0.3750),
                  shape.Point( 0.9400, -0.2790),
                  shape.Point( 1.0500, -0.1450),
                  shape.Point( 1.1060,  0.0080),
                  shape.Point( 1.0760,  0.1620),
                  shape.Point( 0.9780,  0.2960),
                  shape.Point( 0.8410,  0.3530),
                  shape.Point( 0.7300,  0.3380),
                  shape.Point( 0.6750,  0.2670),
                  shape.Point( 0.6550,  0.1430),
              ],
              x_points=[
                  shape.Point( 0.7600, -0.3750),
              ],
              diverted=shape.Diverted.ANY,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.0,  # 0.2680,
          shape=shape.Shape(
              ip=-120000,
              params=shape.ParametrizedShape(
                  r0=0.8713,
                  z0=0.0662,
                  kappa=1.6059,
                  delta=0.3814,
                  radius=0.2378,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6270,  0.0660),
                  shape.Point( 0.6290, -0.0840),
                  shape.Point( 0.6530, -0.2170),
                  shape.Point( 0.7500, -0.3114),
                  shape.Point( 0.9260, -0.2270),
                  shape.Point( 1.0530, -0.0930),
                  shape.Point( 1.1020,  0.0660),
                  shape.Point( 1.0530,  0.2250),
                  shape.Point( 0.9460,  0.3590),
                  shape.Point( 0.8100,  0.4340),
                  shape.Point( 0.7000,  0.4240),
                  shape.Point( 0.6500,  0.3490),
                  shape.Point( 0.6290,  0.2160),
              ],
              x_points=[
                  shape.Point( 0.7000, -0.4700),
              ],
              limit_point=shape.Point( 0.6240,  0.0660),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.05,  # 0.0872,
          shape=shape.Shape(
              ip=-70000,
              params=shape.ParametrizedShape(
                  r0=0.8703,
                  z0=0.0547,
                  kappa=1.2459,
                  delta=0.2431,
                  radius=0.2395,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6299, -0.0377),
                  shape.Point( 0.6481, -0.1213),
                  shape.Point( 0.6804, -0.1877),
                  shape.Point( 0.7286, -0.2303),
                  shape.Point( 0.7931, -0.2450),
                  shape.Point( 0.8709, -0.2303),
                  shape.Point( 0.9543, -0.1877),
                  shape.Point( 1.0304, -0.1213),
                  shape.Point( 1.0844, -0.0377),
                  shape.Point( 1.1040,  0.0550),
                  shape.Point( 1.0844,  0.1477),
                  shape.Point( 1.0304,  0.2313),
                  shape.Point( 0.9543,  0.2977),
                  shape.Point( 0.8709,  0.3403),
                  shape.Point( 0.7931,  0.3550),
                  shape.Point( 0.7286,  0.3403),
                  shape.Point( 0.6804,  0.2977),
                  shape.Point( 0.6481,  0.2313),
                  shape.Point( 0.6299,  0.1477),
                  shape.Point( 0.6240,  0.0550),
              ],
              limit_point=shape.Point( 0.6240,  0.0550),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
  ])


# Used in TCV#70600
def iter() -> ref_gen.AbstractReferenceGenerator:  # pylint: disable=redefined-builtin
  return ref_gen.ShapeFromShot([
      # Taken from TCV#70392.
      shape.ReferenceTimeSlice(
          time=0.0872,
          shape=shape.Shape(
              ip=-135000,
              params=shape.ParametrizedShape(
                  r0=0.8831,
                  z0=0.0501,
                  kappa=1.2500,
                  delta=0.1083,
                  radius=0.2400,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6330, -0.0427),
                  shape.Point( 0.6596, -0.1263),
                  shape.Point( 0.7033, -0.1927),
                  shape.Point( 0.7623, -0.2353),
                  shape.Point( 0.8329, -0.2500),
                  shape.Point( 0.9094, -0.2353),
                  shape.Point( 0.9839, -0.1927),
                  shape.Point( 1.0468, -0.1263),
                  shape.Point( 1.0891, -0.0427),
                  shape.Point( 1.1040,  0.0500),
                  shape.Point( 1.0891,  0.1427),
                  shape.Point( 1.0468,  0.2263),
                  shape.Point( 0.9839,  0.2927),
                  shape.Point( 0.9094,  0.3353),
                  shape.Point( 0.8329,  0.3500),
                  shape.Point( 0.7623,  0.3353),
                  shape.Point( 0.7033,  0.2927),
                  shape.Point( 0.6596,  0.2263),
                  shape.Point( 0.6330,  0.1427),
                  shape.Point( 0.6240,  0.0500),
              ],
              limit_point=shape.Point( 0.6240,  0.0500),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.1328,
          shape=shape.Shape(
              ip=-140000,
              params=shape.ParametrizedShape(
                  r0=0.8885,
                  z0=0.0503,
                  kappa=1.4887,
                  delta=0.2421,
                  radius=0.2448,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6305, -0.0636),
                  shape.Point( 0.6505, -0.1660),
                  shape.Point( 0.6855, -0.2473),
                  shape.Point( 0.7366, -0.2995),
                  shape.Point( 0.8037, -0.3175),
                  shape.Point( 0.8830, -0.2995),
                  shape.Point( 0.9666, -0.2473),
                  shape.Point( 1.0420, -0.1660),
                  shape.Point( 1.0949, -0.0636),
                  shape.Point( 1.1140,  0.0500),
                  shape.Point( 1.0949,  0.1636),
                  shape.Point( 1.0420,  0.2660),
                  shape.Point( 0.9666,  0.3473),
                  shape.Point( 0.8830,  0.3995),
                  shape.Point( 0.8037,  0.4175),
                  shape.Point( 0.7366,  0.3995),
                  shape.Point( 0.6855,  0.3473),
                  shape.Point( 0.6505,  0.2660),
                  shape.Point( 0.6305,  0.1636),
                  shape.Point( 0.6240,  0.0500),
              ],
              limit_point=shape.Point( 0.6240,  0.0500),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.1880,
          shape=shape.Shape(
              ip=-140000,
              params=shape.ParametrizedShape(
                  r0=0.8858,
                  z0=0.0502,
                  kappa=1.4899,
                  delta=0.3813,
                  radius=0.2443,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6284, -0.0636),
                  shape.Point( 0.6427, -0.1660),
                  shape.Point( 0.6694, -0.2473),
                  shape.Point( 0.7122, -0.2995),
                  shape.Point( 0.7736, -0.3175),
                  shape.Point( 0.8528, -0.2995),
                  shape.Point( 0.9425, -0.2473),
                  shape.Point( 1.0282, -0.1660),
                  shape.Point( 1.0909, -0.0636),
                  shape.Point( 1.1140,  0.0500),
                  shape.Point( 1.0909,  0.1636),
                  shape.Point( 1.0282,  0.2660),
                  shape.Point( 0.9425,  0.3473),
                  shape.Point( 0.8528,  0.3995),
                  shape.Point( 0.7736,  0.4175),
                  shape.Point( 0.7122,  0.3995),
                  shape.Point( 0.6694,  0.3473),
                  shape.Point( 0.6427,  0.2660),
                  shape.Point( 0.6284,  0.1636),
                  shape.Point( 0.6240,  0.0500),
              ],
              limit_point=shape.Point( 0.6240,  0.0500),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.2280,
          shape=shape.Shape(
              ip=-140000,
              params=shape.ParametrizedShape(
                  r0=0.8820,
                  z0=0.0501,
                  kappa=1.4817,
                  delta=0.4028,
                  radius=0.2386,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 14 points
                  shape.Point( 0.6317, -0.1062),
                  shape.Point( 0.6589, -0.2315),
                  shape.Point( 0.7163, -0.3010),
                  shape.Point( 0.8130, -0.3010),
                  shape.Point( 0.9398, -0.2315),
                  shape.Point( 1.0559, -0.1062),
                  shape.Point( 1.1040,  0.0500),
                  shape.Point( 1.0559,  0.2062),
                  shape.Point( 0.9398,  0.3315),
                  shape.Point( 0.8130,  0.4010),
                  shape.Point( 0.7163,  0.4010),
                  shape.Point( 0.6589,  0.3315),
                  shape.Point( 0.6317,  0.2062),
                  shape.Point( 0.6240,  0.0500),
              ],
              limit_point=shape.Point( 0.6240,  0.0500),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.2680,
          shape=shape.Shape(
              ip=-140000,
              params=shape.ParametrizedShape(
                  r0=0.8780,
                  z0=0.0664,
                  kappa=1.6140,
                  delta=0.3943,
                  radius=0.2376,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6270,  0.0660),
                  shape.Point( 0.6290, -0.0840),
                  shape.Point( 0.6530, -0.2170),
                  shape.Point( 0.7500, -0.3114),
                  shape.Point( 0.9260, -0.2270),
                  shape.Point( 1.0530, -0.0930),
                  shape.Point( 1.1020,  0.0660),
                  shape.Point( 1.0530,  0.2250),
                  shape.Point( 0.9460,  0.3590),
                  shape.Point( 0.8100,  0.4340),
                  shape.Point( 0.7000,  0.4240),
                  shape.Point( 0.6500,  0.3490),
                  shape.Point( 0.6290,  0.2160),
              ],
              x_points=[
                  shape.Point( 0.7000, -0.4700),
              ],
              limit_point=shape.Point( 0.6240,  0.0660),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.3080,
          shape=shape.Shape(
              ip=-140000,
              params=shape.ParametrizedShape(
                  r0=0.8670,
                  z0=0.0394,
                  kappa=1.5594,
                  delta=0.2588,
                  radius=0.2252,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6250,  0.0404),
                  shape.Point( 0.6250, -0.0868),
                  shape.Point( 0.6550, -0.2151),
                  shape.Point( 0.7500, -0.3244),
                  shape.Point( 0.9290, -0.2331),
                  shape.Point( 1.0460, -0.1058),
                  shape.Point( 1.0760,  0.0404),
                  shape.Point( 1.0460,  0.1867),
                  shape.Point( 0.9480,  0.3141),
                  shape.Point( 0.8110,  0.3777),
                  shape.Point( 0.7000,  0.3692),
                  shape.Point( 0.6450,  0.2960),
                  shape.Point( 0.6250,  0.1677),
              ],
              x_points=[
                  shape.Point( 0.7200, -0.4355),
              ],
              limit_point=shape.Point( 0.6240,  0.0404),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.3480,
          shape=shape.Shape(
              ip=-140000,
              params=shape.ParametrizedShape(
                  r0=0.8771,
                  z0=0.0286,
                  kappa=1.6824,
                  delta=0.4348,
                  radius=0.2310,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6350,  0.0263),
                  shape.Point( 0.6350, -0.1045),
                  shape.Point( 0.6550, -0.2344),
                  shape.Point( 0.7400, -0.3462),
                  shape.Point( 0.9390, -0.2528),
                  shape.Point( 1.0560, -0.1229),
                  shape.Point( 1.0860,  0.0263),
                  shape.Point( 1.0560,  0.1745),
                  shape.Point( 0.9580,  0.3054),
                  shape.Point( 0.8210,  0.3703),
                  shape.Point( 0.7100,  0.3606),
                  shape.Point( 0.6550,  0.2860),
                  shape.Point( 0.6350,  0.1561),
              ],
              x_points=[
                  shape.Point( 0.7300, -0.3943),
              ],
              limit_point=shape.Point( 0.6240,  0.0260),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.3880,
          shape=shape.Shape(
              ip=-140000,
              params=shape.ParametrizedShape(
                  r0=0.8878,
                  z0=0.0130,
                  kappa=1.6511,
                  delta=0.4385,
                  radius=0.2291,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6450,  0.0060),
                  shape.Point( 0.6500, -0.1230),
                  shape.Point( 0.6650, -0.2540),
                  shape.Point( 0.7500, -0.3660),
                  shape.Point( 0.9490, -0.2730),
                  shape.Point( 1.0660, -0.1420),
                  shape.Point( 1.0960,  0.0060),
                  shape.Point( 1.0660,  0.1560),
                  shape.Point( 0.9680,  0.2860),
                  shape.Point( 0.8310,  0.3510),
                  shape.Point( 0.7200,  0.3430),
                  shape.Point( 0.6650,  0.2680),
                  shape.Point( 0.6450,  0.1370),
              ],
              x_points=[
                  shape.Point( 0.7400, -0.3960),
              ],
              diverted=shape.Diverted.ANY,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.5000,
          shape=shape.Shape(
              ip=-175000,
              params=shape.ParametrizedShape(
                  r0=0.9069,
                  z0=0.0099,
                  kappa=1.6399,
                  delta=0.4400,
                  radius=0.2255,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6690, -0.1340),
                  shape.Point( 0.6880, -0.2690),
                  shape.Point( 0.7377, -0.3840),
                  shape.Point( 0.8150, -0.3650),
                  shape.Point( 0.9600, -0.2880),
                  shape.Point( 1.0760, -0.1540),
                  shape.Point( 1.1060,  0.0000),
                  shape.Point( 1.0760,  0.1540),
                  shape.Point( 0.9790,  0.2880),
                  shape.Point( 0.8440,  0.3550),
                  shape.Point( 0.6890,  0.2690),
                  shape.Point( 0.6600,  0.1340),
                  shape.Point( 0.6600,  0.0000),
              ],
              x_points=[
                  shape.Point( 0.7377, -0.3840),
              ],
              legs=[
                  shape.Point( 0.7930, -0.5700),
              ],
              limit_point=shape.Point( 0.7377, -0.3840),
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.6200,
          shape=shape.Shape(
              ip=-200000,
              params=shape.ParametrizedShape(
                  r0=0.9044,
                  z0=0.0142,
                  kappa=1.7484,
                  delta=0.4440,
                  radius=0.2257,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6690, -0.1490),
                  shape.Point( 0.7080, -0.2840),  # concave: 181.6 degrees
                  shape.Point( 0.7377, -0.3990),
                  shape.Point( 0.8150, -0.3800),
                  shape.Point( 0.9600, -0.3030),
                  shape.Point( 1.0760, -0.1690),
                  shape.Point( 1.1060, -0.0066),
                  shape.Point( 1.0760,  0.1659),
                  shape.Point( 0.9790,  0.3160),
                  shape.Point( 0.8440,  0.3910),
                  shape.Point( 0.6890,  0.2947),
                  shape.Point( 0.6600,  0.1435),
                  shape.Point( 0.6600, -0.0066),
              ],
              x_points=[
                  shape.Point( 0.7377, -0.3990),
              ],
              legs=[
                  shape.Point( 0.7930, -0.5850),
              ],
              limit_point=shape.Point( 0.7377, -0.3990),
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.9000,
          shape=shape.Shape(
              ip=-240000,
              params=shape.ParametrizedShape(
                  r0=0.9010,
                  z0=0.0152,
                  kappa=1.7482,
                  delta=0.4427,
                  radius=0.2257,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6690, -0.1490),
                  shape.Point( 0.7080, -0.2840),  # concave: 181.6 degrees
                  shape.Point( 0.7377, -0.3990),
                  shape.Point( 0.8150, -0.3800),
                  shape.Point( 0.9600, -0.3030),
                  shape.Point( 1.0760, -0.1690),
                  shape.Point( 1.1060, -0.0066),
                  shape.Point( 1.0760,  0.1659),
                  shape.Point( 0.9790,  0.3160),
                  shape.Point( 0.8440,  0.3910),
                  shape.Point( 0.6890,  0.2947),
                  shape.Point( 0.6600,  0.1435),
                  shape.Point( 0.6600, -0.0066),
              ],
              x_points=[
                  shape.Point( 0.7377, -0.3990),
              ],
              legs=[
                  shape.Point( 0.7930, -0.5850),
              ],
              limit_point=shape.Point( 0.7377, -0.3990),
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=0.9500,
          shape=shape.Shape(
              ip=-245000,
              params=shape.ParametrizedShape(
                  r0=0.8985,
                  z0=0.0173,
                  kappa=1.7213,
                  delta=0.4905,
                  radius=0.2261,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 14 points
                  shape.Point( 0.6690, -0.1490),
                  shape.Point( 0.7200, -0.2840),
                  shape.Point( 0.7600, -0.3890),
                  shape.Point( 0.8500, -0.3700),
                  shape.Point( 0.9600, -0.2850),
                  shape.Point( 1.0760, -0.1590),
                  shape.Point( 1.1060,  0.0030),
                  shape.Point( 1.0660,  0.1760),
                  shape.Point( 1.0000,  0.2650),
                  shape.Point( 0.9200,  0.3360),
                  shape.Point( 0.7500,  0.3850),
                  shape.Point( 0.6650,  0.2850),
                  shape.Point( 0.6600,  0.1430),
                  shape.Point( 0.6600, -0.0070),
              ],
              x_points=[
                  shape.Point( 0.7600, -0.3890),
              ],
              legs=[
                  shape.Point( 0.8430, -0.5850),
              ],
              limit_point=shape.Point( 0.7600, -0.3890),
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.1500,
          shape=shape.Shape(
              ip=-260000,
              params=shape.ParametrizedShape(
                  r0=0.8970,
                  z0=0.0180,
                  kappa=1.7142,
                  delta=0.4877,
                  radius=0.2262,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 14 points
                  shape.Point( 0.6690, -0.1490),
                  shape.Point( 0.7200, -0.2840),
                  shape.Point( 0.7600, -0.3890),
                  shape.Point( 0.8500, -0.3700),
                  shape.Point( 0.9600, -0.2850),
                  shape.Point( 1.0760, -0.1590),
                  shape.Point( 1.1060,  0.0030),
                  shape.Point( 1.0660,  0.1760),
                  shape.Point( 1.0000,  0.2650),
                  shape.Point( 0.9200,  0.3360),
                  shape.Point( 0.7500,  0.3850),
                  shape.Point( 0.6650,  0.2850),
                  shape.Point( 0.6600,  0.1430),
                  shape.Point( 0.6600, -0.0070),
              ],
              x_points=[
                  shape.Point( 0.7600, -0.3890),
              ],
              legs=[
                  shape.Point( 0.8430, -0.5850),
              ],
              limit_point=shape.Point( 0.7600, -0.3890),
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.4500,
          shape=shape.Shape(
              ip=-280000,
              params=shape.ParametrizedShape(
                  r0=0.8955,
                  z0=0.0186,
                  kappa=1.7143,
                  delta=0.4841,
                  radius=0.2262,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 14 points
                  shape.Point( 0.6690, -0.1490),
                  shape.Point( 0.7200, -0.2840),
                  shape.Point( 0.7600, -0.3890),
                  shape.Point( 0.8500, -0.3700),
                  shape.Point( 0.9600, -0.2850),
                  shape.Point( 1.0760, -0.1590),
                  shape.Point( 1.1060,  0.0030),
                  shape.Point( 1.0660,  0.1760),
                  shape.Point( 1.0000,  0.2650),
                  shape.Point( 0.9200,  0.3360),
                  shape.Point( 0.7500,  0.3850),
                  shape.Point( 0.6650,  0.2850),
                  shape.Point( 0.6600,  0.1430),
                  shape.Point( 0.6600, -0.0070),
              ],
              x_points=[
                  shape.Point( 0.7600, -0.3890),
              ],
              legs=[
                  shape.Point( 0.8430, -0.5850),
              ],
              limit_point=shape.Point( 0.7600, -0.3890),
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.7000,
          shape=shape.Shape(
              ip=-280000,
              params=shape.ParametrizedShape(
                  r0=0.8955,
                  z0=0.0186,
                  kappa=1.7143,
                  delta=0.4841,
                  radius=0.2262,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 14 points
                  shape.Point( 0.6690, -0.1490),
                  shape.Point( 0.7200, -0.2840),
                  shape.Point( 0.7600, -0.3890),
                  shape.Point( 0.8500, -0.3700),
                  shape.Point( 0.9600, -0.2850),
                  shape.Point( 1.0760, -0.1590),
                  shape.Point( 1.1060,  0.0030),
                  shape.Point( 1.0660,  0.1760),
                  shape.Point( 1.0000,  0.2650),
                  shape.Point( 0.9200,  0.3360),
                  shape.Point( 0.7500,  0.3850),
                  shape.Point( 0.6650,  0.2850),
                  shape.Point( 0.6600,  0.1430),
                  shape.Point( 0.6600, -0.0070),
              ],
              x_points=[
                  shape.Point( 0.7600, -0.3890),
              ],
              legs=[
                  shape.Point( 0.8430, -0.5850),
              ],
              limit_point=shape.Point( 0.7600, -0.3890),
              diverted=shape.Diverted.DIVERTED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.7600,
          shape=shape.Shape(
              ip=-140000,
              params=shape.ParametrizedShape(
                  r0=0.8873,
                  z0=0.0281,
                  kappa=1.6534,
                  delta=0.4388,
                  radius=0.2288,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6450,  0.0210),
                  shape.Point( 0.6500, -0.1080),
                  shape.Point( 0.6650, -0.2390),
                  shape.Point( 0.7500, -0.3510),
                  shape.Point( 0.9490, -0.2580),
                  shape.Point( 1.0660, -0.1270),
                  shape.Point( 1.0960,  0.0210),
                  shape.Point( 1.0660,  0.1710),
                  shape.Point( 0.9680,  0.3010),
                  shape.Point( 0.8310,  0.3660),
                  shape.Point( 0.7200,  0.3580),
                  shape.Point( 0.6650,  0.2830),
                  shape.Point( 0.6450,  0.1520),
              ],
              x_points=[
                  shape.Point( 0.7400, -0.3810),
              ],
              diverted=shape.Diverted.ANY,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.7800,
          shape=shape.Shape(
              ip=-140000,
              params=shape.ParametrizedShape(
                  r0=0.8770,
                  z0=0.0436,
                  kappa=1.6840,
                  delta=0.4370,
                  radius=0.2306,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6350,  0.0413),
                  shape.Point( 0.6350, -0.0895),
                  shape.Point( 0.6550, -0.2194),
                  shape.Point( 0.7400, -0.3312),
                  shape.Point( 0.9390, -0.2378),
                  shape.Point( 1.0560, -0.1079),
                  shape.Point( 1.0860,  0.0413),
                  shape.Point( 1.0560,  0.1895),
                  shape.Point( 0.9580,  0.3204),
                  shape.Point( 0.8210,  0.3853),
                  shape.Point( 0.7100,  0.3756),
                  shape.Point( 0.6550,  0.3010),
                  shape.Point( 0.6350,  0.1711),
              ],
              x_points=[
                  shape.Point( 0.7300, -0.3793),
              ],
              limit_point=shape.Point( 0.6240,  0.0410),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.8000,
          shape=shape.Shape(
              ip=-140000,
              params=shape.ParametrizedShape(
                  r0=0.8784,
                  z0=0.0865,
                  kappa=1.6166,
                  delta=0.3958,
                  radius=0.2378,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 13 points
                  shape.Point( 0.6270,  0.0860),
                  shape.Point( 0.6290, -0.0640),
                  shape.Point( 0.6530, -0.1970),
                  shape.Point( 0.7500, -0.2914),
                  shape.Point( 0.9260, -0.2070),
                  shape.Point( 1.0530, -0.0730),
                  shape.Point( 1.1020,  0.0860),
                  shape.Point( 1.0530,  0.2450),
                  shape.Point( 0.9460,  0.3790),
                  shape.Point( 0.8100,  0.4540),
                  shape.Point( 0.7000,  0.4440),
                  shape.Point( 0.6500,  0.3690),
                  shape.Point( 0.6290,  0.2360),
              ],
              x_points=[
                  shape.Point( 0.7000, -0.4500),
              ],
              limit_point=shape.Point( 0.6240,  0.0860),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.8100,
          shape=shape.Shape(
              ip=-120000,
              params=shape.ParametrizedShape(
                  r0=0.8865,
                  z0=0.0501,
                  kappa=1.3991,
                  delta=0.1188,
                  radius=0.2402,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6330, -0.0538),
                  shape.Point( 0.6596, -0.1475),
                  shape.Point( 0.7033, -0.2218),
                  shape.Point( 0.7623, -0.2696),
                  shape.Point( 0.8329, -0.2860),
                  shape.Point( 0.9094, -0.2696),
                  shape.Point( 0.9839, -0.2218),
                  shape.Point( 1.0468, -0.1475),
                  shape.Point( 1.0891, -0.0538),
                  shape.Point( 1.1040,  0.0500),
                  shape.Point( 1.0891,  0.1538),
                  shape.Point( 1.0468,  0.2475),
                  shape.Point( 0.9839,  0.3218),
                  shape.Point( 0.9094,  0.3696),
                  shape.Point( 0.8329,  0.3860),
                  shape.Point( 0.7623,  0.3696),
                  shape.Point( 0.7033,  0.3218),
                  shape.Point( 0.6596,  0.2475),
                  shape.Point( 0.6330,  0.1538),
                  shape.Point( 0.6240,  0.0500),
              ],
              limit_point=shape.Point( 0.6240,  0.0500),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.8200,
          shape=shape.Shape(
              ip=-94000,
              params=shape.ParametrizedShape(
                  r0=0.8523,
                  z0=0.0500,
                  kappa=1.0904,
                  delta=0.0128,
                  radius=0.2106,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6339, -0.0207),
                  shape.Point( 0.6627, -0.0845),
                  shape.Point( 0.7078, -0.1352),
                  shape.Point( 0.7653, -0.1677),
                  shape.Point( 0.8298, -0.1789),
                  shape.Point( 0.8951, -0.1677),
                  shape.Point( 0.9547, -0.1352),
                  shape.Point( 1.0024, -0.0845),
                  shape.Point( 1.0333, -0.0207),
                  shape.Point( 1.0440,  0.0500),
                  shape.Point( 1.0333,  0.1207),
                  shape.Point( 1.0024,  0.1845),
                  shape.Point( 0.9547,  0.2352),
                  shape.Point( 0.8951,  0.2677),
                  shape.Point( 0.8298,  0.2789),
                  shape.Point( 0.7653,  0.2677),
                  shape.Point( 0.7078,  0.2352),
                  shape.Point( 0.6627,  0.1845),
                  shape.Point( 0.6339,  0.1207),
                  shape.Point( 0.6240,  0.0500),
              ],
              limit_point=shape.Point( 0.6240,  0.0500),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.8300,
          shape=shape.Shape(
              ip=-53000,
              params=shape.ParametrizedShape(
                  r0=0.8048,
                  z0=0.0501,
                  kappa=1.0631,
                  delta=0.0036,
                  radius=0.1680,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6322, -0.0050),
                  shape.Point( 0.6559, -0.0545),
                  shape.Point( 0.6928, -0.0939),
                  shape.Point( 0.7394, -0.1192),
                  shape.Point( 0.7910, -0.1279),
                  shape.Point( 0.8426, -0.1192),
                  shape.Point( 0.8892, -0.0939),
                  shape.Point( 0.9261, -0.0545),
                  shape.Point( 0.9498, -0.0050),
                  shape.Point( 0.9580,  0.0500),
                  shape.Point( 0.9498,  0.1050),
                  shape.Point( 0.9261,  0.1545),
                  shape.Point( 0.8892,  0.1939),
                  shape.Point( 0.8426,  0.2192),
                  shape.Point( 0.7910,  0.2279),
                  shape.Point( 0.7394,  0.2192),
                  shape.Point( 0.6928,  0.1939),
                  shape.Point( 0.6559,  0.1545),
                  shape.Point( 0.6322,  0.1050),
                  shape.Point( 0.6240,  0.0500),
              ],
              limit_point=shape.Point( 0.6240,  0.0500),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.8400,
          shape=shape.Shape(
              ip=-22000,
              params=shape.ParametrizedShape(
                  r0=0.7484,
                  z0=0.0489,
                  kappa=1.0666,
                  delta=0.0258,
                  radius=0.1176,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6297,  0.0109),
                  shape.Point( 0.6462, -0.0243),
                  shape.Point( 0.6718, -0.0523),
                  shape.Point( 0.7042, -0.0703),
                  shape.Point( 0.7400, -0.0764),
                  shape.Point( 0.7758, -0.0703),
                  shape.Point( 0.8082, -0.0523),
                  shape.Point( 0.8338, -0.0243),
                  shape.Point( 0.8503,  0.0109),
                  shape.Point( 0.8560,  0.0500),
                  shape.Point( 0.8503,  0.0891),
                  shape.Point( 0.8338,  0.1243),
                  shape.Point( 0.8082,  0.1523),
                  shape.Point( 0.7758,  0.1703),
                  shape.Point( 0.7400,  0.1764),
                  shape.Point( 0.7042,  0.1703),
                  shape.Point( 0.6718,  0.1523),
                  shape.Point( 0.6462,  0.1243),
                  shape.Point( 0.6297,  0.0891),
                  shape.Point( 0.6240,  0.0500),
              ],
              limit_point=shape.Point( 0.6240,  0.0500),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
      shape.ReferenceTimeSlice(
          time=1.8500,
          shape=shape.Shape(
              ip=-12000,
              params=shape.ParametrizedShape(
                  r0=0.7149,
                  z0=0.0494,
                  kappa=1.0830,
                  delta=0.0382,
                  radius=0.0871,
                  lambda_=0,
                  side=shape.ShapeSide.NOSHIFT,
              ),
              points=[  # 20 points
                  shape.Point( 0.6282,  0.0198),
                  shape.Point( 0.6402, -0.0075),
                  shape.Point( 0.6590, -0.0291),
                  shape.Point( 0.6827, -0.0430),
                  shape.Point( 0.7090, -0.0477),
                  shape.Point( 0.7353, -0.0430),
                  shape.Point( 0.7590, -0.0291),
                  shape.Point( 0.7778, -0.0075),
                  shape.Point( 0.7898,  0.0198),
                  shape.Point( 0.7940,  0.0500),
                  shape.Point( 0.7898,  0.0802),
                  shape.Point( 0.7778,  0.1075),
                  shape.Point( 0.7590,  0.1291),
                  shape.Point( 0.7353,  0.1430),
                  shape.Point( 0.7090,  0.1478),
                  shape.Point( 0.6827,  0.1430),
                  shape.Point( 0.6590,  0.1291),
                  shape.Point( 0.6402,  0.1075),
                  shape.Point( 0.6282,  0.0802),
                  shape.Point( 0.6240,  0.0500),
              ],
              limit_point=shape.Point( 0.6240,  0.0500),
              diverted=shape.Diverted.LIMITED,
          ),
      ),
  ])


# Used in TCV#69545
def droplet() -> ref_gen.AbstractReferenceGenerator:
  """Hold the droplet at handover for TCV#69198 then ramp the Ip."""
  init = ref_gen.RZIpTarget(r=0.875, z=0.55, ip=-72500)
  final = ref_gen.RZIpTarget(r=0.875, z=0.47, ip=-110000)
  return ref_gen.FixedReferenceGenerator([
      ref_gen.LinearTransition(
          transition_steps=0,
          steady_steps=350,  # Intentionally short. Mostly want to ramp.
          reference=ref_gen.make_symmetric_multidomain_rzip_reference(init)),
      ref_gen.LinearTransition(
          transition_steps=400,
          steady_steps=100000,  # Hold forever.
          reference=ref_gen.make_symmetric_multidomain_rzip_reference(final)),
  ])


_REFERENCES = [
    fundamental_capability,
    elongation,
    iter,
    negative_triangularity,
    snowflake,
    droplet,
]
REFERENCES = {f.__name__: f for f in _REFERENCES}
