Origin
Today by chance to see this problem, I figure out is 3 knife with plane 7, multiplied by 2 is 14. The result is that this is not the optimal, I can not think of the simulation of a bit. Numerical simulation calculation principle
Initialize 4 planes, generate 100 points to verify all the states and. Results for the source
import NumPy as NP import random as Rd # # #点的限制条件在1, in the range of the Cube def setP3 (): Return rd.uniform (0,1), rd.uniform (0,1), Rd.uniform (0,1) # # #生成平面; Incoming list (tuple) def SETPM (): M33 = Np.mat ([SetP3 (), setP3 (), setP3 ()]) return (M33. I) * (Np.mat ([1,1,1]).
T) #判断点在面内1, or out-of-plane 0 def pdmp (m,p): A,b,c = m x, y, z = P flag = a*x + b*y + c*z-1 if (Flag > 0): return 0 return 1 #生成4个平面 and output 4 flat tuple def set4m (): Return [SETPM () for I in range (4)] # #判断点和各个面的状态和 def Setdl (PM 4, p): locat = 0 for I in range (4): Locat = locat + 2**i * PDMP (Pm4[i], p) return Locat # #随机选出100个点判断 The state of these points is set to Def Main (): ZT = [] pm4 = set4m () for I in range: P = setP3 () zt.append (Setdl (PM 4, p)) return Np.unique (ZT) print (max ([Len (Main ()) for I in range))