当前位置: 首页>>代码示例>>C++>>正文


C++ Orientation::pack方法代码示例

本文整理汇总了C++中Orientation::pack方法的典型用法代码示例。如果您正苦于以下问题:C++ Orientation::pack方法的具体用法?C++ Orientation::pack怎么用?C++ Orientation::pack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Orientation的用法示例。


在下文中一共展示了Orientation::pack方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Declination

TEST (Orientation, MakeTrue) {
	VLOG(1) << "===Orientation Declination (Make True) Test===";
	// location and orientation values 
	double expectedDeclination = 15.95;
	Orientation x { 20.0, -15.0, 10.0 };
	Location y { 47.82167, -122.33639 };
	Orientation z { 0.0, 0.0, 240.0 };
	VLOG(2) << "Orientation x " << x.pack();
	VLOG(2) << "Location y " << y.pack();
	VLOG(2) << "Orientation z " << z.pack();
	VLOG(2) << "Expected Declination " << expectedDeclination;
	
	EXPECT_TRUE(x.isMagnetic());
	EXPECT_TRUE(x.updateDeclination(y));
	VLOG(2) << "Declination is " << x.getDeclination() << ", " << z.getDeclination();
	EXPECT_TRUE(toleranceEquals(x.getDeclination(), z.getDeclination(), TOL));
	Orientation th1 = x.makeTrue();
	EXPECT_FALSE(th1.isMagnetic());
	EXPECT_TRUE(toleranceEquals(th1.heading, x.heading + expectedDeclination, 0.25));
	Orientation th2 = th1.makeTrue();
	EXPECT_FALSE(th2.isMagnetic());
	EXPECT_TRUE(toleranceEquals(th1.heading, th2.heading, TOL));
	VLOG(2) << "Orientation th1 " << th1.pack();
	VLOG(2) << "Orientation th2 " << th2.pack();
}
开发者ID:JeremyRuhland,项目名称:hackerboat,代码行数:25,代码来源:orientation_test.cpp

示例2:

TEST (Orientation, JSON) {
	VLOG(1) << "===Orientation JSON Test===";
	Orientation u { 20.0, -15.0, 60.0 };
	Orientation v;
	Value orient;
	
	orient = u.pack();
	VLOG_IF(orient.IsObject(), 2) << "Output JSON: " << orient;
	v.parse(orient);
	VLOG_IF(v.pack().IsObject(), 2) << "Parsed JSON: " << orient;
	EXPECT_TRUE(toleranceEquals(u.pitch, v.pitch, TOL));
	EXPECT_TRUE(toleranceEquals(u.roll, v.roll, TOL));
	EXPECT_TRUE(toleranceEquals(u.heading, v.heading, TOL));
}
开发者ID:JeremyRuhland,项目名称:hackerboat,代码行数:14,代码来源:orientation_test.cpp


注:本文中的Orientation::pack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。