- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在 Windows 10 和 Qt 4.8.7 下使用 MathGL 2.3.5.1 ( http://mathgl.sourceforge.net/doc_en/Main.html )。
我在使用 MathGL 的 vector 场时遇到问题。下面有一个 MathGL 文档,文件名为 mathgl-2.3.5.eng.pdf https://sourceforge.net/projects/mathgl/files/mathgl/mathgl%202.3.5/„4.15 vector 场“部分描述了方法“Vect”的用法。当然,在“2.8 vector 场示例”一节中有一个 vector 场示例。
首先,我对 vector 场的理解是有点(在我的例子中它总是二维的)和(数学上的) vector 。所以点 P1(1,1) 和 vector V1(1,1) 的组合意味着箭头从点 P1(1,1) 开始到点 P2(2,2) 结束,这是简单的 vector 加法: P2 = P1 + V1.
现在回到 MathGL。我说的是这个方法:void Vect (const mglDataA &x, const mglDataA &y, const mglDataA &ax, const mglDataA &ay, const char *sch="", const char *opt="");
如果我正确理解参数那么
那么让我们从编码开始吧。
int sample(mglGraph *gr)
{
long cols=2;
long rows=2;
mglData x; x.Create(cols, rows);
x.a[0] = 1.0; x.a[1] = 0.0; x.a[2] = 0.0; x.a[3] = 0.0;
mglData y; y.Create(cols, rows);
y.a[0] = 1.0; y.a[1] = 0.0; y.a[2] = 0.0; y.a[3] = 0.0;
mglData ax; ax.Create(cols, rows);
ax.a[0] = 1.0; ax.a[1] = 0.0; ax.a[2] = 0.0; ax.a[3] = 0.0;
mglData ay; ay.Create(cols, rows);
ay.a[0] = 1.0; ay.a[1] = 0.0; ay.a[2] = 0.0; ay.a[3] = 0.0;
gr->Title("Vector field P1(1,1) V1(1,1)");
gr->SetRanges(0, 3, 0, 3);
gr->Vect(x, y, ax, ay, "<");
gr->Box();
gr->Axis();
gr->Grid("xy", "h:");
return 0;
}
首先,我不能为 x、y、ax 和 ay 创建“列 vector ”,意思是我不能写:
long cols=1;
long rows=2;
mglData x; x.Create(cols, rows); x.a[0] = 1.0; x.a[1] = 0.0;
mglData y; y.Create(cols, rows); y.a[0] = 1.0; y.a[1] = 0.0;
mglData ax; ax.Create(cols, rows); ax.a[0] = 1.0; ax.a[1] = 0.0;
mglData ay; ay.Create(cols, rows); ay.a[0] = 1.0; ay.a[1] = 0.0;
然后gr->Vect(x, y, ax, ay, "<");将此消息放在控制台:
MathGL message - Vect: data dimension(s) is too small
在这段代码中,我们设置了点 P1:x.a[0] = 1.0;和 y.a[0] = 1.0;. vector V1 应表示为:ax.a[0] = 1.0; ay.a[0] = 1.0;.
生成的图形显示一个箭头,从 P1(1,1) 开始但不在 P2(2,2) 结束。
谁能帮我解决这个问题?
问候,
托马斯
最佳答案
为了我的目的,我找到了解决方案。我手工绘制“vector ”。所以我只使用这段代码来绘制 vector :
mglGraph gr;
gr.Line(1,1, 2,2), "BA_"); // a vector from (1,1) to (2,2)
祝愿
托马斯
关于C++/数学GL : Missunderstanding of vector fields,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38952368/
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 5 年前。 Improve
我有一个 mysql 表,其中包含一个名为“id”、“name”和“number”的字段。 每一行的字段'number',都有一个数字。 id name number 1 test 30
我需要获得两个字段之间的最大和最小值。我将 JPA 2.1 与 EclipsLink 结合使用。 这是我的简化查询: SELECT GREATEST(c.min, mc.max), LEAST(c.m
我想知道是否可以询问具有相同字段名称的多个表,并且只写入一次询问的值。可能是为了避免裁员。 例如: SELECT * FROM table WHERE Table1.Status AND Ta
我想知道如何以负增量更新字段,但如果新值小于 1,则删除该行? 是否可以在 case 或 if/else block 中放置和更新语句? 目前我正在执行一个 select 语句来获取当前值,然后使用
嗨,我一直在寻找 secnhatouch 字段的 readOnly 属性,但没有找到它......有人可以帮助我解决这个问题吗 { xtype: 'textfield
SQL Server 2005 报告服务。 我想在报告文本框中使用以下内容: =IIF(IsNothing(Fields!Certification.Value), "", "Certs: "
考虑下表: un_id avl_id avl_date avl_status 1738 6377398 2011-03-10 unavailable 1738 6377399
鉴于集合将包含 50 多万份文档,每个文档都有最大数量的字段(如选项 a 所示)处理可能为空/稀疏的字段的最佳实践是什么? a)将每个具有相同字段和空字段的文档保存为 null 是否更好? { "
尝试开始使用 apioto http://apiato.io/A.getting-started/installation/ 如果我尝试测试 http://api.apiato.dev/registe
我在教程中找不到这两个指令之间的区别。 th:field="${something}"和 th:field="*{something}" 谁能告诉我一些例子? 最佳答案 Reference site
在 MongoDb 中 - 如果我的字段并不总是包含值 - 更好的做法是:在所有记录中保留相同的字段,即使有时这些字段为空或根本不创建这些字段? 10 倍! 最佳答案 字段会占用键的磁盘空间,即使没有
如何使用 factory-boy 定义依赖于其他字段的字段? 例如,我想定义一个 email这取决于 first name和 last name的 User . 我尝试使用 post_generati
嘿嘿, 我遇到了以下问题:我尝试阻止用户为“用户名”和“电子邮件”字段选择相同的值。我正在使用 jquery 表单验证插件 (http://bassistance.de/jquery-plugins/
在性能方面,哪个更适合使用? ...关于可读性/可理解性? ...关于公认的标准? SELECT * FROM Wherever WHERE Greeting IN ('hello', 'hi', '
我想知道使用 this 和 super 访问父类字段的区别。 我们有以下名为 ListItem 的抽象类,它扩展了 Node 类。 public abstract class ListItem {
假设 this 是一个指针,(2) 和 (3) 行如何在下面的 C++ 类中编译,所以应该需要 -> 符号来访问字段(如 (1) 行所示)? ( Source ) #include #include
我想更好地理解通过单独使用 this.field 和 field 来引用类字段有什么区别 this.integerField = 5; 和 integerField = 5; 最佳答案 this 关键
问题:我有一张库存表,还有一张列出正在拍卖的元素的表格。我想要一个别名字段(“isAuction”)来表示具有库存库存编号的项目是否存在于拍卖项目表中。 我写了以下查询: SELECT FROM in
如果我将包含多个字段的文档添加到 Elasticsearch 索引,当我在 Kibana 中查看它时,我每次都会得到相同的字段两次。其中之一将被称为 some_field 另一个将被调用 some_f
我是一名优秀的程序员,十分优秀!