Code Monkey home page Code Monkey logo

Comments (6)

GouMinghao avatar GouMinghao commented on August 15, 2024

Thank you very much for your bug report. However, I'm in travel. I will deal with this problem in the next week.

from geometry3d.

lihaolin88 avatar lihaolin88 commented on August 15, 2024

Thank you

from geometry3d.

GouMinghao avatar GouMinghao commented on August 15, 2024

Thanks for your report again, could please provide me your source code to help me debugging.

from geometry3d.

lihaolin88 avatar lihaolin88 commented on August 15, 2024

Hello, here is my code, I can send you the data I'm using if you need it, thanks!
##########################################

import numpy as np
import math
import scipy.io as scio
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import pandas as pd
import sys
from Geometry3D import *
from decimal import *
import os

def point_to_plane(plane, a):
    aux_line = Line(a, plane.n)
        # We then get the intersection point...
    foot = intersection(aux_line, plane)
    assert(foot in plane)
    return foot
def manipulate(a,b,c,d,e,f):
    cpg0 = ConvexPolygon((a,b,f))
    c = point_to_plane(cpg0.plane,c)
    new_line = Line(c, Vector(b,d))
    cpg1 = ConvexPolygon((a,d,f))
    e = intersection(cpg1.plane,new_line)
    assert(e in cpg1.plane)
    return a,b,c,d,e,f

def point_vector(a, plane):
    aux_line = Line(a, plane.n)
        # We then get the intersection point...
    foot = intersection(aux_line, plane)
    return Vector(foot, a).normalized()
def help_add(point, vector, add = True):
    #print(vector)
    new_point = Point(0,0,0)
    if add:
        new_point.x = point.x+vector[0]
        new_point.y = point.y+vector[1]#point.y += vector[1]
        new_point.z = point.z+vector[2]#point.z += vector[2]
    else:
        new_point.x = point.x-vector[0]
        new_point.y = point.y-vector[1]#point.y += vector[1]
        new_point.z = point.z-vector[2]
    return new_point

def make_shape(use_cph):
    center = use_cph.center_point
    dis = {}
    ss = 0
    for i in use_cph.convex_polygons:
        temp = distance(center, i.plane)
        dis[temp] = point_vector(center, i.plane)
        ss += temp
    dis_order = sorted(dis)
    xx = Vector(1, 0, 0)
    yy = Vector(0, 1, 0)
    zz = Vector(0, 0, 1)
    ss /= len(use_cph.convex_polygons)
 
    w = ss*xx
    h = ss*yy
    z = ss*zz
    rec1 = help_add(help_add(help_add(center, w), h), z)
    rec2 = help_add(help_add(help_add(center, w), h, False), z)
    rec3 = help_add(help_add(help_add(center, w, False), h), z)
    rec4 = help_add(help_add(help_add(center, w, False), h, False), z)
    rec5 = help_add(help_add(help_add(center, w), h), z, False)
    rec6 = help_add(help_add(help_add(center, w), h, False), z, False)
    rec7 = help_add(help_add(help_add(center, w, False), h), z, False)
    rec8 = help_add(help_add(help_add(center, w, False), h, False), z, False)
    cpg1 = ConvexPolygon((rec1, rec2, rec4, rec3))
    cpg2 = ConvexPolygon((rec5, rec6, rec8, rec7))
    cpg3 = ConvexPolygon((rec1, rec2, rec6, rec5))
    cpg4 = ConvexPolygon((rec2, rec4, rec8, rec6))
    cpg5 = ConvexPolygon((rec3, rec4, rec8, rec7))
    cpg6 = ConvexPolygon((rec1, rec3, rec5, rec7))
    cph111 = ConvexPolyhedron((cpg1, cpg2, cpg3, cpg4, cpg5, cpg6))
    return cph111

model_name = "resnet18_0801" 
path_gt = "./save_data_0801_test.csv" 
path_pd = "./"+model_name+"_result/save_bbox_and_score.csv"
test_list = ['003321','003327','003351','003381','003219','003222','003230','003398','003414','003421','003428','003438',
'003504','003545','003561','004218','004266']
gt = pd.read_csv(path_gt)
pred = pd.read_csv(path_pd)
img_list = []
pred_path = path_pd

gt_boxes = {}
pred_boxes = {}
gt = pd.read_csv(path_gt)
ind = [3,5,7,9]
for i in range(len(gt)):
    row = gt.iloc[i]
    temp = []
    for j in range(row[2]):
        use = row[ind[j]].split(",")
        x1 = int(use[0][1:])
        y1 = int(use[1][1:])
        x2 = int(use[0][1:])+int(use[2][1:])
        y2 = int(use[1][1:])+int(use[3][1:-1])
        temp.append([x1,y1,x2,y2])
    if "/" in row[1]:
        gt_boxes[row[1].split("/")[2][:-4]] = temp
    else:
        gt_boxes[row[1].split("\\")[2][:-4]] = temp

ind = [2,3,4,5,6,7,8,9,10,11]
pred = pd.read_csv(pred_path)
l_s = 0
for i in range(len(pred)):
    row = pred.iloc[i]
    row_gt = gt.iloc[int(row[1][:6])-1]
    temp = []
    score = []
    for j in range(row[12]):
        if not pd.isnull(row[ind[j]]):
            use = row[ind[j]].split(" ")
            x1 = int(use[0])
            y1 = int(use[1])
            x2 = int(use[2])
            y2 = int(use[3])
            score.append(use[4])
            temp.append([x1,y1,x2,y2])
    l_s += len(score)
    boxes = {"boxes":temp, "scores":score}
    if "/" in row_gt[1]:
        pred_boxes[row_gt[1].split("/")[2][:-4]] = boxes
    else:
        pred_boxes[row_gt[1].split("\\")[2][:-4]] = boxes
gt_boxes_use = {name:{"normal":{}, "hw":{},"vc":{},"vchw":{}} for name in test_list}
pred_boxes_use = {name:{"normal":{}, "hw":{},"vc":{},"vchw":{}} for name in test_list}

for i in gt_boxes:
    name = i.split("_")[1][:6]
    if len(i.split("_")) == 2:
        gt_boxes_use[name]["normal"][i] = gt_boxes[i]
    else:
        if i.split("_")[2] == "hw":
            gt_boxes_use[name]["hw"][i] = gt_boxes[i]
        elif i.split("_")[2] == "vc":
            gt_boxes_use[name]["vc"][i] = gt_boxes[i]
        else:
            gt_boxes_use[name]["vchw"][i] = gt_boxes[i]
for i in pred_boxes:
    name = i.split("_")[1][:6]
    if len(i.split("_")) == 2:
        pred_boxes_use[name]["normal"][i] = pred_boxes[i]
    else:
        if i.split("_")[2] == "hw":
            pred_boxes_use[name]["hw"][i] = pred_boxes[i]
        elif i.split("_")[2] == "vc":
            pred_boxes_use[name]["vc"][i] = pred_boxes[i]
        else:
            pred_boxes_use[name]["vchw"][i] = pred_boxes[i]

a = scio.loadmat('./coordData2.mat') 

xDetTmp = np.array(a["xDetTmp"])
xSrcTmp = np.array(a["xSrcTmp"])
yDetTmp = np.array(a["yDetTmp"])
ySrcTmp = np.array(a["ySrcTmp"])
zDetTmp = np.array(a["zDetTmp"])
zSrcTmp = np.array(a["zSrcTmp"])

nBlades = 6
angleSpacing = 6.2
nElements = 1216
bladeAngles = np.array([i for i in range((nBlades))]) * angleSpacing - (nBlades - 1) / 2 * angleSpacing
bladeAngles = bladeAngles[::-1]
intersectPoints = [542, 543, 543, 543, 543, 542]
dResWall = zDetTmp[1, -2, :] - zDetTmp[1, -1, :]  # where is this end come from ??
dResRoof = np.sqrt(
    np.power((xDetTmp[1, 2, :] - xDetTmp[1, 1, :]), 2) + np.power((yDetTmp[1, 2, :] - yDetTmp[1, 1, :]), 2))

dStep = xSrcTmp[2, 1, 1] - xSrcTmp[1, 1, 1]

viewAngles = [0, 37.2, 74.4, 111.6, 148.8]

X0 = 0
Y0 = 243.84

idxPass = 1


v_thr = 100
p_thr = 30
save_path_pred = "./"
save_all_cph_pred = {}
for name in pred_boxes_use:
    print("name: ", name)
    save_all_cph_pred[name] = {}
    for name1 in pred_boxes_use[name]:
        poly_list_pred = {}
        poly_list_2d_pred = {}
        poly_all = []
        poly_all_2d = []
        for name2 in pred_boxes_use[name][name1]:
            print("full_name: ", name2)
            for order in range(len(pred_boxes_use[name][name1][name2]['boxes'])):
                
                if int(name2.split("_")[1][7:]) <= 5:
                    idxPass = 0
                    idxBlade = int(name2.split("_")[1][7:])
                elif int(name2.split("_")[1][7:]) <= 11:
                    idxPass = 1
                    idxBlade = int(name2.split("_")[1][7:]) - 6
                elif int(name2.split("_")[1][7:]) <= 17:
                    idxPass = 2
                    idxBlade = int(name2.split("_")[1][7:]) - 12
                elif int(name2.split("_")[1][7:]) <= 23:
                    idxPass = 3
                    idxBlade = int(name2.split("_")[1][7:]) - 18
                else:
                    idxPass = 4
                    idxBlade = int(name2.split("_")[1][7:]) - 24
                cos = math.cos((viewAngles[idxPass] / 180) * math.pi)
                sin = math.sin((viewAngles[idxPass] / 180) * math.pi)

                xDetRot = xDetTmp * cos - yDetTmp * sin - X0 * cos + Y0 * sin + X0
                yDetRot = xDetTmp * sin + yDetTmp * cos - X0 * sin - Y0 * cos + Y0
                xSrcRot = xSrcTmp * cos - ySrcTmp * sin - X0 * cos + Y0 * sin + X0
                ySrcRot = xSrcTmp * sin + ySrcTmp * cos - X0 * sin - Y0 * cos + Y0
                
                [x, y, x0, y0] = pred_boxes_use[name][name1][name2]['boxes'][order]
                if name.split("_")[-1] == "vc" or name.split("_")[-1] == "vchw":
                    w = x0 - x
                    h = y0 - y
                    cent_x = (x + x0) / 2
                    cent_y = (y + y0)
                    x = int(cent_x - w / 2)
                    y = int(cent_y - h)
                    x0 = int(cent_x + w / 2)
                    y0 = int(cent_y + h)

                i, j = x, y  
                
                x10, y10, z10 = xSrcRot[int(round(i)), 1, idxBlade], ySrcRot[int(round(i)), 1, idxBlade], zSrcTmp[
                    int(round(i)), 1, idxBlade]  # source beam point
                x2, y2, z2 = xDetRot[int(round(i)), int(round(j)), idxBlade], yDetRot[
                    int(round(i)), int(round(j)), idxBlade], zDetTmp[
                                 int(round(i)), int(round(j)), idxBlade]  # point on image 3D point
                i, j = x0, y  
                x11, y11, z11 = xSrcRot[int(round(i)), 1, idxBlade], ySrcRot[int(round(i)), 1, idxBlade], zSrcTmp[
                    int(round(i)), 1, idxBlade]  # source beam point
                x3, y3, z3 = xDetRot[int(round(i)), int(round(j)), idxBlade], yDetRot[
                    int(round(i)), int(round(j)), idxBlade], zDetTmp[
                                 int(round(i)), int(round(j)), idxBlade]  # point on image 3D point
                i, j = x, y0  # choose a point from image
                
                x10, y10, z10 = xSrcRot[int(round(i)), 1, idxBlade], ySrcRot[int(round(i)), 1, idxBlade], zSrcTmp[
                    int(round(i)), 1, idxBlade]  # source beam point
                x4, y4, z4 = xDetRot[int(round(i)), int(round(j)), idxBlade], yDetRot[
                    int(round(i)), int(round(j)), idxBlade], zDetTmp[
                                 int(round(i)), int(round(j)), idxBlade]  # point on image 3D point
                i, j = x0, y0  # choose a point from image
                
                x11, y11, z11 = xSrcRot[int(round(i)), 1, idxBlade], ySrcRot[int(round(i)), 1, idxBlade], zSrcTmp[
                    int(round(i)), 1, idxBlade]  # source beam point
                x5, y5, z5 = xDetRot[int(round(i)), int(round(j)), idxBlade], yDetRot[
                    int(round(i)), int(round(j)), idxBlade], zDetTmp[
                                 int(round(i)), int(round(j)), idxBlade]  # point on image 3D point
                
                a = Point(float(x10), float(y10), float(z10))
                b = Point(float(x2), float(y2), float(z2))
                c = Point(float(x3), float(y3), float(z3))
                d = Point(float(x4), float(y4), float(z4))
                e = Point(float(x5), float(y5), float(z5))
                f = Point(float(x11), float(y11), float(z11))
               
                a, b, c, d, e, f = manipulate(a, b, c, d, e, f)
                cpg0 = ConvexPolygon((a, b, d))
                cpg1 = ConvexPolygon((f, c, e))
                cpg2 = ConvexPolygon((b, d, c, e))
                cpg3 = ConvexPolygon((a, b, c, f))
                cpg4 = ConvexPolygon((a, d, e, f))
                cpg = ConvexPolyhedron((cpg0, cpg1, cpg2, cpg3, cpg4))
                if int(name2.split("_")[1][7:]) not in poly_list_pred:
                    poly_list_pred[int(name2.split("_")[1][7:])] = [cpg]
                    poly_list_2d_pred[int(name2.split("_")[1][7:])] = [[x, y, x0 - x, y0 - y]]
                else:
                    poly_list_pred[int(name2.split("_")[1][7:])].append(cpg)
                    poly_list_2d_pred[int(name2.split("_")[1][7:])].append([x, y, x0 - x, y0 - y])
               
        already_process = {}

        save_cph_pred = []
        poly_all_num = []
        count = 0
        for k in poly_list_pred:
            for s in range(len(poly_list_pred[k])):
                poly_all.append(poly_list_pred[k][s])
                poly_all_2d.append(poly_list_2d_pred[k][s])
                poly_all_num.append(count)
            count += 1
        
        index = {i: 1 for i in range(len(poly_all))}
        for k in range(len(poly_all)):
            if k in index:
                cph = poly_all[k]
            else:
                continue
            for n in range(k + 1, len(poly_all)):

               
                print("cph1:",poly_all[k].convex_polygons)
                print("cph2:",poly_all[n].convex_polygons)
                if n in index and poly_all_num[k] != poly_all_num[n]:
                    print(n, k)
                    temp = intersection(cph, poly_all[n])
                    if temp != None and temp.volume() > v_thr and abs(poly_all_2d[k][1] - poly_all_2d[n][1]) < p_thr:
                   
                        if k in index:
                            del index[k]
                        del index[n]
                        cph = make_shape(temp)
                else:
                    continue
            save_cph_pred.append(cph)
        save_all_cph_pred[name][name1] = save_cph_pred
        np.save(save_path_pred+"/"+name2[:15]+"_"+name1+".npy",save_all_cph_pred)

from geometry3d.

lihaolin88 avatar lihaolin88 commented on August 15, 2024

Or this code, thank you so much!

import numpy as np
import math
import scipy.io as scio
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import pandas as pd
from Geometry3D import *
from decimal import *

a = [ConvexPolygon((Point(76.0, 482.0, 0.0), Point(-29.999999999999993, 103.0, 145.0), Point(-29.999999999999993, 103.0, 114.00000000000001))), ConvexPolygon((Point(65.99999999999983, 487.99999999999943, 1.7828292581923487e-13), Point(-39.94380564977955, 108.09365725036744, 114.22476136444429), Point(-39.943805649779534, 108.09365725036744, 145.28588068284571))), ConvexPolygon((Point(-39.943805649779534, 108.09365725036744, 145.28588068284571), Point(-39.94380564977955, 108.09365725036744, 114.22476136444429), Point(-29.999999999999993, 103.0, 114.00000000000001), Point(-29.999999999999993, 103.0, 145.0))), ConvexPolygon((Point(-29.999999999999993, 103.0, 145.0), Point(76.0, 482.0, 0.0), Point(65.99999999999983, 487.99999999999943, 1.7828292581923487e-13), Point(-39.943805649779534, 108.09365725036744, 145.28588068284571))), ConvexPolygon((Point(76.0, 482.0, 0.0), Point(-29.999999999999993, 103.0, 114.00000000000001), Point(-39.94380564977955, 108.09365725036744, 114.22476136444429), Point(65.99999999999983, 487.99999999999943, 1.7828292581923487e-13)))]#[ConvexPolygon((Point(236.0, 184.0, 0.0), Point(-105.0, 343.0, 190.0), Point(-112.0, 346.0, 183.0))), ConvexPolygon((Point(239.0, 194.0, 0.0), Point(-109.0, 356.0, 183.0), Point(-102.0, 353.0, 190.0))), ConvexPolygon((Point(-105.0, 343.0, 190.0), Point(-102.0, 353.0, 190.0), Point(-109.0, 356.0, 183.0), Point(-112.0, 346.0, 183.0))), ConvexPolygon((Point(-105.0, 343.0, 190.0), Point(236.0, 184.0, 0.0), Point(239.0, 194.0, 0.0), Point(-102.0, 353.0, 190.0))), ConvexPolygon((Point(236.0, 184.0, 0.0), Point(-112.0, 346.0, 183.0), Point(-109.0, 356.0, 183.0), Point(239.0, 194.0, 0.0)))]#[ConvexPolygon((Point(125.57989501953125, 33.03245544433594, 0.0), Point(-87.77513122558594, 348.1565246582031, 128.49752807617188), Point(-87.77513122558594, 348.1565246582031, 108.55316162109375))), ConvexPolygon((Point(134.3735809326172, 39.70722961425781, 0.0), Point(-78.9814453125, 354.831298828125, 108.55316162109374), Point(-78.9814453125, 354.831298828125, 128.4975280761719))), ConvexPolygon((Point(-87.77513122558594, 348.1565246582031, 128.49752807617188), Point(-78.9814453125, 354.831298828125, 128.4975280761719), Point(-78.9814453125, 354.831298828125, 108.55316162109374), Point(-87.77513122558594, 348.1565246582031, 108.55316162109375))), ConvexPolygon((Point(-87.77513122558594, 348.1565246582031, 128.49752807617188), Point(125.57989501953125, 33.03245544433594, 0.0), Point(134.3735809326172, 39.70722961425781, 0.0), Point(-78.9814453125, 354.831298828125, 128.4975280761719))), ConvexPolygon((Point(125.57989501953125, 33.03245544433594, 0.0), Point(-87.77513122558594, 348.1565246582031, 108.55316162109375), Point(-78.9814453125, 354.831298828125, 108.55316162109374), Point(134.3735809326172, 39.70722961425781, 0.0)))]#[ConvexPolygon((Point(-106.67681884765625, 302.38067626953125, 190.0), Point(-125.07760620117188, 319.8424072265625, 184.20480346679688), Point(154.2360382080078, 54.783660888671875, -0.0))), ConvexPolygon((Point(166.9486541748047, 64.43305969238281, -0.0), Point(-112.36498908762633, 329.491819597817, 184.20480836937483), Point(-93.96420124437704, 312.03008817604496, 190.00000505681606))), ConvexPolygon((Point(-125.07760620117188, 319.8424072265625, 184.20480346679688), Point(-106.67681884765625, 302.38067626953125, 190.0), Point(-93.96420124437704, 312.03008817604496, 190.00000505681606), Point(-112.36498908762633, 329.491819597817, 184.20480836937483))), ConvexPolygon((Point(-106.67681884765625, 302.38067626953125, 190.0), Point(154.2360382080078, 54.783660888671875, -0.0), Point(166.9486541748047, 64.43305969238281, -0.0), Point(-93.96420124437704, 312.03008817604496, 190.00000505681606))), ConvexPolygon((Point(154.2360382080078, 54.783660888671875, -0.0), Point(-125.07760620117188, 319.8424072265625, 184.20480346679688), Point(-112.36498908762633, 329.491819597817, 184.20480836937483), Point(166.9486541748047, 64.43305969238281, -0.0)))]
b = [ConvexPolygon((Point(85.0, 477.0, 0.0), Point(-58.000000000000014, 119.00000000000001, 148.0), Point(-58.0, 119.00000000000001, 114.0))), ConvexPolygon((Point(76.00000000000014, 482.0000000000004, -1.2136962738882847e-13), Point(-67.05530756641602, 124.9004463804512, 113.7733470476287), Point(-67.055307566416, 124.9004463804512, 147.7057487986759))), ConvexPolygon((Point(-58.000000000000014, 119.00000000000001, 148.0), Point(-67.055307566416, 124.9004463804512, 147.7057487986759), Point(-67.05530756641602, 124.9004463804512, 113.7733470476287), Point(-58.0, 119.00000000000001, 114.0))), ConvexPolygon((Point(-58.000000000000014, 119.00000000000001, 148.0), Point(85.0, 477.0, 0.0), Point(76.00000000000014, 482.0000000000004, -1.2136962738882847e-13), Point(-67.055307566416, 124.9004463804512, 147.7057487986759))), ConvexPolygon((Point(-58.0, 119.00000000000001, 114.0), Point(-67.05530756641602, 124.9004463804512, 113.7733470476287), Point(76.00000000000014, 482.0000000000004, -1.2136962738882847e-13), Point(85.0, 477.0, 0.0)))]#[ConvexPolygon((Point(-86.0, 338.0, 190.0), Point(-89.0, 346.0, 181.0), Point(55.0, -19.0, 0.0))), ConvexPolygon((Point(63.0, -14.0, 0.0), Point(-81.94657699463201, 350.9181080258552, 181.2027671982363), Point(-78.94321621234079, 342.90914593974526, 190.21284954510998))), ConvexPolygon((Point(-78.94321621234079, 342.90914593974526, 190.21284954510998), Point(-81.94657699463201, 350.9181080258552, 181.2027671982363), Point(-89.0, 346.0, 181.0), Point(-86.0, 338.0, 190.0))), ConvexPolygon((Point(-86.0, 338.0, 190.0), Point(55.0, -19.0, 0.0), Point(63.0, -14.0, 0.0), Point(-78.94321621234079, 342.90914593974526, 190.21284954510998))), ConvexPolygon((Point(55.0, -19.0, 0.0), Point(-89.0, 346.0, 181.0), Point(-81.94657699463201, 350.9181080258552, 181.2027671982363), Point(63.0, -14.0, 0.0)))]#[ConvexPolygon((Point(-47.52482604980469, 113.43841552734375, 128.61720275878906), Point(-47.52482604980469, 113.43841552734375, 106.79966735839844), Point(59.184303283691406, 493.0682373046875, -0.0))), ConvexPolygon((Point(-56.86540222167969, 119.09527587890625, 128.61720275878906), Point(49.843727111816406, 498.72509765625, -0.0), Point(-56.86540222167969, 119.09527587890625, 106.79966735839844))), ConvexPolygon((Point(-47.52482604980469, 113.43841552734375, 128.61720275878906), Point(-56.86540222167969, 119.09527587890625, 128.61720275878906), Point(-56.86540222167969, 119.09527587890625, 106.79966735839844), Point(-47.52482604980469, 113.43841552734375, 106.79966735839844))), ConvexPolygon((Point(-47.52482604980469, 113.43841552734375, 128.61720275878906), Point(59.184303283691406, 493.0682373046875, -0.0), Point(49.843727111816406, 498.72509765625, -0.0), Point(-56.86540222167969, 119.09527587890625, 128.61720275878906))), ConvexPolygon((Point(59.184303283691406, 493.0682373046875, -0.0), Point(-47.52482604980469, 113.43841552734375, 106.79966735839844), Point(-56.86540222167969, 119.09527587890625, 106.79966735839844), Point(49.843727111816406, 498.72509765625, -0.0)))]#[ConvexPolygon((Point(228.86135864257812, 328.18670654296875, 0.0), Point(-94.588623046875, 219.96185302734375, 190.0), Point(-117.3912353515625, 212.33221435546875, 190.0))), ConvexPolygon((Point(224.04629516601562, 340.3481750488281, 0.0), Point(-122.20629882812509, 224.4936828613281, 190.00000000000003), Point(-99.40368652343749, 232.12332153320312, 190.00000000000003))), ConvexPolygon((Point(-94.588623046875, 219.96185302734375, 190.0), Point(-99.40368652343749, 232.12332153320312, 190.00000000000003), Point(-122.20629882812509, 224.4936828613281, 190.00000000000003), Point(-117.3912353515625, 212.33221435546875, 190.0))), ConvexPolygon((Point(228.86135864257812, 328.18670654296875, 0.0), Point(224.04629516601562, 340.3481750488281, 0.0), Point(-99.40368652343749, 232.12332153320312, 190.00000000000003), Point(-94.588623046875, 219.96185302734375, 190.0))), ConvexPolygon((Point(-117.3912353515625, 212.33221435546875, 190.0), Point(-122.20629882812509, 224.4936828613281, 190.00000000000003), Point(224.04629516601562, 340.3481750488281, 0.0), Point(228.86135864257812, 328.18670654296875, 0.0)))]
def create_polyhedron(a):
    for i in range(len(a)):
        #for j in range(len(a[i].points)):
            #a[i].points[j] = float(float32(a[i].points[j]))
        if i == 0:
            cpg1 = a[i]
        elif i == 1:
            cpg2 = a[i]
        elif i == 2:
            cpg3 = a[i]
        elif i == 3:
            cpg4 = a[i]
        elif i == 4:
            cpg5 = a[i]
#         elif i == 5:
#             cpg6 = a[i]
#         elif i == 6:
#             cpg7 = a[i]
#         elif i == 7:
#             cpg8 = a[i]
    return ConvexPolyhedron((cpg1,cpg2,cpg3,cpg4,cpg5))#,cpg6,cpg7
aa = create_polyhedron(a)
bb = create_polyhedron(b)

r = Renderer()
r.add((aa,'r',1),normal_length = 0)
r.add((bb,'b',1),normal_length = 0)
r.show()
temp = intersection(aa, bb)

from geometry3d.

lihaolin88 avatar lihaolin88 commented on August 15, 2024

Hello, after change "SIG_FIGURES" in /utils/constant.py from 10 to 8, I solve the problem; is this will cause some problems in the result? Thank you so much for your amazing project, it is very helpful!

from geometry3d.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.