Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Steve Peters <[email protected]>
Signed-off-by: Benjamin Perseghetti <[email protected]>
  • Loading branch information
bperseghetti and scpeters authored May 17, 2024
1 parent 3a1aa5e commit d5f7070
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/gz/math/MassMatrix3.hh
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ namespace gz
{
return false;
}
T volume = GZ_PI * _radius * _radius * _length;
T volume = GZ_PI * _radius * _radius * _length / 3.0;
return this->SetFromConeZ(_mat.Density() * volume,
_length, _radius, _rot);
}
Expand Down
2 changes: 1 addition & 1 deletion include/gz/math/detail/Cone.hh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ template<typename T>
T Cone<T>::Volume() const
{
return GZ_PI * std::pow(this->radius, 2) *
this->length;
this->length / 3.0;
}

//////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/Cone_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ TEST(ConeTest, VolumeAndDensity)
{
double mass = 1.0;
math::Coned cone(1.0, 0.001);
double expectedVolume = (GZ_PI * std::pow(0.001, 2) * 1.0);
double expectedVolume = (GZ_PI * std::pow(0.001, 2) * 1.0 / 3.0);
EXPECT_DOUBLE_EQ(expectedVolume, cone.Volume());

double expectedDensity = mass / expectedVolume;
Expand Down
2 changes: 1 addition & 1 deletion src/python_pybind11/test/Cone_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_mutators(self):
def test_volume_and_density(self):
mass = 1.0
cone = Coned(1.0, 0.001)
expectedVolume = (math.pi * math.pow(0.001, 2) * 1.0)
expectedVolume = (math.pi * math.pow(0.001, 2) * 1.0 / 3.0)
self.assertEqual(expectedVolume, cone.volume())

expectedDensity = mass / expectedVolume
Expand Down

0 comments on commit d5f7070

Please sign in to comment.