mindflow.geometry.CSGIntersection
- class mindflow.geometry.CSGIntersection(geom1, geom2, sampling_config=None)[源代码]
几何相交的CSG类。
- 参数:
geom1 (Geometry) - 几何体对象。
geom2 (Geometry) - 要与geom1求交集的几何体对象。
sampling_config (SamplingConfig) - 采样配置。默认值:
None
。
- 支持平台:
Ascend
GPU
样例:
>>> from mindflow.geometry import generate_sampling_config, Disk, Rectangle, CSGIntersection >>> sampling_config_csg = dict({ ... 'domain': dict({ ... 'random_sampling': True, ... 'size': 1000, ... 'sampler': 'uniform' ... }), ... 'BC': dict({ ... 'random_sampling': True, ... 'size': 200, ... 'sampler': 'uniform', ... 'with_normal': True, ... }), ... }) >>> disk = Disk("disk", (1.2, 0.5), 0.8) >>> rect = Rectangle("rect", (-1.0, 0), (1, 1)) >>> inter = CSGIntersection(rect, disk) >>> inter.set_sampling_config(generate_sampling_config(sampling_config_csg)) >>> domain = inter.sampling(geom_type="domain") >>> bc, bc_normal = inter.sampling(geom_type="BC") >>> print(domain.shape) (1000, 2)