zoukankan      html  css  js  c++  java
  • poly算法的函数进行中。

    ---看到别人的东西是根据选择体的线,选择相应的体中的线。
    --1.选择线判断两点距离。其实这我也就明白了容差在这里到底是什么意思。---、
    --2.把模型的所有点找到。做递归的两点距离判断。 在容差范围内的,看看是否能还原出线。如果不行就没事。如果行就加到数组中
    --3.进行选择。
    --4. 关与线的方式我想不出来什么 我觉得就是递增判断距离。--其实后来我用的不是那个。是用的循环线。
     
     --判断物体收集所以线
     --因为每条线都有两个点,判断线的距离。
     
     fn Equal_spline input_poly tolerance =   ---这个函数是查找相等的线,input_poly 是输入的模型信息,判断是poly tolerance 容差数子。
      --在一定范围内的线被选择。
     (
        local line_space =0 --初始化间距
        local endge_length_array =#() ---收集的线的长度数组。
      --只对于是poly 或者是mesh
      if  superclassof input_poly ==GeometryClass  then
      (
        if classof input_poly == Editable_Poly then  --polyop.getEdgeSelection --这个以后还有很到的改善的地方,主要应用于层级的poly mesh
        (
        ---求的总边数
                 oop_Eng =  polyop.getNumEdges  input_poly
                 
                ---先判断第一个边。找起长度。在进行循环比较
                  Edge_array = polyop.getEdgeSelection  input_poly  as array --转成数组好判断个数这个很好。
         if Edge_array.count == 1 then
         (
        
          verts_array = polyop.getEdgeVerts input_poly  Edge_array[1] ---返回边的顶点。--着是个数组
          ---还有这里肯定是两个点的数组。所以我在这里直接用索引就好了。
         
          ---判断距离
         
           date_dis_1 = polyop.getVert  input_poly  verts_array[1]
           date_dis_2 = polyop.getVert  input_poly  verts_array[2]
         
             line_space = distance  date_dis_1 date_dis_2
            -- line_space=line_space+tolerance
          
         )else  return false
                   
         ---这里面做循环判断间距。距离在一定范围内加入数组。
         for i in 1 to oop_Eng do ---对每个边进行循环,也就是说,要有很多的point 数组产生 这里要进行长度判断。
         (
          verts_array = polyop.getEdgeVerts input_poly i
         
           date_dis_3 = polyop.getVert  input_poly  verts_array[1]
           date_dis_4 = polyop.getVert  input_poly  verts_array[2]
         
           local_line_space =distance  date_dis_3 date_dis_4
          ---这里要明白一点容差是上下的。所有这里有不同。
         
             tolerance_shang = line_space+tolerance
             tolerance_xia =line_space-tolerance
          
           if local_line_space <=tolerance_shang  and  local_line_space>=tolerance_xia   then ---
           (
             endge_length_array[(endge_length_array.count) +1]= i
           
           )
                         
         
         )---end for oop_Eng
         ---选择边的数组就好
        
         polyop.setEdgeSelection input_poly  endge_length_array
        
     
        )--end classof poly
       
        ---同样在里面找到上面的函数应用到mesh
        --1.返回返回mesh的所有的边数
        --2.对当前的选择边转数组
        --3.比较距离。(这里面中要的是能找到返回点的坐标的函数)
        --4. 循环比较做处理。
        ---我现在的感觉是,搭建物体形体最好是用mesh 编辑物体最好到poly
       
      ---mesh 没有相应转换的参数。所以要是进行比较就比较困难了。这里就制作 poly 的编辑。
      
      )---end if
     
     
     )---end fn
     
     ----下面是根据面的大小做判断,根据面积 ,其实这个函数最好的就是对正边形做判断。处理。
     ---- 原来是利用面的返回值做计算
     fn  Equal_face  input_poly  tolerance = --函数 变量 input_face 是输入的poly tolerance 是容量的大小
     ( 
      local line_space_area =0 --初始化面积。
      local append_faces_area = #()
     
       if  superclassof input_poly ==GeometryClass  then
      (
        if classof input_poly == Editable_Poly then  --polyop.getEdgeSelection --这个以后还有很到的改善的地方,主要应用于层级的poly mesh
        (
         ---求总的面数
         total_output_face =  polyop.getNumFaces input_poly
           ---判断当前的面返回的点。是一个数组 非别是三点 四点 和多点
          being_Verts= polyop.getFaceSelection  input_poly as array
         if being_Verts.count==1 then ---确保选择的是一个面,这个处理的效果非常的好。
         ( 
         
         
           being_Verts_array =  polyop.getFaceVerts  input_poly   being_Verts[1]
           ----数量的表达
           being_Verts_array_count = being_Verts_array.count
           
            case being_Verts_array_count  of
         (
                            3:(
           ---因为这里返回的是点,还是需要用距离算出来。
                     date_dis_1 = polyop.getVert  input_poly  being_Verts_array[1]
                     date_dis_2 = polyop.getVert  input_poly  being_Verts_array[2]
            date_dis_3 = polyop.getVert  input_poly  being_Verts_array[3]
           
             line_space = distance  date_dis_1 date_dis_2
             line_space_1 = distance  date_dis_1 date_dis_3
             ---我做出了两个间距。下面我就计算假性的面积
            line_space_area = line_space *line_space_1 /2
           
           
           
          )
          4:(
             date_dis_1 = polyop.getVert  input_poly  being_Verts_array[1]
                      date_dis_2 = polyop.getVert  input_poly  being_Verts_array[2]
             date_dis_3 = polyop.getVert  input_poly  being_Verts_array[3]
             date_dis_4 = polyop.getVert  input_poly  being_Verts_array[4]
            ----这里面当做矩形看待处理面积
              line_space = distance  date_dis_1 date_dis_2
              line_space_1 = distance  date_dis_3 date_dis_4
            line_space_area = line_space *line_space_1
           
          )
          ----当等于5 6 7 8 时就是按下面的进行计算。
          default:(
           ----对于多个面的我同样是 假性的算出 矩形的面积。来处理
             date_dis_1 = polyop.getVert  input_poly  being_Verts_array[1]
                      date_dis_2 = polyop.getVert  input_poly  being_Verts_array[2]
             date_dis_3 = polyop.getVert  input_poly  being_Verts_array[3]
             date_dis_4 = polyop.getVert  input_poly  being_Verts_array[4]
            ----这里面当做矩形看待处理面积
              line_space = distance  date_dis_1 date_dis_2
              line_space_1 = distance  date_dis_3 date_dis_4
              line_space_area = line_space *line_space_1
           
           
          )

         )----case  of  
         -------------------下面就是循环处理所有面,通过比较面积处理。

         
       
         )else return false
        
          for i in 1 to total_output_face do
          (
           ---在查询面时同样也是要建立一个空组。
             being_Verts_array =  polyop.getFaceVerts  input_poly   i
           ----数量的表达
        ----通过测试表明,如果形体架线不正确,那么可能返回的面数很多,但是其实在面里又返回不了点 就会出现 undefined
           --所以加入排错
           if being_Verts_array ==undefined do  Continue
           being_Verts_array_count = being_Verts_array.count
           
            case ( being_Verts_array_count)  of
         (
                            3:(
           ---因为这里返回的是点,还是需要用距离算出来。
                     date_dis_1 = polyop.getVert  input_poly  being_Verts_array[1]
                     date_dis_2 = polyop.getVert  input_poly  being_Verts_array[2]
            date_dis_3 = polyop.getVert  input_poly  being_Verts_array[3]
           
             line_space = distance  date_dis_1 date_dis_2
             line_space_1 = distance  date_dis_1 date_dis_3
             ---我做出了两个间距。下面我就计算假性的面积
            local_line_space_area = line_space *line_space_1 /2
           if local_line_space_area <= line_space_area+tolerance and local_line_space_area >= line_space_area - tolerance  then
           (
                     append  append_faces_area i
            
            
           )
           
          )
          4:(
             date_dis_1 = polyop.getVert  input_poly  being_Verts_array[1]
                      date_dis_2 = polyop.getVert  input_poly  being_Verts_array[2]
             date_dis_3 = polyop.getVert  input_poly  being_Verts_array[3]
             date_dis_4 = polyop.getVert  input_poly  being_Verts_array[4]
            ----这里面当做矩形看待处理面积
              line_space = distance  date_dis_1 date_dis_2
              line_space_1 = distance  date_dis_3 date_dis_4
             local_line_space_area = line_space *line_space_1
           if local_line_space_area <= line_space_area+tolerance and local_line_space_area >= line_space_area - tolerance  then
           (
                     append  append_faces_area i
            
            
           )
           
          )
          ----当等于5 6 7 8 时就是按下面的进行计算。
          default:(
           ----对于多个面的我同样是 假性的算出 矩形的面积。来处理
             date_dis_1 = polyop.getVert  input_poly  being_Verts_array[1]
                      date_dis_2 = polyop.getVert  input_poly  being_Verts_array[2]
             date_dis_3 = polyop.getVert  input_poly  being_Verts_array[3]
             date_dis_4 = polyop.getVert  input_poly  being_Verts_array[4]
            ----这里面当做矩形看待处理面积
              line_space = distance  date_dis_1 date_dis_2
              line_space_1 = distance  date_dis_3 date_dis_4
               local_line_space_area = line_space *line_space_1
           if local_line_space_area <= line_space_area+tolerance and local_line_space_area >= line_space_area - tolerance  then
           (
                     append  append_faces_area i
            
            
           )
           
           
          )

         )----case  of
         
          
          )--end for face
         
          ---通过上面完成面的收集 ,下来就是进行选择处理。
          polyop.setFaceSelection  input_poly  append_faces_area
     
        
        )--enfd  poly
     
      ) ----end if super classof
     )---end fn
     
     

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

  • 相关阅读:
    android应用程序的混淆打包
    sql 语句的limit的用法
    Android SDK开发包国内下载地址
    在android应用程序中启动其他apk程序
    docker+k8s基础篇五
    docker+k8s基础篇四
    docker+k8s基础篇三
    docker+k8s基础篇二
    docker+k8s基础篇一
    LVS的基础使用
  • 原文地址:https://www.cnblogs.com/gaitian00/p/2023578.html
Copyright © 2011-2022 走看看