首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏javascript趣味编程

    ammo.js-bullet物理引擎碰撞检测

    [face.a].x, vertices[face.a].y, vertices[face.a].z), new Ammo.btVector3(vertices[face.b ].x, vertices[face.b].y, vertices[face.b].z), new Ammo.btVector3(vertices[face.c].x, face.a].x, vertices[face.a].y, vertices[face.a].z), new Ammo.btVector3(vertices[face.b ].x, vertices[face.b].y, vertices[face.b].z), new Ammo.btVector3(vertices[face.d].x, (vertices[face.d].x, vertices[face.d].y, vertices[face.d].z), false );

    4.5K20发布于 2020-08-18
  • 来自专栏R语言及实用科研软件

    🤩 Dendrogram | 今天是人见人爱、花见花开的环形Dendrogram!~(附完整代码)

    vertices$group <- edges$from[match(vertices$name, edges$to)] DT::datatable(vertices) 5添加labels信息 5.1 计算labels的角度 vertices$id <- NA myleaves <- which(is.na( match(vertices$name, edges$from) )) nleaves < - length(myleaves) vertices$id[ myleaves ] <- seq(1:nleaves) vertices$angle <- 90 - 360 * vertices$ id / nleaves DT::datatable(vertices) ---- 5.2 计算labels的对齐方式 vertices$hjust<-ifelse(vertices$angle vertices$angle<-ifelse(vertices$angle < -90, vertices$angle+180, vertices$angle) DT::datatable(vertices

    41020编辑于 2023-09-04
  • 来自专栏Android知识点总结

    Android多媒体之GLES2战记第六集--九层之台

    vertices[3 * v + 6] = x;//顶部p1 vertices[3 * v + 7] = h;//y vertices[3 * v + 8] = z; //z vertices[3 * v + 9] = x;//底部p0 vertices[3 * v + 10] = 0; vertices[3 * vertices[3 * v + 14] = zNext;//z vertices[3 * v + 15] = xNext;//顶部p2 vertices[3 * v vertices[3] = 0;//p1 vertices[4] = y; vertices[5] = 0; vertices[6] = x;//p3 vertices[7] = 0; vertices[8] = z; vertices[9] = x;//p2 vertices[10]

    60540发布于 2019-04-22
  • 来自专栏全栈程序员必看

    Louvain算法_算法问题

    = line.strip().split() v_i = int(vertices[0]) v_j = int(vertices[1]) _cid_vertices.items(): if len(vertices1) == 0: continue for cid2 , vertices2 in self. _cid_vertices = cid_vertices self._vid_vertex = vid_vertex self. _cid_vertices.values(): if len(vertices) !

    79020编辑于 2022-11-17
  • 来自专栏编程理解

    数据结构(十):最小生成树

    判断两个顶点是否属于同一个子图,避免添加边后形成环 def origin(vertices, index): while vertices[index] ! 使用 heapSort 堆排序对每个顶点到子图的距离进行排序,即对 vertices 列表进行排序,使用堆排序内的 transformToHeap 函数调整 vertices 列表为小顶堆。 在 vertices 列表中的位置, ? 顶点元素即为 vertices[verticesIndex[v]]。 交换堆顶元素 def swapVertices(vertices, verticesIndex, origin, target): vertices[origin], vertices[target ] = vertices[target], vertices[origin] verticesIndex[vertices[origin]['index']], verticesIndex[vertices

    1K30发布于 2018-12-06
  • 来自专栏编程理解

    数据结构(十二):最短路径(Dijkstra算法)

    '] = 0 heapSort(vertices, verticesIndex) while len(vertices) > 0: swapVertices(vertices , 0, len(vertices)) updateDistance(graph, vertices, verticesIndex, vertex) 这里使用 vertices 列表存储每个顶点元素 算法中使用 verticesIndex 列表存储每个顶点元素在 vertices 列表中的下标位置。使用 heapSort 堆排序对每个顶点到起点的距离进行排序,即对 vertices 列表进行排序。 交换列表首尾元素 def swapVertices(vertices, verticesIndex, origin, target): vertices[origin], vertices[target ] = vertices[target], vertices[origin] verticesIndex[vertices[origin]['index']], verticesIndex[vertices

    2K20发布于 2018-12-13
  • 来自专栏全栈程序员必看

    Johnson算法「建议收藏」

    [i].firstarc = NULL; vertices[i].key = INT_MAX/2; vertices[i].p = NULL; vertices[i].indegree = [i].key = INT_MAX>>2; vertices[i].p = NULL; } vertices[index].key = 0; } //对边(u, v)进行松弛,将目前 if (vertices[arc->adjvex].key > vertices[arc->source].key + arc->weight) { vertices[arc->adjvex]. key = vertices[arc->source].key + arc->weight; vertices[arc->adjvex].p = &vertices[arc->source]; [i].data << " 到目的结点 " << vertices[j].data << " 的最短路径是:" /*<< endl*/; __printPath(&vertices[i], &vertices

    96630编辑于 2022-11-03
  • 来自专栏全栈开发那些事

    图的连通分量个数

    ); for (i = 0; i < G.Vertices.size; i++) { visited[i] = 0; } for (i = 0; i < G.Vertices.size; i+ , G->Vertices.size, vertex);//在顺序表尾部插入 } /* 插入边 在有向图中插入一条有向边。 || v2 < 0 || v2 >= G->Vertices.size) { printf("参数v1或v2越界出错! ); for (i = 0; i < G.Vertices.size; i++) { visited[i] = 0; } for (i = 0; i < G.Vertices.size; i+ < g1.Vertices.size; i++) { for (j = 0; j < g1.Vertices.size; j++) { printf("%5d ", g1.edge[i][

    1K30编辑于 2023-02-27
  • 来自专栏WebJ2EE

    【Nebula Graph】:数据模型

    (图空间(Graph space)类似 Oracle 中的 User、MySql 中的 Database,图空间之间的数据相互隔离) Vertices: Vertices are used to store Edges: Edges are used to connect vertices. An edge is a connection or behavior between two vertices. (边,用于连接两个顶点) There can be multiple edges between two vertices. Both vertices and edges are containers for properties.

    78710发布于 2021-10-27
  • [python][pcl]python-pcl案例之crophull

    table_scene_mug_stereo_textured.pcd') print(datacloud) filterCloud = pcl.PointCloud() vt = pcl.Vertices * 0.3, 0] ], dtype=np.float32) filterCloud.from_array(points_2) print(filterCloud) vertices_point _1 = np.array([1, 2, 3, 4, 5], dtype=np.int) vt.from_array(vertices_point_1) # print(vt) # vt.vertices.push_back(1) # vt.vertices.push_back(2) # vt.vertices.push_back(3) # vt.vertices.push_back (4) # vt.vertices.push_back(5) # vertices = vector[pcl.Vertices] # vertices.push_back(vt)

    12900编辑于 2025-07-19
  • 来自专栏技术分享

    图的基本操作

    还可以为图添加权重变量, 从未得到有权图[Weighted Graph] 图的常用术语 图是由节点(vertices)和边(edges)组成的一种数据结构,常用术语包括: 有向图(Directed Graph ; /** * 构造器,对邻接矩阵进行初始化 * @param edges edges 元素代表顶点索引,即对应 vertices 元素索引 * @param Vertices 传入的顶点列表 */ public GraphAdjMat(int[][] edges , int[] Vertices){ //1. 对顶点列表进行赋值,同时扩展矩阵 for (int i : Vertices){ addAdjMat(i); } //3. //还是需要考虑数组下标越界情况 if(m < 0 || n < 0 || m > vertices.size() || n > vertices.size() || m == n){

    50610编辑于 2024-05-30
  • 来自专栏ACM算法日常

    Binary Tree Traversals(二叉树) - HDU 1710

    In a preorder traversal of the vertices of T, we visit the root r followed by visiting the vertices of T1 in preorder, then the vertices of T2 in preorder. In an inorder traversal of the vertices of T, we visit the vertices of T1 in inorder, then the root r , followed by the vertices of T2 in inorder. In a postorder traversal of the vertices of T, we visit the vertices of T1 in postorder, then the vertices

    48010发布于 2018-08-07
  • 来自专栏全栈开发那些事

    图的邻接矩阵存储结构

    , G->Vertices.size, vertex);//在顺序表尾部插入 } /* 插入边 在有向图中插入一条有向边。 || v2 < 0 || v2 >= G->Vertices.size) { printf("参数v1或v2越界出错! || v2 < 0 || v2 >= G->Vertices.size || v1 == v2) { printf("参数v1或者v2越界出错! || v2 < 0 || v2 >= G.Vertices.size) { printf("参数v1或v2越界出错! < g1.Vertices.size; i++) { for (j = 0; j < g1.Vertices.size; j++) { printf("%5d ", g1.edge[i][

    89870编辑于 2023-02-27
  • 来自专栏福大大架构师每日一题

    文心一言 VS 讯飞星火 VS chatgpt (280)-- 算法导论20.4 1题

    g.contains(v) { g.vertices = append(g.vertices, v) g.edges[v] = make([]string, 0) ), } } func (g *Graph) AddEdge(v, u rune) { g.Vertices[v] = append(g.Vertices[v], u) g.Vertices (map[rune]bool) var components [][]rune for v := range g.Vertices { if ! [getIndex(edge.v)], &vertices[getIndex(edge.w)] if ! )) for _, edge := range edges { uf.union(indexOf(vertices, edge[0]), indexOf(vertices, edge

    22920编辑于 2024-08-16
  • 来自专栏福大大架构师每日一题

    2025-12-18:电网维护。用go语言,有 c 个电站,编号从 1 到 c。它们之间通过 n 条无向电缆相连,connect

    同时,初始化一个 vertices 切片,用于记录每个电站的详细信息,包括其所属的电网(连通分量)ID以及是否处于离线状态。 • vertices 数组需要 O(c) 的空间。 • 各个连通分量的最小堆总共存储了 c 个电站编号,所以也是 O(c) 的空间。 • 综合来看,总的额外空间复杂度为 O(c + n)。 := powerGrids[vertices[x].powerGridId] for powerGrid.Len() > 0 && vertices[(*powerGrid [vid] if v.powerGridId == -1 { traverse(v, powerGridId, powerGrid, graph, vertices auto& powerGrid = powerGrids[vertices[x].powerGridId]; // 弹出所有离线的顶点

    17810编辑于 2025-12-19
  • 来自专栏半杯茶的小酒杯

    自动驾驶路径规划-Graph Based的BFS最短路径规划

    __graph_dict = graph_dict def vertices(self): """ returns the vertices of a graph """ print("Add vertex:") graph.add_vertex("z") print("Vertices of graph:") print(graph.vertices edge {"x","y"} with new vertices:') graph.add_edge({"x","y"}) print("Vertices of graph:") print(graph.vertices()) print("Edges of graph:") print(graph.edges()) 程序的输出如下: Vertices of graph 在实现Python代码之前,我们再复习一些概念: 邻接节点(Adjacent Vertices):如果两个Vertices存在一条连接Edge,则称它们是相邻接的。

    1.6K20编辑于 2022-04-28
  • 来自专栏IT杂谈学习

    Python实现动态3D立方体:旋转的3D立方体动画

    import Axes3D from matplotlib.animation import FuncAnimation 初始化3D立方体 我们需要定义3D立方体的顶点和边: # 定义立方体的顶点 vertices , edges): for edge in edges: points = vertices[edge] ax.plot3D(*zip(*points), color ="b") 旋转立方体 我们定义一个旋转矩阵来旋转立方体: def rotate(vertices, angle_x, angle_y, angle_z): # 旋转矩阵 rotation_x = rotate(vertices, angle, angle, angle) draw_cube(ax, rotated_vertices, edges) ax.set_xlim([ = rotate(vertices, angle, angle, angle) draw_cube(ax, rotated_vertices, edges) ax.set_xlim([

    1.1K10编辑于 2024-09-25
  • 来自专栏OpenCV与AI深度学习

    基于OpenCV的图像形状检测(含源码)

    thresh.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE) print ('Number of contours', str(len(contours)) vertices = cv2.approxPolyDP(contour, 0.01*cv2.arcLength(contour,True), True) # Checking for Triangles if len(vertices ) == 3: len(vertices)得到轮廓逼近多边形的边数,其中: len(vertices)==3,对应为三角形; len(vertices)==4,对应为四边形,进一步根据外接矩形宽高判断是矩形还是正方形 ; len(vertices)==8,对应为四角形; len(vertices)==10,对应为五角形; len(vertices)>=12,对应为圆形; 【3】 结果绘制和输出。

    3.9K21编辑于 2022-04-04
  • 来自专栏福大大架构师每日一题

    文心一言 VS 讯飞星火 VS chatgpt (281)-- 算法导论20.4 2题

    map[int]struct{} } func (s *set) add(vertex *Vertex) { if s.vertices == nil { s.vertices ok := s.vertices[vertex.id] return ok } func connectedComponents(vertices []*Vertex, edges [][] &vertices, 4, 5) addEdge(&edges, &vertices, 2, 5) addEdge(&edges, &vertices, 3, 5) // 找出连通分量 (vertices int) *Graph { g := &Graph{ vertices: vertices, edges: make([][]int, { g.Vertices[v1].Edges = append(g.Vertices[v1].Edges, g.Vertices[v2]) g.Vertices[v2].Edges =

    28720编辑于 2024-08-16
  • 来自专栏ml

    hdu1710(Binary Tree Traversals)(二叉树遍历)

    In a preorder traversal of the vertices of T, we visit the root r followed by visiting the vertices of T1 in preorder, then the vertices of T2 in preorder. In an inorder traversal of the vertices of T, we visit the vertices of T1 in inorder, then the root r, followed by the vertices of T2 in inorder. In a postorder traversal of the vertices of T, we visit the vertices of T1 in postorder, then the vertices

    96050发布于 2018-03-26
领券