-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: add transformation and tranformation
- Loading branch information
Showing
9 changed files
with
365 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//----------------------------------*-C++-*----------------------------------// | ||
// Copyright 2023 UT-Battelle, LLC, and other Celeritas developers. | ||
// See the top-level COPYRIGHT file for details. | ||
// SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
//---------------------------------------------------------------------------// | ||
//! \file orange/transform/TransformTransformer.cc | ||
//---------------------------------------------------------------------------// | ||
#include "TransformTransformer.hh" | ||
|
||
#include "corecel/math/MatrixUtils.hh" | ||
|
||
namespace celeritas | ||
{ | ||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Apply a translation to a transform. | ||
*/ | ||
Transformation TransformTransformer::operator()(Transformation const& tr) const | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Apply a transformation to a translation. | ||
*/ | ||
Translation TransformTransformer::operator()(Translation const& tl) const | ||
{ | ||
return Translation{tl.translation() + tr_}; | ||
} | ||
|
||
//---------------------------------------------------------------------------// | ||
} // namespace celeritas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//----------------------------------*-C++-*----------------------------------// | ||
// Copyright 2023 UT-Battelle, LLC, and other Celeritas developers. | ||
// See the top-level COPYRIGHT file for details. | ||
// SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
//---------------------------------------------------------------------------// | ||
//! \file orange/transform/TransformTransformer.hh | ||
//---------------------------------------------------------------------------// | ||
#pragma once | ||
|
||
#include "Transformation.hh" | ||
|
||
namespace celeritas | ||
{ | ||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Apply a transformation to another transformation. | ||
* | ||
* This accepts a daughter-to-parent transformation: the transformation needed | ||
* to relocate a "lower" universe to a new coordinate system in the "higher" | ||
* universe. | ||
*/ | ||
class TransformTransformer | ||
{ | ||
public: | ||
//! Construct with the new reference frame of the transformation | ||
explicit TransformTransformer(Transformation const& tr) : tr_{tr} {} | ||
|
||
//!@{ | ||
//! Transform a transformation | ||
Transformation operator()(Transformation const&) const; | ||
Transformation operator()(Translation const&) const; | ||
//!@} | ||
|
||
private: | ||
Transformation tr_; | ||
}; | ||
|
||
//---------------------------------------------------------------------------// | ||
} // namespace celeritas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//----------------------------------*-C++-*----------------------------------// | ||
// Copyright 2023 UT-Battelle, LLC, and other Celeritas developers. | ||
// See the top-level COPYRIGHT file for details. | ||
// SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
//---------------------------------------------------------------------------// | ||
//! \file orange/transform/TransformTranslator.cc | ||
//---------------------------------------------------------------------------// | ||
#include "TransformTranslator.hh" | ||
|
||
#include "corecel/math/MatrixUtils.hh" | ||
|
||
namespace celeritas | ||
{ | ||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Apply a translation to a transform. | ||
*/ | ||
Transformation TransformTranslator::operator()(Transformation const& tr) const | ||
{ | ||
return Transformation{tr.rotation(), tr.translation() + tr_}; | ||
} | ||
|
||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Apply a translation to another translation. | ||
*/ | ||
Translation TransformTranslator::operator()(Translation const& tl) const | ||
{ | ||
return Translation{tl.translation() + tr_}; | ||
} | ||
|
||
//---------------------------------------------------------------------------// | ||
} // namespace celeritas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//----------------------------------*-C++-*----------------------------------// | ||
// Copyright 2023 UT-Battelle, LLC, and other Celeritas developers. | ||
// See the top-level COPYRIGHT file for details. | ||
// SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
//---------------------------------------------------------------------------// | ||
//! \file orange/transform/TransformTranslator.hh | ||
//---------------------------------------------------------------------------// | ||
#pragma once | ||
|
||
namespace celeritas | ||
{ | ||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Apply a translation to a transform to get another transform. | ||
* | ||
* This accepts a daughter-to-parent translation: the translation needed to | ||
* relocate a "lower" universe to a new coordinate system in the "higher" | ||
* universe. | ||
*/ | ||
class TransformTranslator | ||
{ | ||
public: | ||
//! Construct with the new reference frame of the translation | ||
explicit TransformTransformer(Translation const& tr) : tr_{tr} {} | ||
|
||
//// TRANSFORMATIONS //// | ||
|
||
Transformation operator()(Transformation const&) const; | ||
|
||
Translation operator()(Translation const&) const; | ||
|
||
private: | ||
Translation tr_; | ||
}; | ||
|
||
//---------------------------------------------------------------------------// | ||
} // namespace celeritas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//----------------------------------*-C++-*----------------------------------// | ||
// Copyright 2023 UT-Battelle, LLC, and other Celeritas developers. | ||
// See the top-level COPYRIGHT file for details. | ||
// SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
//---------------------------------------------------------------------------// | ||
//! \file orange/transform/Transformation.cc | ||
//---------------------------------------------------------------------------// | ||
#include "Transformation.hh" | ||
|
||
namespace celeritas | ||
{ | ||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Construct and check the input. | ||
*/ | ||
Transformation::Transformation(Mat3 const& rot, Real3 const& trans) | ||
: rot_(rot), tra_(trans) | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------// | ||
/*! | ||
* Promote from a translation. | ||
*/ | ||
Transformation::Transformation(Translation const& tr) | ||
: rot_{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, tra_{tr.translation()} | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------// | ||
} // namespace celeritas |
Oops, something went wrong.