- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
最佳答案
制作“UV”bmesh
给定上面带有 UV 的网格对象,根据 uv 制作一个 bmesh
uv.x, uv.y, 0
处向新的 bmesh 添加顶点测试脚本,以对象模式运行
import bpy
import bmesh
context = bpy.context
ob = context.object
me = ob.data
bm = bmesh.new()
bm.from_mesh(me)
uvbm = bmesh.new()
uv_layer = bm.loops.layers.uv.verify()
vert_index = uvbm.verts.layers.int.new("index")
face_index = uvbm.faces.layers.int.new("index")
# adjust uv coordinates
for face in bm.faces:
fverts = []
for loop in face.loops:
uv = loop[uv_layer].uv
v = uvbm.verts.new((uv.x, uv.y, 0))
v[vert_index] = loop.vert.index
fverts.append(v)
f = bmesh.ops.contextual_create(uvbm, geom=fverts)["faces"].pop()
f[face_index] = face.index
# remove doubles
bmesh.ops.remove_doubles(uvbm, verts=uvbm.verts, dist=1e-7)
'''
# ignore face indices of original if using any option here
# optionally disolve non boundary edges
bmesh.ops.dissolve_edges(uvbm,
edges=[e for e in uvbm.edges if not e.is_boundary],
)
# optionally remove faces
faces = uvbm.faces[:]
while faces:
uvbm.faces.remove(faces.pop())
'''
#make an object to see it
me = bpy.data.meshes.new("UVEdgeMesh")
uvbm.to_mesh(me)
ob = bpy.data.objects.new("UVEdgeMesh", me)
bpy.context.collection.objects.link(ob)
ob.show_wire = True
# make a LUT based on verts of original
from collections import defaultdict
edge_pairs = defaultdict(list)
boundary_edges = [e for e in uvbm.edges if e.is_boundary]
for e in boundary_edges:
key = tuple(sorted(v[vert_index] for v in e.verts))
edge_pairs[key].append(e)
# print result, add text object to show matching edges
# Make sure to remove code below before running on detailed UV as in question,
# adding that many text objects via operator
# will slow code down considerably.
uvbm.verts.ensure_lookup_table()
for key, edges in edge_pairs.items():
print(key, [e.index for e in edges])
for e in edges:
if not e.is_boundary:
continue
f = e.link_faces[0]
p = (e.verts[0].co + e.verts[1].co) / 2
p += (f.calc_center_median() - p) / 4
bpy.ops.object.text_add(radius=0.04, location=p)
bpy.context.object.data.body = f"{key}"
创建一个bmesh,这里转成mesh
“UV”bmesh 的 xy
坐标是 UV 坐标。唯一的边是 uv 边界边。使用数据转换为像素坐标。
使用此处的方法使用此处的方法将verts与original相关联https://blender.stackexchange.com/a/70729/15543将原始顶点/边缘的索引存储在“UV”bmesh 的数据层中。
上面示例的输出。第一行,由原始网格的顶点 0 和 1 构成的两条边是“UV”bmesh 中的边 0 和 14。
(0, 1) [0, 14]
(0, 2) [1, 17]
(2, 3) [2, 4]
(1, 3) [3, 22]
(2, 6) [5, 16]
(6, 7) [6, 8]
(3, 7) [7, 23]
(4, 6) [9, 19]
(4, 5) [10, 12]
(5, 7) [11, 20]
(0, 4) [13, 18]
(1, 5) [15, 21]
编辑:为了进一步可视化这一点,从每个边向每个面添加一个文本对象。例如,查看由顶点 (i, j) 构成的边在两个面上的匹配位置。每个文本对象都位于从边缘中心到面中心的四分之一处。
请记住,uvbmesh 在 UV 坐标中映射到 U 和 V 中的实数范围 [0, 1]。像素坐标只是将其映射到基于图像维度的离散整数范围。
关于python - 如何在 UV 贴图边缘获取数据并进行编辑?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60713817/
我有一串数字。我需要检查边缘上的数字是否对称,这意味着它们以 2 为模时具有相同的余数。 我已经编写了一个有效的代码,但我对此感到不安,在一些失败之后我想出了这个代码: int PaliPair(ch
我要删除黑色蒙版和人体图像之间的白色边框 图像输入示例: 厚度为1的图像输出: 厚度为2的图像输出: 我尝试了一些在这里找到的具有模糊和阈值的游戏 我还使用此代码查找和绘制轮廓 thickne
这应该是一个在用户悬停时打开的飞出菜单。 这在 Chrome 中工作得很好,我已经尝试了多种方法(使用 CSS :hover,(mousenter)和(mouseleave ) 问题是 - 使用 Ed
我有一个 Apache 服务器 v2.4.43 为我的网站提供服务,我使用一个简单的 .htpasswd,我使用指令“AuthUserFile ”在 .htaccess 中调用它来进行身份验证。 现在
如何仅使用剪辑路径创建波浪边缘? 波浪应该是这样的图像: 最佳答案 您应该通过波函数及其频率生成此剪辑路径。 我用过 cos()在 PHP 中。您可以找到如下链接: https://repl.it/@
我有这张图: digraph G { 1 [label="car"]; 2 [label="x"]; 3 [label="car"]; 4 [label="y"]; 5 [label="cdr"];
我想强制点仅显示节点之间的垂直或水平边缘。 我在帖子 Family tree layout with Dot/GraphViz 中发现了类似的请求,但我不处理树,所以我希望有一个解决方案,无需插入额外
我已经设法让两个直方图重叠,但如果你仔细观察,条形开始倾斜并且没有完全重叠。 我已经调整了线宽和宽度,并没有改善。 我的目标是让所有的条形排列在彼此的顶部,黑边没有歪斜。 有什么办法解决这个问题 这是
我已经设法让两个直方图重叠,但如果你仔细观察,条形开始倾斜并且没有完全重叠。 我已经调整了线宽和宽度,并没有改善。 我的目标是让所有的条形排列在彼此的顶部,黑边没有歪斜。 有什么办法解决这个问题 这是
我一直在与 latex table 搏斗太久了。我需要一个具有居中标题的表格,以及包含可能环绕的文本的正文单元格。由于环绕要求,我使用 p{xxx} 而不是 l 来指定单元格宽度。这导致的问题是单元格
有没有办法平滑转换(平移和旋转)的 BufferedImage 的锯齿状边缘? 测试图像的放大 View : (请注意,这不是将要使用的实际 BufferedImage,仅用于此处演示)。 已使用双线
我在 my page 有一个旋转木马.我的父元素和子元素的边缘都是 flex 的,但是当您按“下一个”或“上一个”并滑动旋转木马时,子元素在移动时不会保持 flex 。我怎样才能避免这种情况? .ho
我在 .boxwrap 和 .lsmlbox + .rsmlbox 之间的嵌套 div 中添加了不必要的空格,这使得无法将 .smlbox + .rsmlbox 与 .box 对齐我相信这是一个比预期
我正在使用 Apple 的 ARKit 制作 AR 应用程序,我想制作盒子的线框轮廓。代码中描述并显示在图片中的那个在盒子的每个面上绘制斜边。它还隐藏了盒子另一侧的角。 Scene Kit 中有没有办
下图仅包含阈值处理后的黑色和白色像素。我在此图像的顶部绘制了一个灰色的旋转矩形。现在我想计算这个旋转矩形内的黑色像素数,但不包括白色矩形矩形外的黑色像素(即白色矩形内的像素数)。 做到这一点的最佳方法
你们如何处理边际 CSS?我所说的边缘是指需要斜体或粗体的单个单词或短语。只用 声明一个“大胆”的类似乎很愚蠢 Bold { font-weight: bold; } 或者斜体,要么! Italic
好的。我知道有几十个类似的线程。我几乎检查了每一个,但找不到可行的解决方案。我试过负边距、最小高度、最大高度、绝对页脚、正文背景颜色,甚至将溢出:隐藏到页面中的所有主要容器。然后将 clearfix
我网站的一部分使用代码使用倾斜边缘: -webkit-clip-path: 多边形(0% 0%, 100% 0%, 81% 100%, 0% 100%) 这在 Chrome 中运行良好,但不适用于任何
我一直在创建这个网站,并且进展顺利。然后我试着给它添加一个模态,但一切都有点走下坡路。问题是在添加模式后,Chrome 中的图像对齐方式发生了变化。它在 Edge 中运行良好。现在我知道这可能是因为
如果我在 Matlab 中使用 image() 命令制作一个 4 x 4 像素的图像,它会将刻度线居中放置在像素的中间。我希望刻度线以像素的左下角为中心。有什么方法可以做到这一点吗? 最佳答案 您可以
我是一名优秀的程序员,十分优秀!