File tree Expand file tree Collapse file tree 3 files changed +53
-1
lines changed Expand file tree Collapse file tree 3 files changed +53
-1
lines changed Original file line number Diff line number Diff line change 22# This file is autogenerated by pip-compile with Python 3.10
33# by the following command:
44#
5- # pip-compile bindings/python/requirements.in
5+ # pip-compile --pre bindings/python/requirements.in
66#
Original file line number Diff line number Diff line change @@ -174,6 +174,26 @@ namespace geode
174174 return oss.str ();
175175 }
176176
177+ [[nodiscard]] Point< dimension - 1 > project_point (
178+ geode::local_index_t axis_to_remove ) const
179+ {
180+ OPENGEODE_ASSERT ( axis_to_remove < dimension && axis_to_remove >= 0 ,
181+ " [Point] Invalid axis to remove" );
182+ OPENGEODE_ASSERT (
183+ dimension > 1 , " [Point] Invalid dimension to reduce" );
184+ Point< dimension - 1 > projected_point;
185+ geode::index_t dim{ 0 };
186+ for ( const auto i : LRange{ dimension } )
187+ {
188+ if ( i != axis_to_remove )
189+ {
190+ projected_point.set_value ( dim, this ->value ( i ) );
191+ dim++;
192+ }
193+ }
194+ return projected_point;
195+ }
196+
177197 private:
178198 friend class bitsery ::Access;
179199 template < typename Archive >
Original file line number Diff line number Diff line change @@ -130,6 +130,38 @@ namespace geode
130130 this ->value ( 0 ) * other.value ( 1 )
131131 - this ->value ( 1 ) * other.value ( 0 ) } };
132132 }
133+
134+ [[nodiscard]] geode::local_index_t most_meaningful_axis () const
135+ {
136+ geode::local_index_t axis{ 0 };
137+ double max{ 0 };
138+ for ( const auto i : LRange{ dimension } )
139+ {
140+ const auto val = std::fabs ( this ->value ( i ) );
141+ if ( val > max )
142+ {
143+ max = val;
144+ axis = i;
145+ }
146+ }
147+ return axis;
148+ }
149+
150+ [[nodiscard]] geode::local_index_t least_meaningful_axis () const
151+ {
152+ geode::local_index_t axis{ 0 };
153+ auto min = std::numeric_limits< double >::max ();
154+ for ( const auto i : LRange{ dimension } )
155+ {
156+ const auto val = std::fabs ( this ->value ( i ) );
157+ if ( val < min )
158+ {
159+ min = val;
160+ axis = i;
161+ }
162+ }
163+ return axis;
164+ }
133165 };
134166 ALIAS_1D_AND_2D_AND_3D ( Vector );
135167
You can’t perform that action at this time.
0 commit comments