标签: expansion

使用 Clipper 库 - Angus Johnson => 无法运行代码片段

我正在尝试使用 Clipper 库来扩展我的避障机器人控制任务中的障碍物图像。但是现在,我什至坚持使用库的示例代码:

(http://www.angusj.com/delphi/clipper.php#code)

包括“clipper.hpp”

//from clipper.hpp ...
//typedef signed long long long64;
//struct IntPoint {long64 X; long64 Y;};
//typedef std::vector<IntPoint> Polygon;
//typedef std::vector<Polygon> Polygons;
...
using namespace ClipperLib;

Polygons subj(2), clip(1), solution;

subj[0].push_back(IntPoint(180,200));
subj[0].push_back(IntPoint(260,200));
subj[0].push_back(IntPoint(260,150));
subj[0].push_back(IntPoint(180,150));

subj[1].push_back(IntPoint(215,160));
subj[1].push_back(IntPoint(230,190));
subj[1].push_back(IntPoint(200,190));

clip[0].push_back(IntPoint(190,210));
clip[0].push_back(IntPoint(240,210));
clip[0].push_back(IntPoint(240,130));
clip[0].push_back(IntPoint(190,130));

DrawPolygons(subj, 0x160000FF, 0x600000FF);  // <- identifier not found
DrawPolygons(clip, 0x20FFFF00, 0x30FF0000);  // <- identifier not found

Clipper c;
c.AddPolygons(subject, ptSubject);
c.AddPolygons(clip, ptClip);
if (c.Execute(ctIntersection, solution)
  DrawPolygons(solution, 0x3000FF00, 0xFF006600);
Run Code Online (Sandbox Code Playgroud)

我想知道我是否缺少任何库安装?我知道这是一个小问题,我有点菜鸟,但任何帮助都可以减轻我的很多工作。谢谢!

polygon expansion

1
推荐指数
1
解决办法
1789
查看次数

提高机器精度是否会自动提高系列扩展的条件?

我想知道在C中将机器精度从浮点数增加到两倍会自动提高串联扩展中的项,例如三角函数吗?

这和我关于堆栈溢出的其他问题与调查各向异性介质中波动方程的数值不稳定性有关.

c floating-point precision series expansion

1
推荐指数
1
解决办法
109
查看次数

在tcsh中扩展别名

看起来像是在bash中alias-expand-line

我可以添加到.cshrc_custom文件中的bindkey命令是什么?

相关排序:"^[y"按键绑定指的是什么?我知道^ctrl什么,但是是什么[

alias tcsh expansion

1
推荐指数
1
解决办法
1128
查看次数

1
推荐指数
1
解决办法
121
查看次数

Common Lisp宏:正确扩展生成的列表

我正在构建一个机制来获取任意CLOS对象并从中返回一个哈希(在我的调试经验中很有用).

但是,我不确定如何强制进行变量扩展.我觉得解决方案在于正确使用gensym,但我不确定如何.

;;helper macro
(defun class-slots-symbols (class-name)
  "Returns a list of the symbols used in the class slots"
  (mapcar 'closer-mop:slot-definition-name
      (closer-mop:class-slots
       (find-class class-name))))

;;macro that I am having difficulty with
(defmacro obj-to-hash (obj-inst)
  "Reads an object, reflects over its slots, and returns a hash table of them"
  `(let ((new-hash (make-hash-table))
    (slot-list (class-slots-symbols (type-of ,obj-inst))))

    ;;The slot-list needs to expand out correctly in the with-slots form
    (with-slots (slot-list) obj-inst
       (loop for slot in slot-list do   ;and also here
        (format t "~a~&" …
Run Code Online (Sandbox Code Playgroud)

macros common-lisp expansion

0
推荐指数
1
解决办法
621
查看次数

rm -f不会处理bash脚本中的所有参数

在bash中有一个特殊的问题.我想创建一个脚本,该脚本采用文件名的前缀,并删除以该前缀开头并以某些给定后缀结尾的所有文件.为此,我有以下代码行:

#!/bin/bash

if [ $# -lt 1 ]; then
        echo "Please provide an argument";
        exit 1
fi

# Ending dot already included in $1
rm -f $1"aux" $1"bbl" $1"blg" $1"synctex.gz" $1"log"

# But even if you call it wrong...
rm -f $1".aux" $1".bbl" $1".blg" $1".synctex.gz" $1 ".log"

exit 0
Run Code Online (Sandbox Code Playgroud)

不幸的是,当我调用我的脚本(被称为cleanlatex)时,按预期方式:

cmd$ cleanlatex lpa_aaai.
Run Code Online (Sandbox Code Playgroud)

只删除.aux文件.显然rm -f不会将其应用程序扩展到所有参数,这是我明确运行时所做的事情rm -f lpa_aaai.aux lpa_aaai.bbl ....我在这做错了什么?

编辑:要回答@ Etan的问题,这是我在添加这些命令时看到的内容:

+ '[' 1 -lt 1 ']'
+ rm -v lpa_aaai.aux lpa_aaai.bbl lpa_aaai.blg lpa_aaai.synctex.gz …
Run Code Online (Sandbox Code Playgroud)

bash rm expansion

0
推荐指数
1
解决办法
88
查看次数

Bash、Fish:防止变量扩展

我计划改用 Fish 作为我的默认 shell,但遇到了一些问题。
在重写我的所有脚本之前,我想使用带有“-c”选项的 bash 重用旧脚本。
例子:

bash -c "cat <<'EOF' | tee filename >/dev/null
$SHELL
$TERM
EOF"
Run Code Online (Sandbox Code Playgroud)

即使使用'EOF',我总是得到:
/bin/fish
xterm

如果可能的话,我想避免\$SHELL在脚本中的每个变量中使用反斜杠。

variables shell expansion fish

0
推荐指数
1
解决办法
93
查看次数