tikz-函数计算pgfmathparse,pgfmathresult
来源:互联网 发布:linux 统计大文件行数 编辑:程序博客网 时间:2024/06/06 00:43
要点:
- 调用pgfmathparse命令进行函数计算,而用pgfmathresult取计算结果;
- 三角函数可以传入角度值,也可以传入弧度;
- 传入弧度时,数值后面空一格之后加个字母r。
示例:三种画直角三角形的代码
第一种:直接给出根号3的值1.732,但这种方法易读性不好;而且对于理想主义来讲,远不如直接传入根号3会让心情更加愉悦。
\begin{tikzpicture}[scale=1]\coordinate (A) at (0,0);\coordinate (B) at (1.732,0);\coordinate (C) at (1.732,1);\draw (A)node [below left]{A} --(B)node [below right]{B} --(C)node [above]{C} --cycle;\end{tikzpicture}
第二种:直接让tikz计算出根号3的值
\begin{tikzpicture}[scale=1]\pgfmathparse{sqrt(3)}\coordinate (A) at (0,0);\coordinate (B) at (\pgfmathresult,0);\coordinate (C) at (\pgfmathresult cm,1);\draw (A)node [below left]{A} --(B)node [below right]{B} --(C)node [above]{C} --cycle;\end{tikzpicture}
第三种:和第二种类似,不过这里在第二种介绍了sqrt()之后,顺便介绍三角函数的使用方法。进一步地,给出角度和弧度两种调用方式。
\begin{tikzpicture}[scale=1]\coordinate (A) at (0,0);\pgfmathparse{cos(30)}\coordinate (B) at (2*\pgfmathresult,0);\pgfmathparse{cos(pi/6 r)}\coordinate (C) at (2*\pgfmathresult, 1);\draw (A)node [below left]{A} --(B)node [below right]{B} --(C)node [above]{C} --cycle;\end{tikzpicture}
效果:
0 0
- tikz-函数计算pgfmathparse,pgfmathresult
- tikz的函数绘图示例
- PGF and TIkz里面自定义函数的例子
- Latex-tikz
- tikz-path
- tikz-椭圆
- tikz画拓扑图
- latex tikz使用总结
- tikz学习资料
- TikZ&PGF学习
- tikz-定义坐标点
- tikz-相对坐标
- tikz-坐标平移
- 如何让tikz跨页
- [latex tikz]画曲线
- Ubuntu 中 安装 tikz 2.10
- [latex]使用tikz的示例
- [latex]tikz绘制矩形坐标轴
- [从头读历史] 第259节 左传 [BC722至BC718]
- 获取NVIDIA显卡的温度
- 面向对象
- thinkphp3.2【跨控制器调用】
- 基于UDP协议的网络程序
- tikz-函数计算pgfmathparse,pgfmathresult
- LeetCode-350 Intersection of Two Arrays II
- H.264+pcm(实时转aac) 封装mp4 iOS,android,Linux 写文件,效率高.iOS支持写1080P.
- Python包的编写和使用
- 深入理解HTTP Session
- vector
- Codeforces Round #357 (Div. 2)
- 用Java语言编写简单聊天程序
- PHP面向对象所学部分