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


C++ Point::DistanceTo方法代码示例

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


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

示例1: main

int main(){
	SwapCase a;
	SwapCase b;

	a.num = 2;
	b.num = 6;

	swap<int>(a.num, b.num);

	a.fnum = -90;
	b.fnum = 200;

	swap<float>(a.fnum, b.fnum);

	a.lett = 'P';
	b.lett = 'Q';

	swap<char>(a.lett, b.lett);

	a.yep = false;
	b.yep = true;
	
	swap<bool>(a.yep, b.yep);

	//-----------------------------------------------

	Point<int> c;
	Point<int> d;
	
	c.SetZero();
	d.SetZero();
	
	c.SetPoint(56, 29);
	d.SetPoint(852, 213);

	c.DistanceTo(d);

	//-------------------

	Point<float> e;
	Point<float> f;

	e.SetZero();
	f.SetZero();

	e.SetPoint(56, 29);
	f.SetPoint(852, 213);

	e.DistanceTo(f);

	return 0;

}
开发者ID:juliamauri,项目名称:Programacio_II,代码行数:53,代码来源:main.cpp

示例2: configure

		/**
		This is based on a nearest node criterion to all boundaries.

		@todo Improve efficiency. In most cases, we should be able to specify boundaries as planes
		@todo Somewhat dependent on the resolution of the model boundary
		*/
		bool OmegaBDistanceConfigurator::configure(Model& m) const
		{
			Point<3> ebc;
			m.UpdateIndices();
			vector<size_t> omega_ids;
			omega_ids.reserve(m.Region("Model").Elements());
			for (const auto& eit : m.Region("Model").ElementVector())
			{
				ebc = eit->BaryCenter();
				double dmin = numeric_limits<double>::max();
				for (Model::boundaryIterator bit = m.BoundariesBegin(); bit != m.BoundariesEnd(); ++bit)
				{
					if (!is_main_boundary_id(bit->first.second))
						continue;
					for (const auto& bnit : bit->second.NodeVector())
					{
						double const dist = ebc.DistanceTo(bnit->Coordinate());
						if (dist < dmin)
							dmin = dist;
					}
				}
				if (dmin >= dist_)
					omega_ids.push_back(eit->Idx());
			}
			if (omega_ids.size()) {
				m.FormRegionFrom("omega", omega_ids);
				return true;
			}
			return false;
		}
开发者ID:robinnthomas,项目名称:tensor_permeability,代码行数:36,代码来源:omega_bdistance_configurator.cpp

示例3: Length

        //we don't define setters for this class, so it would technically be more efficient to calculate
        //length in our constructor and then store it as a property...
        double Length()
        {

            return p1.DistanceTo(p2);

        }
开发者ID:nathansoz,项目名称:cs161,代码行数:8,代码来源:geom.cpp


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