MOAB: Mesh Oriented datABase  (version 5.4.1)
ConicDomainTest Class Reference
+ Inheritance diagram for ConicDomainTest:
+ Collaboration diagram for ConicDomainTest:

Public Member Functions

void test_construct ()
void test_snap_to ()
void test_normal_at ()
void test_closest_point ()
void test_domain_DoF ()

Private Member Functions

 CPPUNIT_TEST_SUITE (ConicDomainTest)
 CPPUNIT_TEST (test_construct)
 CPPUNIT_TEST (test_snap_to)
 CPPUNIT_TEST (test_normal_at)
 CPPUNIT_TEST (test_closest_point)
 CPPUNIT_TEST (test_domain_DoF)
 CPPUNIT_TEST_SUITE_END ()

Detailed Description

Definition at line 38 of file ConicDomainTest.cpp.


Member Function Documentation

Definition at line 146 of file ConicDomainTest.cpp.

References ASSERT_NO_ERROR, b, MBMesquite::ConicDomain::closest_point(), and CPPUNIT_ASSERT_VECTORS_EQUAL.

{
    const double a = 3.0, b = 4.0;
    const double f = a * b / ( a * a + b * b );
    ConicDomain cone( a, b );
    MsqError err;

    Vector3D pt( b, 0, a ), close, norm;
    cone.closest_point( 0, pt, close, norm, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt * f, close, 1e-6 );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt / pt.length(), norm, 1e-6 );

    pt = Vector3D( 0, b, a );
    cone.closest_point( 0, pt, close, norm, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt * f, close, 1e-6 );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt / pt.length(), norm, 1e-6 );

    pt = Vector3D( 0, -b, a );
    cone.closest_point( 0, pt, close, norm, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt * f, close, 1e-6 );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt / pt.length(), norm, 1e-6 );

    pt = Vector3D( -b, 0, a );
    cone.closest_point( 0, pt, close, norm, err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt * f, close, 1e-6 );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt / pt.length(), norm, 1e-6 );
}

Definition at line 59 of file ConicDomainTest.cpp.

References MBMesquite::ConicDomain::axis(), CPPUNIT_ASSERT_DOUBLES_EQUAL, CPPUNIT_ASSERT_VECTORS_EQUAL, MBMesquite::ConicDomain::height_from_point(), MBMesquite::Vector3D::length(), MBMesquite::ConicDomain::point(), and MBMesquite::ConicDomain::point_radius().

{
    double rad = 1.5;
    double hei = 20.1;
    Vector3D axis( 1, 2, 3 );
    Vector3D point( -1, -1, 1 );
    ConicDomain dom( rad, hei, axis, point );

    axis /= axis.length();
    CPPUNIT_ASSERT_VECTORS_EQUAL( axis, dom.axis(), 1e-6 );
    CPPUNIT_ASSERT_VECTORS_EQUAL( point, dom.point(), 1e-18 );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( rad, dom.point_radius(), 1e-18 );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( hei, dom.height_from_point(), 1e-18 );
}

Definition at line 178 of file ConicDomainTest.cpp.

References MBMesquite::arrptr(), ASSERT_NO_ERROR, CPPUNIT_ASSERT, and dof().

{
    std::vector< Mesh::VertexHandle > junk( 10 );
    std::vector< unsigned short > dof( junk.size() );
    std::vector< unsigned short > expected( dof.size(), 2 );
    ConicDomain dom;
    MsqPrintError err( std::cout );
    dom.domain_DoF( arrptr( junk ), arrptr( dof ), junk.size(), err );
    ASSERT_NO_ERROR( err );
    CPPUNIT_ASSERT( expected == dof );
}

Definition at line 108 of file ConicDomainTest.cpp.

References b, CPPUNIT_ASSERT_VECTORS_EQUAL, MBMesquite::ConicDomain::element_normal_at(), MBMesquite::Vector3D::length(), and MBMesquite::ConicDomain::vertex_normal_at().

{
    const double a = 3.0, b = 4.0;
    ConicDomain cone( a, b );

    Vector3D pt( b, 0, a );
    Vector3D norm( pt );
    cone.vertex_normal_at( 0, norm );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt / pt.length(), norm, 1e-6 );
    norm = pt;
    cone.element_normal_at( 0, norm );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt / pt.length(), norm, 1e-6 );

    pt   = Vector3D( 0, b, a );
    norm = pt;
    cone.vertex_normal_at( 0, norm );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt / pt.length(), norm, 1e-6 );
    norm = pt;
    cone.element_normal_at( 0, norm );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt / pt.length(), norm, 1e-6 );

    pt   = Vector3D( 0, -b, a );
    norm = pt;
    cone.vertex_normal_at( 0, norm );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt / pt.length(), norm, 1e-6 );
    norm = pt;
    cone.element_normal_at( 0, norm );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt / pt.length(), norm, 1e-6 );

    pt   = Vector3D( -b, 0, a );
    norm = pt;
    cone.vertex_normal_at( 0, norm );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt / pt.length(), norm, 1e-6 );
    norm = pt;
    cone.element_normal_at( 0, norm );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt / pt.length(), norm, 1e-6 );
}

Definition at line 74 of file ConicDomainTest.cpp.

References MBMesquite::ConicDomain::axis(), b, CPPUNIT_ASSERT_VECTORS_EQUAL, MBMesquite::ConicDomain::height_from_point(), MBMesquite::ConicDomain::point(), and MBMesquite::ConicDomain::snap_to().

{
    const double a = 3.0, b = 4.0;
    const double f = a * b / ( a * a + b * b );
    ConicDomain cone( a, b );

    // test some points
    Vector3D pt( b, 0, a );
    Vector3D close( pt );
    cone.snap_to( 0, close );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt * f, close, 1e-6 );

    pt    = Vector3D( 0, b, a );
    close = pt;
    cone.snap_to( 0, close );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt * f, close, 1e-6 );

    pt    = Vector3D( 0, -b, a );
    close = pt;
    cone.snap_to( 0, close );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt * f, close, 1e-6 );

    pt    = Vector3D( -b, 0, a );
    close = pt;
    cone.snap_to( 0, close );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt * f, close, 1e-6 );

    // test point at apex
    pt    = cone.point() + cone.height_from_point() * cone.axis();
    close = pt;
    cone.snap_to( 0, close );
    CPPUNIT_ASSERT_VECTORS_EQUAL( pt, close, 1e-6 );
}

List of all members.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines