样条插值曲线类型及其优缺点说明

2023-05-16

Spline Types

This page gives a breakdown of each spline type, how to use each one, and the advantages/disadvantages of each type.

Tl;dr

If you need the spline to pass through the input points, start with a Catmull-Rom Spline. If you don't, start with a Cubic B-Spline.

Simple Types

If you're not sure which one to use, start with these three.

Natural Spline

The Natural Spline computes the curvature for each point, using a formula that involves every point in the input, then interpolates the spline based on the list of points and the corresponding list of curvatures.

To use, import the appropriate header: #include "spline_library/natural/natural_spline.h"

Create a Natural Spline by passing a std::vector to the constructor, containing a list of points to interpolate through:std::shared_ptr<Spline> mySpline(new NaturalSpline(myPointList));

Advantages
  • Curvature is continuous (?)
Disadvantages
  • No local control (?)

Catmull-Rom Spline

A Catmull-Rom Spline computes the tangent for a point from the positions of the two closest points, then interpolates based on both the position and the tangent.

To use, import the appropriate header: #include "spline_library/hermite/cubic/cr_spline.h"

Create a catmull-rom spline by passing a std::vector to the constructor, containing a list of points to interpolate through:std::shared_ptr<Spline> mySpline(new CRSpline(myPointList));

Advantages
  • Local control (?)
Disadvantages
  • Curvature isn't continuous (?). For some use cases this isn't a problem, so I wouldn't worry about it unless you know you need it to be continuous.
  • There must be a nonzero distance between each adjacent set of points
  • Non-looping variation requires an "extra" point on either end of the data set which will not be interpolated

Cubic B-Spline

The B-Spline (Basis Spline) is very similar in concept to the Bezier Curve, and the cubic B-Spline is a specific type of B-Spline.

It is possible to create B-Splines with arbitrary powers (as opposed to enforcing cubic) but enforcing cubic allows for much simpler formulas and better performance.

To use, import the appropriate header: #include "spline_library/basis/cubic_b_spline.h"

Create a Cubic B-Spline by passing a std::vector to the constructor, containing a list of control points:std::shared_ptr<Spline> mySpline(new CubicBSpline(myPointList));

Advantages
  • Local control (?)
  • Curvature is continuous (?)
Disadvantages
  • The interpolated line does not necessarily pass through the specified points
  • Non-looping variation requires an "extra" point on either end of the data set which will not be interpolated

Advanced Types

If one of the simple types above doesn't meet your needs, the following types are also available. These spline types are more powerful, but also more difficult to use correctly, and/or carry important caveats that may not be immediately obvious.

Centripetal Catmull-Rom Spline

The Centripetal CR Spline is a variation of the Catmull-Rom Spline formula. Instead of spacing each point exactly one T apart, the distance in T between any two points will be proportional to the square root of distance between the two points. Thus, points that are very far apart will be further apart in T than points that are close together.

To use it, provide a value for the optional alpha parameter in the CRSpline constructor. A value of 0.5 will produce a centripetal Catmull-Rom Spline, while a value of 0.0 (default) will revert to the standard formula. Other values are allowed too - a value of 1.0 will result in a "chordal" variation, and the formula will work with any number, negative or positive. Values other than 0.0 or 0.5 should be very rare, however.

It has been proven mathematically that the centripetal variation avoids certain types of self-intersections, cusps, and overshoots, producing a more aesthetically pleasing spline.

Advantages (compared to CRSpline)
  • Proven to avoid self-intersections and overshoots when there are large variations in distance between adjacent points.
Disadvantages (compared to CRSpline)
  • Modifies T values of points - points that are close together will have a smaller T distance and vice versa. This may be a problem if the points are keyframes for an animation, for example, or any other data series where the T values have some external meaning

Cubic Hermite Spline

The Cubic Hermite Spline takes a list of points, and a corresponding list of tangents for each point. The Catmull-Rom Spline is a subclass of the Cubic Hermite Spline which automatically computes the tangents, rather than expecting the user to supply them.

An example use case for this spline type is for physical simulation time series data, where spline->getPosition(t) returns the object's position at time T. If you know the object's velocity in addition to its position, you can make the interpolation more accurate by providing that velocity as the tangent.

To use, import the appropriate header: #include "spline_library/hermite/cubic/cubic_hermite_spline.h"

Create a Cubic Hermite Spline by passing two equal-length std::vector to the constructor, one containing a list of points to interpolate through, and the other containing the corresponding tangent for each point: std::shared_ptr<Spline> mySpline(new CubicHermiteSpline(myPointList, myTangentList));

Advantages
  • Local control (?)
  • Easily control the tangent at each point
Disadvantages
  • Curvature isn't continuous (?). For some use cases this isn't a problem, so I wouldn't worry about it unless you know you need it to be continuous.
  • You cannot create a spline where there is zero distance between two adjacent points
  • Cannot be used if you don't know the desired tangent for each point

Quintic Hermite Spline

The Quintic Hermite Spline takes a list of points, a corresponding list of tangents for each point, and a corresponding list of curvatures for each point.

An example use case for this spline type is for physical simulation time series data, where spline->getPosition(t) returns the object's position at time T. If you know the object's acceleration in addition to its velocity and position, you can make the interpolation more accurate by providing that acceleration for the curvature.

To use, import the appropriate header: #include "spline_library/hermite/quintic/quintic_hermite_spline.h"

Create a Quintic Hermite Spline by passing three equal-length std::vector to the constructor, one containing a list of points to interpolate through, another containing the corresponding tangent for each point, and a third containing the corresponding curvature for each point: std::shared_ptr<Spline> mySpline(new QuinticHermiteSpline(myPointList, myTangentList, myCurvatureList));

Advantages
  • Local control (?)
  • Easily control the tangent and curvature at each point
  • Curvature is continuous (?)
Disadvantages
  • You cannot create a spline where there is zero distance between two adjacent points
  • Cannot be used if you don't know the desired tangent and curvature for each point
  • More computationally intensive than the cubic version

  • More "wiggly" than the cubic version. This sounds vague, but it's actually quantifiable: For the cubic version, the derivative of curvature is constant, but for the quintic version, the derivative of curvature is a quadractic function.
本文转自:
https://github.com/ejmahler/SplineLibrary/blob/master/docs/SplineTypes.md,代码也在这里哦

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

样条插值曲线类型及其优缺点说明 的相关文章

  • Eclipse中查看没有源码的Class文件的方法

    本文地址 http blog csdn net sushengmiyan article details 18798473 本文作者 sushengmiyan 我们在使用Eclipse的时候 xff0c 经常是会使用别人的Jar包 xff0
  • [ExtJS5学习笔记]第二节 Sencha Cmd 学习笔记 使你的sencha cmd跑起来

    本文地址 xff1a http blog csdn net sushengmiyan article details 38313537 本文作者 xff1a sushengmiyan 资源链接 翻译来源 Sencha Cmd官方网站 xff
  • 【Java二十周年】Delphi转行java的一些小感触

    本文纯属一届小码农对java使用过程的体验感触 目录 xff1a 初遇java编程语言与java的擦肩深入java 跨平台性开源支持web的支撑 初遇java编程语言 刚上大学的时候 xff0c 完全是个电脑盲 刚入学学的计算机普及知识就是
  • Vmware-虚拟中的linux如何增加硬盘(转)

    启动虚拟机软件VMware后 xff0c 点机VM菜单选择Setting xff0c 然后在弹出地菜单中选择 xff1a Add命令进行添加硬盘操作 完成后启动虚拟机 1 建立分区 fdisk l查看磁盘分区情况 此时你会发现多了一个 de
  • 给大家安利一个学习angular2的视频网站

    本文地址 xff1a http blog csdn net sushengmiyan 本文作者 xff1a 苏生米沿 视频地址 xff1a https egghead io courses angular 2 fundamentals 网站
  • 记一个万金油开源框架JHipster

    本文地址 xff1a http blog csdn net sushengmiyan article details 53190236 百搭代码生成框架 体验新技术汇总 xff1a Spring BootSpring SecurityAng
  • SQLServer触发器创建、删除、修改、查看...适用于级联删除

    一 触发器是一种特殊的存储过程 它不能被显式地调用 而是在往表中插入记录 更新记录或者删除记录时被自动地激活 所以触发器可以用来实现对表实施复杂的完整性约束 二 SQL Server为每个触发器都创建了两个专用表 Inserted表和Del
  • 工薪族巧理财之定期存款中整存整取、零存整取、存本取息之间的微妙区别

    银行的官方术语先给大家普及一下 xff1a 定期存款是在存款时约定存储时间 一次或按期分次 在约定存期 存入本金 xff0c 整笔或分期平均支取本金利息的一种储蓄 按存取方式定期存款分为整存整取定期存款 零存整取定期存款 存本取息定期存款
  • no module named win32com.client错误解决

    无论什么时候 xff0c 你在运行的时候发现有importError no module named win32com client这个提示 你都可以这么解决 xff1a 请下载http sourceforge net projects p
  • java.util.concurrent同步框架(AQS论文中文翻译)

    java util concurrent同步框架 摘要目录和主题描述一般条款关键字1 介绍 xff1a 需求设计实现4 使用方式5 性能6 结论7 致谢 Doug Lea SUNY Oswego Oswego NY 13126 dl 64
  • POJ2287 田忌赛马---贪心算法

    田忌赛马 题目详见http poj org problem id 61 2287 田忌赛马大家都听过 xff0c 可是如果不是上中下三等马 xff0c 而是很多匹马 xff0c 优劣有很多种分类 xff0c 就不仅仅是321的问题了 这个很
  • 贪心算法详解

    之前讲过动态规划DP xff0c 现在来说说贪心 贪心算法在解决问题的策略上目光短浅 xff0c 只根据当前已有的信息就做出选择 xff0c 而且一旦做出了选择 xff0c 不管将来有什么结果 xff0c 这个选择都不会改变 也就是说贪心对
  • 搜索智能提示suggestion,附近点搜索

    第三十六 三十七章 搜索智能提示suggestion xff0c 附近地点搜索 作者 xff1a July 致谢 xff1a caopengcs 胡果果 时间 xff1a 二零一三年九月七日 题记 写博的近三年 xff0c 整理了太多太多的
  • 多重继承及虚继承中对象内存的分布

    多重继承及虚继承中对象内存的分布 这篇文章主要讲解G 43 43 编译器中虚继承的对象内存分布问题 xff0c 从中也引出了dynamic cast和static cast本质区别 虚函数表的格式等一些大部分C 43 43 程序员都似是而非
  • Linux日志服务器配置

    配置日志服务器 环境 xff1a tibet xff1a 10 11 3 57 gaplinux xff08 日志服务器 xff09 xff1a 10 11 3 3 修改tibet上的 etc hosts xff0c 增加如下代码 xff1
  • 【Google】25匹马的角逐

    问题是这样的 xff1a 一共有25匹马 xff0c 有一个赛场 xff0c 赛场有5个赛道 xff0c 就是说最多同时可以有5匹马一起比赛 假设每匹马都跑的很稳定 xff0c 不用任何其他工具 xff0c 只通过马与马之间的比赛 xff0
  • HDOJ 1058 Humble Numbers解题报告【DP】

    Humble Numbers 题目详见http acm hdu edu cn showproblem php pid 61 1058 开始拿到这个题目的时候还纠结了半天 xff0c 英语很差的话这个题是不可能AC的 而我就是其中之一 Hum
  • 背包问题详解

    背包问题 背包问题 Knapsack problem 是一种组合优化的NP完全问题 问题可以描述为 xff1a 给定一组物品 xff0c 每种物品都有自己的体积和价值 xff0c 在限定的总体积内 xff0c 我们如何选择 xff0c 才能

随机推荐

  • 楼教主男人必解八题之 Coins 解题报告

    楼教主男人必解八题之 Coins 解题报告 题目详见http acm hdu edu cn showproblem php pid 61 2844 这个题目和POJ1742是一个题目 xff0c 也是楼教主的男人八题之一 说的是给出N种硬币
  • 如何证明程序的正确性?

    什么样的程序才是正确的 xff1f 如何来保证程序是正确的 xff1f 测试 xff1f NO xff01 采用测试方法确实可以发现程序中的错误 xff0c 但却不能保证和证明程序中没有错误 xff01 先来看一些概念 xff0c 有关 程
  • 平摊分析

    平摊分析 我们经常在处理数据结构的时间复杂度的时候 xff0c 大多数操作代价很低 xff0c 可是由于某些个别操作的代价较高 xff0c 导致最后求得时间复杂度的上界不是那么的紧凑 在平摊分析中 xff0c 执行一系列数据结构操作所需要的
  • intel realsense t265+rtabmap实现地形扫描(效果欠佳)

    1 intel realsense t265驱动安装 https blog csdn net crp997576280 article details 109544456 2 Rtabmap 安装 https blog csdn net z
  • Windows10下RTABMAP+T265实现三维建图

    安装Rtabmap xff1a Installation introlab rtabmap Wiki github com 文件为RTABMap 0 20 16 win64 cuda11 1 exe 安装intel realsense t2
  • 树莓派3B+(以及老版本)内网穿透 frp 后外网ssh或者vrc server连接

    1 服务器配置 xff0c 服务器选择Debian 或者 CentOS 开一个服务器 然后用ssh连上 xff0c ssh可以用本地xshell或putty连接 也可以用网页版ssh连接 先进入管理员模式 xff0c 免得后面一直sudo
  • 在雪豹10.6.2(Mac OS X)上安装Oracle10g

    1 Install preparation 基本环境 xff1a Snow Leopard10 6 2 xff0c Oracle10 2 0 4 打开Mac的终端 xff0c 执行 xff1a sudo i 创建oinstall组和orac
  • 一个开源AC算法源码分析

    ps1 本文不讲AC算法的原理及数学证明 xff0c 具体请参考这篇文章 xff1a efficient string matching an aid to bibliographic search pdf ps2 源码主页 xff1a m
  • 手写RTOS(课程回顾)

    什么是程序 X86 X86在调用函数的时候传递在参数是从栈中取出的 xff0c 需要哪些参数提前按一定顺序入栈即可 第一个出栈的就对应第一个参数 xff0c 依次类推 函数返回值存在eax中 ARM arm函数调用参数传递顺序是从r0 r3
  • 树莓派 raspberry系统 VNC View 连接 Cannot currently show the desktop 错误解决

    https www raspberrypi org forums viewtopic php t 61 216737 我是因为空间不够
  • 进程、线程以及上下文切换概念详解

    目录 1 线程和进程的概念 2 进程间的通信方式有哪些 xff1f 3 线程的同步和互斥操作 4 在Java中线程是如何实现同步和互斥的 xff1f 4 什么是线程的上下文切换 xff1f 5 什么是用户模式和内核模式 xff1f 1 线程
  • 【计算机网络】(五)拨号上网与宽带上网PPP,PPPoE,ADSL,FTTH(GPON)

    可见链接 https www zhihu com question 48988005 它们都是个人用户接入Ethernet的协议 小学的时候家里就是拨号上网的 xff0c 每次有人打电话到家里网就会断掉 xff0c 游戏就掉线 xff0c
  • 旧版本PX4固件编译报错:error: converting a packed ‘flash_entry_header_t‘ {aka ‘struct flash_entry_header_t‘}..

    文章目录 前言一 解决办法1二 解决办法2三 总结 前言 旧版本PX4 Autopilot固件编译报错 xff0c 报错内容如下 xff1a src lib parameters flashparams flashfs c 190 2 er
  • SNMP测试

    SNMP测试 测试环境 xff1a Solaris10 10 10 128 89 Linux xff1a 10 10 151 8 windows 测试方案 xff1a 1 本地测试 2 远程测试 配置文件 xff1a 修改环境变量 在sol
  • apex编译错误解决方案

    这里写自定义目录标题 apex编译错误解决方案 csrc mlp cpp 123 3 note in expansion of macro AT DISPATCH FLOATING TYPES AND HALF AT DISPATCH FL
  • Javaweb项目实践MVC入门到精通

    Javaweb项目实践MVC入门到精通 目标配置环境实体模型 user Dao的实现实体模型 ModelViewController xff1a 转发任务 xff0c 路由器的功能安全sql注入常见问题 目标 这个目标是写一个MVC模型 通
  • C++ 铪铪铪铪 烫烫烫 屯屯屯

    VS中 xff0c Debug模式下 xff0c 对于未初始化的内存 xff1a 1 xff09 若为栈内存 xff0c 默认为一连串 烫烫烫 xff0c 0xcc 2 xff09 若为堆内存 xff0c 默认为一连串 屯屯屯 xff0c
  • 创新的力量

    创新是个非常好的词 xff0c 虽然这个词已经被用滥了 xff0c 但我依然固执的认为这是一个充满了迷人光辉的词汇 如果把创新放入科技领域 xff0c 这应该是我在科技领域最喜欢的一个词了 我常常对同事或团队的成员说 xff0c 我们在做产
  • 魔方矩阵

    看到魔方矩阵 xff0c 好奇 xff0c 好玩儿 xff0c 正好赶上周五 xff0c 就来放松一下 xff0c 总结一下几种魔方矩阵的规律 xff0c 并写一下C 43 43 实现过程 定义 xff1a 平面魔方的一般定义 xff1a
  • 样条插值曲线类型及其优缺点说明

    Spline Types This page gives a breakdown of each spline type how to use each one and the advantages disadvantages of eac