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

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(使用前将#替换为@)

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

  • 深入浅出 HTTP协议

    好记忆不如烂笔头 xff0c 能记下点东西 xff0c 就记下点 xff0c 有时间拿出来看看 xff0c 也会发觉不一样的感受 目录 过程解说 体系介绍 域名解析 请求过程 问题解答 过程解说 先说下简要过程 xff0c 基本过程是如下所
  • linux,Windows11双系统安装及开机引导

    文章目录 前言系统安装UbuntuWindows 11 利用grub设置开机引导1 设置Ubuntu为默认启动系统2 设置开机引导grub3 找到Windows启动引导文件bootmgfw efi4 向grub cfg中添加menuentr
  • Docker常用命令,脚本在线或者离线安装Docker

    目录 常用命令停止容器 Docker镜像打包到另一台服务器 xff08 压缩包 xff09 Docker镜像打包到另一台服务器 xff08 使用Docker Hub xff09 Docker在线和离线安装卸载Docker 常用命令 span
  • docker镜像使用基础命令

    列出镜像列表 docker images REPOSITORY xff1a 表示镜像的仓库源 TAG xff1a 镜像的标签 用冒号分隔 版本标签 如果不指定就默认为latest IMAGE ID xff1a 镜像ID CREATED xf
  • 如何快速搜索文件和文件内容

    苏生不惑第144 篇原创文章 xff0c 将本公众号设为星标 xff0c 第一时间看最新文章 平常搜索文件一般会直接这样搜 xff0c 不过如果文件太多的话会很慢 xff0c 而且没法搜索文件内容 这里分享几个好用的文件搜索工具 Every
  • python3中替换python2中cmp函数的新函数分析(lt、le、eq、ne、ge、gt)

    本文地址 xff1a http blog csdn net sushengmiyan article details 11332589 作者 xff1a sushengmiyan 在python2中我们经常会使用cmp函数来比较一些东西 x
  • 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 完全是个电脑盲 刚入学学的计算机普及知识就是
  • 给大家安利一个学习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 整笔或分期平均支取本金利息的一种储蓄 按存取方式定期存款分为整存整取定期存款 零存整取定期存款 存本取息定期存款
  • CentOS防火墙相关命令

    目录 1 开放端口2 查看防火墙所有开放的端口3 关闭防火墙4 查看防火墙状态5 查看监听的端口6 检查端口被哪个进程占用7 查看进程的详细信息 1 开放端口 firewall cmd zone span class token opera
  • 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 程序员都似是而非
  • 【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种硬币
  • CentOS7安装MySQL5.7过程以及常用需要修改操作,安装mysqlclient,安装mysql-devel报错问题以及卸载MySQL

    目录 Docker安装运行命令mysql配置 Centos安装下载安装启动修改root用户密码修改远程访问权限1 改表法2 授权法 MySQL密码验证mysqlclient时候报错 OSError mysql config not foun
  • 如何证明程序的正确性?

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

    平摊分析 我们经常在处理数据结构的时间复杂度的时候 xff0c 大多数操作代价很低 xff0c 可是由于某些个别操作的代价较高 xff0c 导致最后求得时间复杂度的上界不是那么的紧凑 在平摊分析中 xff0c 执行一系列数据结构操作所需要的
  • java中用FTPClient,执行到ftp.storeFile(fileName, inputFile);无反应

    package com aa test import cn hutool core util StrUtil import com nuctech platform tip constant TipConstant import lombo
  • SpringMVC拦截去之HandlerInterceptorAdapter的使用

    定义 HandlerInterceptorAdapter是SpringMVC中的拦截器 xff0c 它是用于拦截URL请求的 xff0c 主要是为了请求的预处理和后续处理 使用方法 编写代码 我们只需要自定义一个拦截器去继承HandlerI
  • EKF之雅克比矩阵(一)

    扩展卡尔曼滤波 EKF EKF之雅克比矩阵 文章目录 扩展卡尔曼滤波 EKF 前言一 什么是线性化 xff1f 二 雅克比矩阵1 矩阵的几何含义2 非线性矩阵与基底的关系3 雅克比矩阵 三 工程中雅克比矩阵如何应用总结 前言 一般的卡尔曼滤
  • Java数据结构与算法-程序员十大常用算法[day13]

    程序员十大常用算法 文章目录 程序员十大常用算法二分查找算法 非递归 分治算法分治算法最佳实践 汉诺塔 动态规划算法KMP算法KMP算法简介KMP实现 贪心算法普利姆算法克鲁斯卡尔算法分析克鲁斯卡尔算法分析 迪杰斯特拉算法弗洛伊德算法回溯算
  • 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
  • git常用操作命令

    目录 git删除push到远程服务器的commit用户名和邮箱撤销add操作commit message写错了删除已经上传的文件添加文件追踪 git删除push到远程服务器的commit span class token comment 会
  • 魔方矩阵

    看到魔方矩阵 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