Skip to content

Commit af617cc

Browse files
committed
melchior's comment
1 parent 90d191d commit af617cc

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

src/geode/geometry/normal_frame_transform.cpp

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,48 +40,53 @@ namespace geode
4040
{
4141
for( const auto d_from : LRange{ dimension } )
4242
{
43-
directions_[d_from] =
44-
normal_frame_transform.direction( d_from );
45-
orientations_[d_from] =
46-
normal_frame_transform.orientation( d_from );
4743
magnitudes_[d_from] =
4844
to.direction( normal_frame_transform.direction( d_from ) )
4945
.length()
5046
/ from.direction( d_from ).length();
5147
}
5248
}
5349

54-
Frame< dimension > apply( const Frame< dimension >& frame ) const
50+
Frame< dimension > apply(
51+
const FrameTransform< dimension >& base_transform,
52+
const Frame< dimension >& frame ) const
5553
{
5654
Frame< dimension > result;
5755
for( const auto d : LRange{ dimension } )
5856
{
59-
result.set_direction( directions_[d],
60-
frame.direction( d ) * orientations_[d] * magnitudes_[d] );
57+
result.set_direction( base_transform.direction( d ),
58+
frame.direction( d ) * base_transform.orientation( d )
59+
* magnitudes_[d] );
6160
}
6261
return result;
6362
}
6463

65-
Point< dimension > apply( const Point< dimension >& point ) const
64+
Point< dimension > apply(
65+
const FrameTransform< dimension >& base_transform,
66+
const Point< dimension >& point ) const
6667
{
6768
Point< dimension > result;
6869
for( const auto d : LRange{ dimension } )
6970
{
70-
result.set_value( d, orientations_[d]
71-
* point.value( directions_[d] )
72-
* magnitudes_[d] );
71+
result.set_value(
72+
d, base_transform.orientation( d )
73+
* point.value( base_transform.direction( d ) )
74+
* magnitudes_[d] );
7375
}
7476
return result;
7577
}
7678

77-
Vector< dimension > apply( const Vector< dimension >& vector ) const
79+
Vector< dimension > apply(
80+
const FrameTransform< dimension >& base_transform,
81+
const Vector< dimension >& vector ) const
7882
{
7983
Vector< dimension > result;
8084
for( const auto d : LRange{ dimension } )
8185
{
82-
result.set_value( d, orientations_[d]
83-
* vector.value( directions_[d] )
84-
* magnitudes_[d] );
86+
result.set_value(
87+
d, base_transform.orientation( d )
88+
* vector.value( base_transform.direction( d ) )
89+
* magnitudes_[d] );
8590
}
8691
return result;
8792
}
@@ -106,21 +111,21 @@ namespace geode
106111
Frame< dimension > NormalFrameTransform< dimension >::apply(
107112
const Frame< dimension >& frame ) const
108113
{
109-
return impl_->apply( frame );
114+
return impl_->apply( *this, frame );
110115
}
111116

112117
template < index_t dimension >
113118
Vector< dimension > NormalFrameTransform< dimension >::apply(
114119
const Vector< dimension >& vector ) const
115120
{
116-
return impl_->apply( vector );
121+
return impl_->apply( *this, vector );
117122
}
118123

119124
template < index_t dimension >
120125
Point< dimension > NormalFrameTransform< dimension >::apply(
121126
const Point< dimension >& point ) const
122127
{
123-
return impl_->apply( point );
128+
return impl_->apply( *this, point );
124129
}
125130
template class opengeode_geometry_api NormalFrameTransform< 2 >;
126131
template class opengeode_geometry_api NormalFrameTransform< 3 >;

0 commit comments

Comments
 (0)