爱心曲线公式大全

local r = a*((math.sin(angle) * math.sqrt(math.abs(math.cos(angle)))) / (math.sin(angle) + 1.4142) - 2 * math.sin(angle) + 2)

local x = r * math.cos(angle) -- 计算对应的x值

local z = r * math.sin(angle) +1.5*a -

--曲线公式绘画

local function generateParabola()

local a = 10 -- 控制振幅(增加这个值会使波形更大)

local b = 0.9 -- 控制频率(增加这个值会使波形更密集)

local id = math.random(668, 681) -- 随机选择一个方块ID

local y = 8 -- 固定y坐标为8

local date = 0 -- 方块的时间戳

local step = 0.005 -- θ的步长,减小步长以增加分辨率

local maxR = 200 -- 设置r的最大值,即波形的最大半径

local blocksPerWait = 30 -- 每次等待前生成的方块数

local waitTime = 0.05 -- 每次生成后的等待时间

local theta = 0

local count = 0 -- 计数器,用于跟踪每次生成的方块数

-- 根据需要调整θ的遍历范围和步长

while true do

theta = theta + step

-- local r = a * math.sin(b * theta) -- 计算对应的r值

--local r = a * math.asin(math.tan(b * theta))

-- local r =a * math.cos(b * theta)+a * math.sin(b * theta)

--local r =a * math.cos(b * theta)*math.cos( theta)

-- local r =a * (math.sin(b * theta)*math.sin( theta))

-- local r =a * (math.cos(b * theta)*math.cos( theta))

--local r = a * math.sin(b * theta)

--local r = a * math.sin(b*theta) +b*math.sin(b*theta)

local angle=theta

local r = a*((math.sin(angle) * math.sqrt(math.abs(math.cos(angle)))) / (math.sin(angle) + 1.4142) - 2 * math.sin(angle) + 2)

if r > maxR then

break -- 如果r超过最大半径,则停止生成

end

local x = r * math.cos(theta) -- 计算对应的x值

local z = r * math.sin(theta) +1.5*a -- 计算对应的z值

-- 在计算出的位置放置方块

Block:setBlockAll(math.floor(x), y, math.floor(z), id, date)

count = count + 1 -- 增加计数器

-- 每生成10个方块后等待0.1秒

if count % blocksPerWait == 0 then

threadpool:wait(waitTime)

end

if math.floor(1000*angle) % 1256 == 0 then

id = math.random(668, 681) -- 随机选择一个方块ID

a=a+1

print(angle)

end

end

end

ScriptSupportEvent:registerEvent("Player.ClickBlock", generateParabola)

local r = a*((math.sin(angle) * math.sqrt(math.abs(math.cos(angle)))) / (math.sin(angle) + 1.4142) - 2 * math.sin(angle) + 2)

蝴蝶曲线公式

local r =a * (math.cos(b * theta)*math.cos( theta))

水平双球曲线公式

local r =a * math.cos(b * theta)*math.cos( theta)

反向双球曲线

local r =a * math.cos(b * theta)*math.sin( theta)

相关推荐
软件黑马王子1 小时前
Unity游戏制作中的C#基础(6)方法和类的知识点深度剖析
开发语言·游戏·unity·c#
liuyuzhongcc2 小时前
List 接口中的 sort 和 forEach 方法
java·数据结构·python·list
逻各斯3 小时前
redis中的Lua脚本,redis的事务机制
java·redis·lua
计算机小白一个4 小时前
蓝桥杯 Java B 组之背包问题、最长递增子序列(LIS)
java·数据结构·蓝桥杯
卑微的小鬼4 小时前
数据库使用B+树的原因
数据结构·b树
cookies_s_s4 小时前
Linux--进程(进程虚拟地址空间、页表、进程控制、实现简易shell)
linux·运维·服务器·数据结构·c++·算法·哈希算法
醉城夜风~6 小时前
[数据结构]双链表详解
数据结构
gyeolhada6 小时前
2025蓝桥杯JAVA编程题练习Day5
java·数据结构·算法·蓝桥杯
阿巴~阿巴~6 小时前
多源 BFS 算法详解:从原理到实现,高效解决多源最短路问题
开发语言·数据结构·c++·算法·宽度优先
刃神太酷啦8 小时前
堆和priority_queue
数据结构·c++·蓝桥杯c++组