File: pack-predicates.py

package info (click to toggle)
yade 2025.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,308 kB
  • sloc: cpp: 93,298; python: 50,409; sh: 577; makefile: 162
file content (14 lines) | stat: -rw-r--r-- 449 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# -*- encoding=utf-8 -*-
from yade.pack import *

s1 = inSphere((0, 0, 0), 1)
s2 = inSphere((0, 0, 1), 1)
# construct using explicit composition
s12 = PredicateUnion(s1, s2)
print(s12.aabb(), s12((0, 0, .5), 0))
# constuct the same predicate with operators
print((s1 | s2).aabb(), (s1 | s2)((0, 0, .5), 0))
# predicate difference: points in s1 and not in s2
print((s1 - s2).aabb())
print((s1 - s2)((0, 0, 1.5), 0))
print((s1 - s2)((0, 0, -0.5), 0))