Division of Line Segment

/**  */
void Line::EqualDivision(int nCount, QLineF fline, QList<QPointF> *ltPts)
{
Q_ASSERT(0 != ltPts);
QPointF p1,p2;
float x,y,xStep,yStep,nStepLen; ltPts->clear();
if(nCount<=1){
return;
} p1 = fline.p1();
p2 = fline.p2();
if(p1.x() == p2.x() && p1.y() == p2.y()){
return;
} nStepLen = fline.length()/nCount;
for(int i=1; i<nCount; i++){
x = (i*nStepLen*p2.x() + (nCount-i)*nStepLen*p1.x())/fline.length();
y = (i*nStepLen*p2.y() + (nCount-i)*nStepLen*p1.y())/fline.length();
ltPts->append(QPointF(x,y));
}
}

Reference

math-only-math.com


Division of Line Segment的更多相关文章

  1. HowTo Perform the spatial selection 'Share a line segment with' using ArcObjects

    HowTo  Perform the spatial selection 'Share a line segment with' using ArcObjects Article ID: 26528 ...

  2. 目标检测之线段检测---lsd line segment detector

    (1)线段检测应用背景 (2)线段检测原理简介 (3)线段检测实例 a line segment detector (4)hough 变换和 lsd 的区别 --------------------- ...

  3. HDU 1542/POJ 1151 Atlantis (scaning line + segment tree)

    A template of discretization + scaning line + segment tree. It's easy to understand, but a little di ...

  4. Line segment matching

    FMII2方法:FMII方法的轻微的修改.有限线段和无限线段(直线)的匹配. 求解方法: SVD分解 Unit Quaternion 协方差矩阵: 通过对C进行SVD分解得到R,根据R求得T. 算法流 ...

  5. Android OpenGL ES(九)绘制线段Line Segment .

    创建一个DrawLine Activity,定义四个顶点: float vertexArray[] = { -0.8f, -0.4f * 1.732f, 0.0f, -0.4f, 0.4f * 1.7 ...

  6. Codeforces gym102058 J. Rising Sun-简单的计算几何+二分 (2018-2019 XIX Open Cup, Grand Prix of Korea (Division 2))

    J. Rising Sun time limit per test 1.0 s memory limit per test 1024 MB input standard input output st ...

  7. opencv cv.line

    ''' 本次来学习基于opencv进行各种画图操作,以前只习惯用matplotlib,最近开始用opencv,觉得也很好用. cv.line(), cv.circle() , cv.rectangle ...

  8. CartO

    Carto documentation The following is a list of properties provided in CartoCSS that you can apply to ...

  9. RFC-TCP

    RFC: 793 TRANSMISSION CONTROL PROTOCOL DARPA INTERNET PROGRAM PROTOCOL SPECIFICATION September 1981 ...

随机推荐

  1. JS 实战1(添加、删除)

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs ...

  2. windows server 2008 r2 修改远程登入的端口号(3389)

    步骤:打开“开始→运行”,输入“regedit”,打开注册表,进入以下路径:[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal ...

  3. 【转】Ubuntu12.04安装YouCompleteMe插件

    原文网址:http://m.blog.csdn.net/blog/unhappypeople/19160243 以前用的都是ctags+omnicomplete+acp的方式,这次换成clang自解析 ...

  4. open_input_file函数调用结构图(转)

    open_input_file函数调用结构图(有些重复的函数调用就略掉了,大致是按流程往下的). 函数大致说明: AVFormatContext *avformat_alloc_context(voi ...

  5. Kafka问题排查(消费者自动关闭)

    问题描述:            在消费端能够正常消费到Kafka数据并成功生产到producer topic 中,当将kafka的一台机器关机之后,正常情况下应该是 消费端是不受影响的.因为有还有两 ...

  6. highlight.js 设置行号

    原文地址:highlight.js 设置行号 博客地址:http://www.extlight.com 一.背景 笔者在开发这套博客系统时使用 Editormd 作为 Markdown 编辑器,由于不 ...

  7. shred_linux_unix

    Sometimes you need to destroy or wipe data from hard drives (for example, before you sell your old h ...

  8. SSH&SFTP服务分离+家目录锁定

    Step 1 在root用户下创建维护账号的家目录,此处以创建userftp帐号的家目录为例. mkdir -p /chroot/home/user Step 2 在root用户根目录下执行以下命令设 ...

  9. 众安尊享e生·新全保通2017成人精选版60岁以后续保的保费清单

    尊享e生·新全保通2017成人精选版--有社保的费用 https://www.zhongan.com/p/83881372?channelEnName=health 61-65男性 13028女性 8 ...

  10. JQuery的筛选方法

    前面咱们学习到了jquery的选择器的筛选用法,那么咱们接下来学习一下jquery的常用筛选方法,一张图搞定一切.