@@ -488,13 +488,20 @@ TimeDependentMapOptions<IsCylindrical>::distorted_to_inertial_map(
488
488
: RotScaleTrans{};
489
489
490
490
if (block_has_shape_map) {
491
- if (rot_scale_trans_map_.has_value () and
492
- (use_rigid_map and skew_map_.has_value ())) {
491
+ // The skew map is only applied within the envelope, which is also where we
492
+ // apply the rigid RotScaleTrans map, so `use_rigid_map` is a sentinel
493
+ // for where we put the skew map (if we have one).
494
+ if (not use_rigid_map) {
495
+ ERROR (
496
+ " 'use_rigid_map' must be true when requesting the distorted to "
497
+ " inertial map with a shape map." );
498
+ }
499
+ if (rot_scale_trans_map_.has_value () and skew_map_.has_value ()) {
493
500
return std::make_unique<detail::di_map<Skew, RotScaleTrans>>(
494
501
skew_map_.value (), rot_scale_trans);
495
502
} else if (rot_scale_trans_map_.has_value ()) {
496
503
return std::make_unique<detail::di_map<RotScaleTrans>>(rot_scale_trans);
497
- } else if (use_rigid_map and skew_map_.has_value ()) {
504
+ } else if (skew_map_.has_value ()) {
498
505
return std::make_unique<detail::di_map<Skew>>(skew_map_.value ());
499
506
} else {
500
507
return std::make_unique<detail::di_map<Identity>>(Identity{});
@@ -601,20 +608,30 @@ TimeDependentMapOptions<IsCylindrical>::grid_to_inertial_map(
601
608
&gsl::at (gsl::at (shape_maps_, index), include_distorted_map.value ());
602
609
}
603
610
ASSERT (shape->has_value (), " Shape map was requested but not built." );
604
- if (rot_scale_trans_map_.has_value () and
605
- (use_rigid_map and skew_map_.has_value ())) {
611
+ // The skew map is only applied within the envelope, which is also where we
612
+ // apply the rigid RotScaleTrans map, so `use_rigid_map` is a sentinel
613
+ // for where we put the skew map (if we have one).
614
+ if (not use_rigid_map) {
615
+ ERROR (
616
+ " 'use_rigid_map' must be true when requesting the grid to inertial "
617
+ " map with a shape map." );
618
+ }
619
+ if (rot_scale_trans_map_.has_value () and skew_map_.has_value ()) {
606
620
return std::make_unique<detail::gi_map<Shape, Skew, RotScaleTrans>>(
607
621
shape->value (), skew_map_.value (), rot_scale_trans);
608
622
} else if (rot_scale_trans_map_.has_value ()) {
609
623
return std::make_unique<detail::gi_map<Shape, RotScaleTrans>>(
610
624
shape->value (), rot_scale_trans);
611
- } else if (use_rigid_map and skew_map_.has_value ()) {
625
+ } else if (skew_map_.has_value ()) {
612
626
return std::make_unique<detail::gi_map<Shape, Skew>>(shape->value (),
613
627
skew_map_.value ());
614
628
} else {
615
629
return std::make_unique<detail::gi_map<Shape>>(shape->value ());
616
630
}
617
631
} else {
632
+ // The skew map is only applied within the envelope, which is also where we
633
+ // apply the rigid RotScaleTrans map, so use `use_rigid_map` as a sentinel
634
+ // for where we put the skew map (if we have one).
618
635
if (rot_scale_trans_map_.has_value () and
619
636
(use_rigid_map and skew_map_.has_value ())) {
620
637
return std::make_unique<detail::gi_map<Skew, RotScaleTrans>>(
0 commit comments