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. ACM学习历程—HDU2476 String painter(动态规划)

    http://acm.hdu.edu.cn/showproblem.php?pid=2476 题目大意是给定一个起始串和一个目标串,然后每次可以将某一段区间染成一种字符,问从起始串到目标串最少需要染多 ...

  2. 490 - Rotating Sentences

     Rotating Sentences  In ``Rotating Sentences,'' you are asked to rotate a series of input sentences ...

  3. ES6必知必会 (九)—— Module

    Module 1.ES6在语言标准的层面上,实现了模块功能,成为浏览器和服务器通用的模块解决方案,完全可以取代 CommonJS 和 AMD 规范,基本特点如下: 每一个模块只加载一次, 每一个JS只 ...

  4. Oracle单表去重复(一)

    去重有两层含义,一:是记录完全一样:二:是符合一定条件的认为是重复. 根据表的数量,去重可划分为:单表去重和多表关联去重.   对于去重,一般最容易想到的是用distinct,而distinct只能对 ...

  5. Java多线程编程核心技术,第二章,对象和变量并发访问

    1,方法内部变量是线程安全的 2,实例变量非线程安全 3,synchronized是锁对象不是锁方法(锁对象是可以访问非synchronized方法,不可访问同个和其他synchronized方法 4 ...

  6. bzoj 3924 [Zjoi2015]幻想乡战略游戏——动态点分治(暴力移动找重心)

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3924 度数只有20,所以从一个点暴力枚举其出边,就能知道往哪个方向走. 知道方向之后直接走到 ...

  7. C# 如何捕获一个USB设备发送到PC的数据

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...

  8. 走迷宫(用队列bfs并输出走的路径)

    #include <iostream> #include <stack> #include <string.h> #include <stdio.h> ...

  9. Bootstrap-CL:面板

    ylbtech-Bootstrap-CL:面板 1.返回顶部 1. Bootstrap 面板(Panels) 本章将讲解 Bootstrap 面板(Panels).面板组件用于把 DOM 组件插入到一 ...

  10. elasticsearch 官方入门 及 API

    https://www.elastic.co/guide/en/elasticsearch/reference/current/_basic_concepts.html 入门地址 ElasticSea ...