本文整理汇总了C++中Sphere::area方法的典型用法代码示例。如果您正苦于以下问题:C++ Sphere::area方法的具体用法?C++ Sphere::area怎么用?C++ Sphere::area使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sphere
的用法示例。
在下文中一共展示了Sphere::area方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: red
REQUIRE(s1.radius() == 0);
REQUIRE(s1.mp().x == 0);
REQUIRE(s1.mp().y == 0);
REQUIRE(s1.mp().z == 0);
double r = 3;
glm::vec3 v{3};
Sphere s2{v, r};
REQUIRE(s2.radius() == 3);
REQUIRE(s2.mp().x == 3);
REQUIRE(s2.mp().y == 3);
REQUIRE(s2.mp().z == 3);
REQUIRE(Approx(s2.volume()) == 113.097);
REQUIRE(Approx(s2.area()) == 113.097);
Color red(255 , 0 , 0);
Material m1("m1", red, red, red, 0);
glm::vec3 position (0);
Sphere s3{v, r, "s3", m1};
REQUIRE(s3.name() == "s3");
REQUIRE(s3.material().ka() == red);
}
TEST_CASE("Box","[Box]")
{
Box b1{};
示例2: REQUIRE
{
std::cout << " First test" << std::endl;
Sphere sp1;
glm::vec3 ur{};
Color white{0.0, 0.0, 0.0};
REQUIRE(sp1.radius() == (0.0));
REQUIRE(sp1.center() == ur);
REQUIRE(sp1.color() == white);
REQUIRE(sp1.name() == "no name" );
glm::vec3 c{3.0, 3.0, 3.0};
Sphere sp2{c, 2.5};
REQUIRE(sp2.center() == c );
REQUIRE(sp2.center() == glm::vec3(3.0, 3.0, 3.0));
REQUIRE(sp2.radius() == (2.5));
REQUIRE(sp2.area() == Approx(78.5398));
REQUIRE(sp2.volume() == Approx(65.4498));
REQUIRE(sp2.color() == white);
REQUIRE(sp2.name() == "no name");
glm::vec3 d{5.0, 5.0, 5.0};
Color pink{128, 76, 51};
Sphere sp3{d, 3.0, pink, "Sphere 3"};
REQUIRE(sp3.center() == glm::vec3(5.0, 5.0, 5.0));
REQUIRE(sp3.radius() == (3.0));
REQUIRE(sp3.area() == Approx(113.097));
REQUIRE(sp3.volume() == Approx(113.097));
REQUIRE(sp3.color() == pink);
REQUIRE(sp3.name() == "Sphere 3");
}