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


Java MathUtils.simplify方法代码示例

本文整理汇总了Java中com.o3dr.services.android.lib.util.MathUtils.simplify方法的典型用法代码示例。如果您正苦于以下问题:Java MathUtils.simplify方法的具体用法?Java MathUtils.simplify怎么用?Java MathUtils.simplify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.o3dr.services.android.lib.util.MathUtils的用法示例。


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

示例1: onGestureEnded

import com.o3dr.services.android.lib.util.MathUtils; //导入方法依赖的package包/类
@Override
public void onGestureEnded(GestureOverlayView arg0, MotionEvent arg1) {
	overlay.setEnabled(false);
	List<LatLong> path = decodeGesture();
	if (path.size() > 1) {
		path = MathUtils.simplify(path, toleranceInPixels);
	}
	listener.onPathFinished(path);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:10,代码来源:GestureMapFragment.java

示例2: onGestureEnded

import com.o3dr.services.android.lib.util.MathUtils; //导入方法依赖的package包/类
@Override
public void onGestureEnded(GestureOverlayView arg0, MotionEvent arg1) {
	view.setEnabled(false);
	List<LatLong> path = decodeGesture();
	if (path.size() > 1) {
		path = MathUtils.simplify(path, toleranceInPixels);
	}
	listener.onPathFinished(path);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:10,代码来源:PathGesture.java

示例3: exportPathAsMissionItems

import com.o3dr.services.android.lib.util.MathUtils; //导入方法依赖的package包/类
/**
    * Export the given path as a Mission
    * @param pathPoints
    * @return
    */
public static List<MissionItem> exportPathAsMissionItems(List<? extends LatLongAlt> pathPoints, double toleranceInPixels) {
       List<MissionItem> exportedMissionItems = new LinkedList<>();
       if(pathPoints != null && !pathPoints.isEmpty()) {
           List<LatLong> simplifiedPath = MathUtils.simplify(pathPoints, toleranceInPixels);

           int pointsCount = simplifiedPath.size();
           if(pointsCount > 3){
               // When taking off and/or landing the altitude has a tendency to be a bit too low.
               LatLongAlt first = (LatLongAlt) simplifiedPath.get(0);
               LatLongAlt second = (LatLongAlt) simplifiedPath.get(1);
               first.setAltitude((second.getAltitude() + first.getAltitude())/ 2.0);

               LatLongAlt beforeLast = (LatLongAlt) simplifiedPath.get(pointsCount - 2);
               LatLongAlt last = (LatLongAlt) simplifiedPath.get(pointsCount -1);
               last.setAltitude((last.getAltitude() + beforeLast.getAltitude())/2.0);
           }

           SpaceTime lastPoint = null;
           for(LatLong point : simplifiedPath) {
               if(point instanceof SpaceTime) {
                   SpaceTime currentPoint = (SpaceTime) point;
                   if(lastPoint != null) {
                       // Calculate the speed used by the vehicle from the last point to the
                       // current one.
                       double distanceInM = MathUtils.getDistance3D(lastPoint, currentPoint);
                       float deltaTimeInSecs = Math.abs(currentPoint.getTimeInMs()
                           - lastPoint.getTimeInMs()) / 1000F;

                       if (Float.compare(deltaTimeInSecs, 0f) != 0) {
                           double speed = distanceInM / deltaTimeInSecs;
                           ChangeSpeed speedMissionItem = new ChangeSpeed();
                           speedMissionItem.setSpeed(speed);
                           exportedMissionItems.add(speedMissionItem);
                       }
                   }
                   lastPoint = currentPoint;
               }
               else {
                   lastPoint = null;
               }
               SplineWaypoint waypoint = new SplineWaypoint();
               waypoint.setCoordinate((LatLongAlt) point);
               exportedMissionItems.add(waypoint);
           }
       }

       return exportedMissionItems;
   }
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:54,代码来源:MapUtils.java


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