Constraints (.core.constraints)#
Constraint Language (.core.constraints.constraint_language)#
constants#
- class infinigen.core.constraints.constraint_language.constants.RoomConstants(
- n_stories=('cat', 0.0, 0.5, 0.4, 0.1),
- room_type=None,
- aspect_ratio_range=(0.7, 1.0),
- fixed_contour=('bool', 0.5),
Bases:
object- global_params(...)[source]#
- Parameters:
unit -- (default:
0.5)segment_margin -- (default:
1.4)wall_thickness -- (default:
('uniform', 0.2, 0.3))wall_height -- (default:
('uniform', 2.8, 3.2))
- door_params(
- door_width_ratio=('uniform', 0.7, 0.8),
- door_size=('uniform', 2.0, 2.4),
- Parameters:
door_width_ratio -- (default:
('uniform', 0.7, 0.8))door_size -- (default:
('uniform', 2.0, 2.4))
- window_params(...)[source]#
- Parameters:
max_window_length -- (default:
('uniform', 6, 8))window_height -- (default:
('uniform', 0.8, 1.2))window_margin -- (default:
('uniform', 0.2, 0.25))window_size -- (default:
('uniform', 1.0, 1.5))
- property home_room_types#
- property floors#
expression#
- class infinigen.core.constraints.constraint_language.expression.Expression[source]#
Bases:
Node- debugprint(
- val: Expression,
- msg: str,
- Parameters:
val (Expression)
msg (str)
- class infinigen.core.constraints.constraint_language.expression.ArithmethicExpression[source]#
Bases:
Expression
- class infinigen.core.constraints.constraint_language.expression.ScalarExpression[source]#
Bases:
ArithmethicExpression- hinge(
- val: ScalarExpression,
- low: float,
- high: float,
- Parameters:
val (ScalarExpression)
low (float)
high (float)
- class infinigen.core.constraints.constraint_language.expression.BoolExpression[source]#
Bases:
ArithmethicExpression
- class infinigen.core.constraints.constraint_language.expression.constant(value: int)[source]#
Bases:
ScalarExpression- Parameters:
value (int)
- class infinigen.core.constraints.constraint_language.expression.BoolOperatorExpression(
- func: Callable,
- operands: list[Expression],
Bases:
BoolExpression- Parameters:
func (Callable)
operands (list[Expression])
- class infinigen.core.constraints.constraint_language.expression.ScalarOperatorExpression(
- func: Callable,
- operands: list[Expression],
Bases:
ScalarExpression- Parameters:
func (Callable)
operands (list[Expression])
- class infinigen.core.constraints.constraint_language.expression.hinge(
- val: ScalarExpression,
- low: float,
- high: float,
Bases:
ScalarExpression- Parameters:
val (ScalarExpression)
low (float)
high (float)
- class infinigen.core.constraints.constraint_language.expression.debugprint(
- val: Expression,
- msg: str,
Bases:
ScalarExpression,BoolExpression- Parameters:
val (Expression)
msg (str)
gather#
- class infinigen.core.constraints.constraint_language.gather.item(
- name: str,
- member_of: ObjectSetExpression,
Bases:
ObjectSetExpression- Parameters:
name (str)
member_of (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.gather.ForAll(
- objs: ObjectSetExpression,
- var: str,
- pred: BoolExpression,
Bases:
BoolExpression- Parameters:
objs (ObjectSetExpression)
var (str)
pred (BoolExpression)
- infinigen.core.constraints.constraint_language.gather.all(
- objs,
- pred,
- Parameters:
objs (ObjectSetExpression)
pred (Callable[[item], BoolExpression])
- class infinigen.core.constraints.constraint_language.gather.SumOver(
- objs: ObjectSetExpression,
- var: str,
- pred: ScalarExpression,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
var (str)
pred (ScalarExpression)
- infinigen.core.constraints.constraint_language.gather.sum(objs, pred)[source]#
- Parameters:
objs (ObjectSetExpression)
pred (Callable[[item], ScalarExpression])
- class infinigen.core.constraints.constraint_language.gather.MeanOver(
- objs: ObjectSetExpression,
- var: str,
- pred: ScalarExpression,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
var (str)
pred (ScalarExpression)
- infinigen.core.constraints.constraint_language.gather.mean(objs, pred)[source]#
- Parameters:
objs (ObjectSetExpression)
pred (Callable[[item], ScalarExpression])
geometry#
- class infinigen.core.constraints.constraint_language.geometry.center_stable_surface_dist(
- objs: ObjectSetExpression,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.geometry.accessibility_cost(
- objs: ObjectSetExpression,
- others: ObjectSetExpression,
- normal: <built-in function array> = <factory>,
- dist: float = 1.0,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
others (ObjectSetExpression)
normal (array)
dist (float)
- class infinigen.core.constraints.constraint_language.geometry.distance(
- objs: ObjectSetExpression,
- others: ObjectSetExpression,
- others_tags: set = <factory>,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
others (ObjectSetExpression)
others_tags (set)
- class infinigen.core.constraints.constraint_language.geometry.min_distance_internal(
- objs: ObjectSetExpression,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.geometry.focus_score(
- objs: ObjectSetExpression,
- others: ObjectSetExpression,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
others (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.geometry.angle_alignment_cost(
- objs: ObjectSetExpression,
- others: ObjectSetExpression,
- others_tags: set = None,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
others (ObjectSetExpression)
others_tags (set)
- class infinigen.core.constraints.constraint_language.geometry.freespace_2d(
- objs: ObjectSetExpression,
- others: ObjectSetExpression,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
others (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.geometry.min_dist_2d(
- objs: ObjectSetExpression,
- others: ObjectSetExpression,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
others (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.geometry.rotational_asymmetry(
- objs: ObjectSetExpression,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.geometry.reflectional_asymmetry(
- objs: ObjectSetExpression,
- others: ObjectSetExpression,
- use_long_plane: bool = True,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
others (ObjectSetExpression)
use_long_plane (bool)
- class infinigen.core.constraints.constraint_language.geometry.volume(
- objs: ObjectSetExpression,
- dims: int | tuple = 3,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.geometry.coplanarity_cost(
- objs: ObjectSetExpression,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
relations#
- class infinigen.core.constraints.constraint_language.relations.Relation[source]#
Bases:
ABC- abstractmethod implies(other) bool[source]#
self must imply all parts of other, both positive and negative.
- Parameters:
other
- abstractmethod satisfies(other) bool[source]#
self must imply all positive parts of other, and not contradict any negative parts
- Parameters:
other (Relation)
- class infinigen.core.constraints.constraint_language.relations.AnyRelation[source]#
Bases:
Relation- implies(other) bool[source]#
self must imply all parts of other, both positive and negative.
- Parameters:
other
- satisfies(other) bool[source]#
self must imply all positive parts of other, and not contradict any negative parts
- Parameters:
other (Relation)
- class infinigen.core.constraints.constraint_language.relations.NegatedRelation(rel: 'Relation')[source]#
Bases:
Relation- Parameters:
rel (Relation)
- implies(other) bool[source]#
self must imply all parts of other, both positive and negative.
- Parameters:
other (Relation)
- satisfies(other) bool[source]#
self must imply all positive parts of other, and not contradict any negative parts
- Parameters:
other (Relation)
- class infinigen.core.constraints.constraint_language.relations.ConnectorType(value)[source]#
Bases:
Enum- Door = 'door'#
- Open = 'open'#
- Wall = 'wall'#
- class infinigen.core.constraints.constraint_language.relations.RoomNeighbour(connector_types: 'frozenset[ConnectorType]' = <factory>)[source]#
Bases:
Relation- Parameters:
connector_types (frozenset[ConnectorType])
- implies(other) bool[source]#
self must imply all parts of other, both positive and negative.
- Parameters:
other (Relation)
- satisfies(other) bool[source]#
self must imply all positive parts of other, and not contradict any negative parts
- Parameters:
other (Relation)
- infinigen.core.constraints.constraint_language.relations.no_frozenset_repr(self)[source]#
- Parameters:
self (GeometryRelation)
- class infinigen.core.constraints.constraint_language.relations.GeometryRelation(
- child_tags: 'frozenset[t.Subpart]' = <factory>,
- parent_tags: 'frozenset[t.Subpart]' = <factory>,
Bases:
Relation- implies(other) bool[source]#
self must imply all parts of other, both positive and negative.
- Parameters:
other (Relation)
- satisfies(other) bool[source]#
self must imply all positive parts of other, and not contradict any negative parts
- Parameters:
other (Relation)
- intersects(other, strict=False) bool[source]#
- Parameters:
other (Relation)
strict -- (default:
False)
- class infinigen.core.constraints.constraint_language.relations.Touching(
- child_tags: 'frozenset[t.Subpart]' = <factory>,
- parent_tags: 'frozenset[t.Subpart]' = <factory>,
Bases:
GeometryRelation
- class infinigen.core.constraints.constraint_language.relations.SupportedBy(
- child_tags: 'frozenset[t.Subpart]' = <factory>,
- parent_tags: 'frozenset[t.Subpart]' = <factory>,
Bases:
Touching
- class infinigen.core.constraints.constraint_language.relations.CoPlanar(
- child_tags: 'frozenset[t.Subpart]' = <factory>,
- parent_tags: 'frozenset[t.Subpart]' = <factory>,
- margin: 'float' = 0,
- rev_normal: 'bool' = False,
Bases:
GeometryRelation- Parameters:
- class infinigen.core.constraints.constraint_language.relations.StableAgainst(
- child_tags: 'frozenset[t.Subpart]' = <factory>,
- parent_tags: 'frozenset[t.Subpart]' = <factory>,
- margin: 'float' = 0,
- check_z: 'bool' = True,
- rev_normal: 'bool' = False,
Bases:
GeometryRelation- Parameters:
- class infinigen.core.constraints.constraint_language.relations.IdentityCompareRelation[source]#
Bases:
Relation- implies(other) bool[source]#
self must imply all parts of other, both positive and negative.
- Parameters:
other (Relation)
- satisfies(other) bool[source]#
self must imply all positive parts of other, and not contradict any negative parts
- Parameters:
other (Relation)
- class infinigen.core.constraints.constraint_language.relations.CutFrom[source]#
Bases:
IdentityCompareRelation
Bases:
IdentityCompareRelation
- class infinigen.core.constraints.constraint_language.relations.Traverse[source]#
Bases:
IdentityCompareRelation
result#
- class infinigen.core.constraints.constraint_language.result.Problem(constraints: dict[str, infinigen.core.constraints.constraint_language.expression.BoolExpression], score_terms: dict[str, infinigen.core.constraints.constraint_language.expression.ScalarExpression], constants: infinigen.core.constraints.constraint_language.constants.RoomConstants = <factory>)[source]#
Bases:
Node- Parameters:
constraints (dict[str, BoolExpression])
score_terms (dict[str, ScalarExpression])
constants (RoomConstants)
rooms#
- class infinigen.core.constraints.constraint_language.rooms.access_angle(objs)[source]#
Bases:
ScalarExpressionComputes the angle between the vector from the root to the room and the vector from the room’s neighbour to the room
- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.rooms.aspect_ratio(objs)[source]#
Bases:
ScalarExpressionComputes the aspect ratio of a room contour, always >1
- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.rooms.convexity(objs)[source]#
Bases:
ScalarExpressionComputes the ratio of the area of bounding box of the room contour to the room
- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.rooms.n_verts(objs)[source]#
Bases:
ScalarExpressionComputes the number of vertices of the room contour
- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.rooms.grid_line_count(objs, constants, direction=None)[source]#
Bases:
ScalarExpressionComputes the number of unique x/y grid lines objs occupies
- Parameters:
objs (ObjectSetExpression)
constants (RoomConstants)
direction (str)
- class infinigen.core.constraints.constraint_language.rooms.narrowness(objs, constants, thresh)[source]#
Bases:
ScalarExpressionComputes the circumference difference after the room contour is eroded and buffered by thresh. Would be non-zero if the countour has a narrow end
- Parameters:
objs (ObjectSetExpression)
constants (RoomConstants)
thresh (float)
- class infinigen.core.constraints.constraint_language.rooms.intersection(objs, objs_)[source]#
Bases:
ScalarExpressionComputes the intersection area between two sets of room contours
- Parameters:
objs (ObjectSetExpression)
objs_ (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.rooms.graph_coherent(constants)[source]#
Bases:
BoolExpressionComputes if the state is coherent with the room graph in terms of adjacency
- Parameters:
constants (RoomConstants)
- class infinigen.core.constraints.constraint_language.rooms.same_level(objs)[source]#
Bases:
ObjectSetExpressionComputes the set of room contours on the same level/floor
- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.rooms.area(objs)[source]#
Bases:
ScalarExpressionComputes the area of the room contour
- Parameters:
objs (ObjectSetExpression)
Bases:
ScalarExpressionComputes the shared length between two sets of room contours
- Parameters:
objs (ObjectSetExpression)
objs_ (ObjectSetExpression)
Bases:
ScalarExpressionComputes the number of shared vertices of two sets of room contours
- Parameters:
objs (ObjectSetExpression)
objs_ (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.rooms.length(objs)[source]#
Bases:
ScalarExpressionComputes the circumference of a room contour
- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.rooms.rand(count, type, args)[source]#
Bases:
ScalarExpressionComputes the NLL of an integer sample given the distribution type and arguments type can be of ‘bool’(‘bern’) / ‘categorical’(‘cat’)
- Parameters:
count (ScalarExpression)
type (str)
set_reasoning#
- class infinigen.core.constraints.constraint_language.set_reasoning.ObjectSetExpression[source]#
Bases:
Expression- access_angle()[source]#
Computes the angle between the vector from the root to the room and the vector from the room’s neighbour to the room
- Parameters:
objs (ObjectSetExpression)
- all(
- pred,
- Parameters:
objs (ObjectSetExpression)
pred (Callable[[item], BoolExpression])
- area()[source]#
Computes the area of the room contour
- Parameters:
objs (ObjectSetExpression)
- aspect_ratio()[source]#
Computes the aspect ratio of a room contour, always >1
- Parameters:
objs (ObjectSetExpression)
- convexity()[source]#
Computes the ratio of the area of bounding box of the room contour to the room
- Parameters:
objs (ObjectSetExpression)
- count(
- objs: ObjectSetExpression,
- Parameters:
objs (ObjectSetExpression)
- distance(
- objs: ObjectSetExpression,
- others: ObjectSetExpression,
- others_tags: set = <factory>,
- Parameters:
objs (ObjectSetExpression)
others (ObjectSetExpression)
others_tags (set) -- (default:
<factory>)
- grid_line_count(constants, direction=None)[source]#
Computes the number of unique x/y grid lines objs occupies
- Parameters:
objs (ObjectSetExpression)
constants (RoomConstants)
direction (str) -- (default:
None)
- intersection(objs_)[source]#
Computes the intersection area between two sets of room contours
- Parameters:
objs (ObjectSetExpression)
objs
objs_ (ObjectSetExpression)
- length()[source]#
Computes the circumference of a room contour
- Parameters:
objs (ObjectSetExpression)
- mean(pred)[source]#
- Parameters:
objs (ObjectSetExpression)
pred (Callable[[item], ScalarExpression])
- n_verts()[source]#
Computes the number of vertices of the room contour
- Parameters:
objs (ObjectSetExpression)
- narrowness(constants, thresh)[source]#
Computes the circumference difference after the room contour is eroded and buffered by thresh. Would be non-zero if the countour has a narrow end
- Parameters:
objs (ObjectSetExpression)
constants (RoomConstants)
thresh (float)
- child: ObjectSetExpression,
- parent: ObjectSetExpression,
- relation: Relation = <factory>,
- Parameters:
child (ObjectSetExpression)
parent (ObjectSetExpression)
relation (Relation) -- (default:
<factory>)
- same_level()[source]#
Computes the set of room contours on the same level/floor
- Parameters:
objs (ObjectSetExpression)
Computes the shared length between two sets of room contours
- Parameters:
objs (ObjectSetExpression)
objs
objs_ (ObjectSetExpression)
Computes the number of shared vertices of two sets of room contours
- Parameters:
objs (ObjectSetExpression)
objs
objs_ (ObjectSetExpression)
- sum(pred)[source]#
- Parameters:
objs (ObjectSetExpression)
pred (Callable[[item], ScalarExpression])
- tagged(
- objs: ObjectSetExpression,
- tags: set[Tag] = <factory>,
- Parameters:
objs (ObjectSetExpression)
- union(
- objs: ObjectSetExpression,
- tags: set[Tag] = <factory>,
- Parameters:
objs (ObjectSetExpression)
- volume(
- objs: ObjectSetExpression,
- dims: int | tuple = 3,
- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.set_reasoning.scene[source]#
Bases:
ObjectSetExpression
- class infinigen.core.constraints.constraint_language.set_reasoning.tagged(
- objs: ObjectSetExpression,
- tags: set[Tag] = <factory>,
Bases:
ObjectSetExpression- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.set_reasoning.union(
- objs: ObjectSetExpression,
- tags: set[Tag] = <factory>,
Bases:
ObjectSetExpression- Parameters:
objs (ObjectSetExpression)
- infinigen.core.constraints.constraint_language.set_reasoning.excludes(objs, tags)[source]#
- Parameters:
objs
tags
- child: ObjectSetExpression,
- parent: ObjectSetExpression,
- relation: Relation = <factory>,
Bases:
ObjectSetExpression- Parameters:
child (ObjectSetExpression)
parent (ObjectSetExpression)
relation (Relation)
- class infinigen.core.constraints.constraint_language.set_reasoning.count(
- objs: ObjectSetExpression,
Bases:
ScalarExpression- Parameters:
objs (ObjectSetExpression)
- class infinigen.core.constraints.constraint_language.set_reasoning.in_range(
- val: ScalarExpression,
- low: float,
- high: float,
- mean: float = 0,
Bases:
BoolExpression- Parameters:
val (ScalarExpression)
low (float)
high (float)
mean (float)
types#
util#
- infinigen.core.constraints.constraint_language.util.bvh_caching_config(enabled=True)[source]#
- Parameters:
enabled -- (default:
True)
- infinigen.core.constraints.constraint_language.util.meshes_from_names(scene, names)[source]#
- Parameters:
scene
names
- infinigen.core.constraints.constraint_language.util.blender_objs_from_names(names)[source]#
- Parameters:
names
- infinigen.core.constraints.constraint_language.util.name_from_mesh(scene, mesh)[source]#
- Parameters:
scene
mesh
- infinigen.core.constraints.constraint_language.util.project_to_xy_path2d(mesh) trimesh.path.path.Path2D[source]#
- Parameters:
mesh (Trimesh)
- infinigen.core.constraints.constraint_language.util.project_to_xy_poly(mesh)[source]#
- Parameters:
mesh (Trimesh)
- infinigen.core.constraints.constraint_language.util.closest_edge_to_point_poly(polygon, point)[source]#
- Parameters:
polygon
point
- infinigen.core.constraints.constraint_language.util.closest_edge_to_point_edge_list(edge_list, point)[source]#
- Parameters:
edge_list (list[LineString])
point
- infinigen.core.constraints.constraint_language.util.compute_outward_normal(line, polygon)[source]#
- Parameters:
line
polygon
- infinigen.core.constraints.constraint_language.util.get_transformed_axis(scene, obj_name)[source]#
- Parameters:
scene
obj_name
- infinigen.core.constraints.constraint_language.util.get_plane_from_3dmatrix(matrix)[source]#
Extract the plane_normal and plane_origin from a transformation matrix.
- Parameters:
matrix
- infinigen.core.constraints.constraint_language.util.project_points_onto_plane(points, plane_origin, plane_normal)[source]#
Project 3D points onto a plane.
- Parameters:
points
plane_origin
plane_normal
- infinigen.core.constraints.constraint_language.util.to_2d_coordinates(points, plane_normal)[source]#
Convert 3D points to 2D using the plane defined by its normal.
- Parameters:
points
plane_normal
- infinigen.core.constraints.constraint_language.util.ensure_correct_order(points)[source]#
Ensures the points are in counter-clockwise order. If not, it reverses them.
- Parameters:
points
- infinigen.core.constraints.constraint_language.util.sample_random_point(polygon)[source]#
Sample a random point from inside the given Shapely polygon.
- Parameters:
polygon
- infinigen.core.constraints.constraint_language.util.delete_obj(scene, a, delete_blender=True)[source]#
- Parameters:
scene
a
delete_blender -- (default:
True)
- infinigen.core.constraints.constraint_language.util.is_planar(obj, tolerance=1e-06)[source]#
- Parameters:
obj
tolerance -- (default:
1e-06)
- infinigen.core.constraints.constraint_language.util.planes_parallel(plane_obj_a, plane_obj_b, tolerance=1e-06)[source]#
- Parameters:
plane_obj_a
plane_obj_b
tolerance -- (default:
1e-06)
- infinigen.core.constraints.constraint_language.util.distance_to_plane(point, plane_point, plane_normal)[source]#
Compute the distance from a point to a plane defined by a point and a normal.
- Parameters:
point
plane_point
plane_normal
- infinigen.core.constraints.constraint_language.util.subset(scene, incl)[source]#
- Parameters:
scene (Scene)
incl
- infinigen.core.constraints.constraint_language.util.add_object_cached(...)[source]#
- Parameters:
col
name
col_obj
fcl_obj
- infinigen.core.constraints.constraint_language.util.col_from_subset(...)[source]#
- Parameters:
scene
names
tags -- (default:
None)bvh_cache -- (default:
None)
- infinigen.core.constraints.constraint_language.util.plot_geometry(ax, geom, color='blue')[source]#
- Parameters:
ax
geom
color -- (default:
'blue')
- infinigen.core.constraints.constraint_language.util.sync_trimesh(scene, obj_name)[source]#
- Parameters:
scene (Scene)
obj_name (str)
- infinigen.core.constraints.constraint_language.util.translate(scene, a, translation)[source]#
- Parameters:
scene (Scene)
a (str)
translation
- infinigen.core.constraints.constraint_language.util.rotate(...)[source]#
- Parameters:
scene (Scene)
a (str)
axis
angle
- infinigen.core.constraints.constraint_language.util.set_location(scene, obj_name, location)[source]#
- Parameters:
scene (Scene)
obj_name (str)
location
Module contents#
Evaluator (.core.constraints.evaluator)#
Node Impl (.core.constraints.evaluator.node_impl)#
impl_bindings#
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.statenames_to_blnames(state, names)[source]#
- Parameters:
state
names
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.register_node_impl(node_cls)[source]#
- Parameters:
node_cls
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.generic_impl_interface(cons, state, child_vals)[source]#
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.constant_impl(cons, state, child_vals)[source]#
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.operator_impl(cons, state, child_vals)[source]#
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.center_stable_surface_impl(cons, state, child_vals)[source]#
- Parameters:
cons (center_stable_surface_dist)
state (State)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.accessibility_impl(...)[source]#
- Parameters:
cons (accessibility_cost)
state (State)
child_vals (dict)
use_collision_impl (bool) -- (default:
True)
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.min_distance_internal_impl(cons, state, child_vals)[source]#
- Parameters:
cons (min_distance_internal)
state (State)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.min_dist_2d_impl(cons, state, child_vals)[source]#
- Parameters:
cons (min_dist_2d)
state (State)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.focus_score_impl(cons, state, child_vals)[source]#
- Parameters:
cons (focus_score)
state (State)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.angle_alignment_impl(...)[source]#
- Parameters:
cons (angle_alignment_cost)
state (State)
child_vals (dict)
others_tags (set) -- (default:
None)
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.freespace_2d_impl(cons, state, child_vals)[source]#
- Parameters:
cons (freespace_2d)
state (State)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.rotational_asymmetry_impl(cons, state, child_vals)[source]#
- Parameters:
cons (rotational_asymmetry)
state (State)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.reflectional_asymmetry_impl(...)[source]#
- Parameters:
cons (reflectional_asymmetry)
state (State)
child_vals (dict)
use_long_plane (bool) -- (default:
True)
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.coplanarity_cost_impl(cons, state, child_vals)[source]#
- Parameters:
cons (coplanarity_cost)
state (State)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.tagged_impl(cons, state, child_vals)[source]#
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.count_impl(cons, state, child_vals)[source]#
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.in_range_impl(cons, state, child_vals)[source]#
- Parameters:
cons (related_to)
state (State)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.excludes_impl(cons, state, child_vals)[source]#
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.volume_impl(cons, state, child_vals)[source]#
- infinigen.core.constraints.evaluator.node_impl.impl_bindings.hinge_impl(cons, state, child_vals)[source]#
rooms#
- infinigen.core.constraints.evaluator.node_impl.rooms.separate_floors(state)[source]#
- Parameters:
state
- infinigen.core.constraints.evaluator.node_impl.rooms.reduce(x, reduce_fn)[source]#
- Parameters:
x
reduce_fn
- infinigen.core.constraints.evaluator.node_impl.rooms.access_angle_impl(cons, state, child_vals)[source]#
- Parameters:
cons (access_angle)
state (State)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.rooms.aspect_ratio_impl(cons, state, child_vals)[source]#
- Parameters:
cons (aspect_ratio)
state (State)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.rooms.convexity_impl(cons, state, child_vals)[source]#
- Parameters:
cons (shared_length)
state (<module 'infinigen.core.constraints.example_solver.state_def' from '/n/fs/pvl-renders/ar8564/docs_deploy_v2.0.0a1/src/infinigen/core/constraints/example_solver/state_def.py'>)
child_vals (dict)
- Parameters:
cons (shared_length)
state (<module 'infinigen.core.constraints.example_solver.state_def' from '/n/fs/pvl-renders/ar8564/docs_deploy_v2.0.0a1/src/infinigen/core/constraints/example_solver/state_def.py'>)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.rooms.grid_line_count_impl(cons, state, child_vals)[source]#
- Parameters:
cons (grid_line_count)
state (<module 'infinigen.core.constraints.example_solver.state_def' from '/n/fs/pvl-renders/ar8564/docs_deploy_v2.0.0a1/src/infinigen/core/constraints/example_solver/state_def.py'>)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.rooms.narrowness_impl(cons, state, child_vals)[source]#
- Parameters:
cons (narrowness)
state (<module 'infinigen.core.constraints.example_solver.state_def' from '/n/fs/pvl-renders/ar8564/docs_deploy_v2.0.0a1/src/infinigen/core/constraints/example_solver/state_def.py'>)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.rooms.intersection_impl(cons, state, child_vals)[source]#
- Parameters:
cons (intersection)
state (<module 'infinigen.core.constraints.example_solver.state_def' from '/n/fs/pvl-renders/ar8564/docs_deploy_v2.0.0a1/src/infinigen/core/constraints/example_solver/state_def.py'>)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.rooms.graph_coherent_impl(cons, state, child_vals)[source]#
- Parameters:
cons (graph_coherent)
state (<module 'infinigen.core.constraints.example_solver.state_def' from '/n/fs/pvl-renders/ar8564/docs_deploy_v2.0.0a1/src/infinigen/core/constraints/example_solver/state_def.py'>)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.rooms.same_level_impl(cons, state, child_vals)[source]#
- Parameters:
cons (same_level)
state (<module 'infinigen.core.constraints.example_solver.state_def' from '/n/fs/pvl-renders/ar8564/docs_deploy_v2.0.0a1/src/infinigen/core/constraints/example_solver/state_def.py'>)
child_vals (dict)
- infinigen.core.constraints.evaluator.node_impl.rooms.length_impl(cons, state, child_vals)[source]#
- Parameters:
cons (same_level)
state (<module 'infinigen.core.constraints.example_solver.state_def' from '/n/fs/pvl-renders/ar8564/docs_deploy_v2.0.0a1/src/infinigen/core/constraints/example_solver/state_def.py'>)
child_vals (dict)
symmetry#
- infinigen.core.constraints.evaluator.node_impl.symmetry.rotate_vector(vector, angle)[source]#
Rotate a 2D vector by a given angle.
- Parameters:
vector
angle
- infinigen.core.constraints.evaluator.node_impl.symmetry.compute_centroid(objects)[source]#
Compute the centroid of the provided objects.
- Parameters:
objects
- infinigen.core.constraints.evaluator.node_impl.symmetry.compute_location_asymmetry(objects, centroid)[source]#
Compute location asymmetry based on the described method.
- Parameters:
objects
centroid
- infinigen.core.constraints.evaluator.node_impl.symmetry.compute_orientation_asymmetry(objects, centroid)[source]#
Compute orientation asymmetry of objects.
- Parameters:
objects
centroid
- infinigen.core.constraints.evaluator.node_impl.symmetry.sort_objects_clockwise(objects, centroid)[source]#
- Parameters:
objects
centroid
- infinigen.core.constraints.evaluator.node_impl.symmetry.compute_total_rotation_asymmetry(a) float[source]#
Compute the total asymmetry.
- infinigen.core.constraints.evaluator.node_impl.symmetry.reflect_point(point, plane_point, plane_normal)[source]#
- Parameters:
point
plane_point
plane_normal
- infinigen.core.constraints.evaluator.node_impl.symmetry.reflect_quaternion(q, n)[source]#
- Parameters:
q
n
- infinigen.core.constraints.evaluator.node_impl.symmetry.reflect_axis_angle(axis_angle, n)[source]#
- Parameters:
axis_angle
n
- infinigen.core.constraints.evaluator.node_impl.symmetry.reflect(obj, plane_point, plane_normal)[source]#
- Parameters:
obj
plane_point
plane_normal
- infinigen.core.constraints.evaluator.node_impl.symmetry.distance(pos1, pos2)[source]#
- Parameters:
pos1
pos2
- infinigen.core.constraints.evaluator.node_impl.symmetry.angle_difference(orient1, orient2)[source]#
- Parameters:
orient1
orient2
- infinigen.core.constraints.evaluator.node_impl.symmetry.normalization_factor(objs)[source]#
- Parameters:
objs
trimesh_geometry#
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.get_cardinal_planes_bbox(vertices)[source]#
Get the mid dividing planes. Assumes vertices form a box
- Parameters:
vertices (ndarray)
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.get_axis(state, obj, tag=Subpart.Front)[source]#
- Parameters:
state (State)
obj (Object)
tag -- (default:
Subpart.Front)
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.preprocess_collision_query_cases(...)[source]#
- Parameters:
a
b
a_tags
b_tags
- class infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.ContactResult(hit: 'bool', names: 'list[str]', contacts: 'list')[source]#
Bases:
object
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.any_touching(...)[source]#
Computes one-to-one, many-to-one, one-to-many or many-to-many collisions
In all cases, returns True if any one object from a and b touch
- class infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.DistanceResult(
- dist: 'float',
- names: 'list[str]',
- data: 'trimesh.collision.DistanceData',
Bases:
object
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.min_dist(...)[source]#
Computes one-to-one, many-to-one, one-to-many or many-to-many distance
In all cases, returns the minimum distance between any object in a and b
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.contains(...) bool[source]#
Check if a contains b
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.contains_all(scene, a, b) bool[source]#
Check if all objects in list ‘a’ contain all objects in list ‘b’ within the given scene.
Parameters: - scene: The trimesh.Scene instance. - a: Name or list of names of objects to check for containment. - b: Name or list of names of objects that might be contained.
Returns: - True if all objects in list ‘a’ contain all objects in list ‘b’, False otherwise.
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.contains_any(scene, a, b) bool[source]#
Check if any object in list ‘a’ contains any object in list ‘b’ within the given scene.
Parameters: - scene: The trimesh.Scene instance. - a: Name or list of names of objects to check for containment. - b: Name or list of names of objects that might be contained.
Returns: - True if any object in list ‘a’ contains any object in list ‘b’, False otherwise.
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.has_line_of_sight(...) bool[source]#
Check if any object in list ‘a’ in the scene has a line of sight to any object in list ‘b’.
Parameters: - scene: The trimesh.Scene instance. - a: Name or list of names of objects from which line of sight is checked. - b: Name or list of names of objects to which line of sight is checked. - num_samples: Number of points to sample from each object for ray casting.
Returns: - True if any object in list ‘a’ has a line of sight to any object in list ‘b’, False otherwise.
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.freespace_2d(scene, a, b) float[source]#
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.rasterize_space_with_obstacles(...)[source]#
Rasterize the union of multiple space polygons while considering obstacle polygons, then find and visualize the shortest path from start to end.
Parameters: - space_polygons: list of shapely.geometry.polygon.Polygon objects representing the main spaces - obstacle_polygons: list of shapely.geometry.polygon.Polygon objects representing obstacles - start_location: tuple (x, y) representing the start location - end_location: tuple (x, y) representing the end location - cell_size: size of each cell in the grid - visualize: boolean, if True, visualize the union of spaces, obstacles, and the shortest path
Returns: - graph: A networkx.Graph object representing the rasterized union of spaces minus the obstacles - path: list of nodes representing the shortest path from start to end
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.angle_alignment_cost_tagged(...)[source]#
Return the dot product between the axes of a and the normal of the closest edge of b
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.angle_alignment_cost_base(...)[source]#
Return the dot product between the axes of a and the normal of the closest edge of b
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.focus_score(...)[source]#
The how much objects in a focus on b
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.edge(scene, surface_name)[source]#
- Parameters:
scene
surface_name (str)
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.min_dist_2d(...)[source]#
projects onto b and finds the min distance between a and b
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.min_dist_boundary(scene, a, boundary)[source]#
- exception infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.ConstraintViolated[source]#
Bases:
Exception
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.constraint_violated(message)[source]#
- Parameters:
message
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.constrain_contact(res, should_touch=True, max_depth=0.01)[source]#
- Parameters:
res (ContactResult)
should_touch -- (default:
True)max_depth -- (default:
0.01)
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.constrain_dist(res, min=None, max=None)[source]#
- Parameters:
res (dict)
min -- (default:
None)max -- (default:
None)
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.constrain_dist_soft(res, min=None, max=None)[source]#
- Parameters:
res (dict)
min -- (default:
None)max -- (default:
None)
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.touching_soft(scene, a, b)[source]#
- Parameters:
scene
a
b
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.dist_soft_score(res, min, max)[source]#
- Parameters:
res (dict)
min
max
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.accessibility_cost_cuboid_penetration(...)[source]#
Extrude the bbox of a by dist in the direction of normal_dir, and check for collisions with b Return the maximum distance that any part of b penetrates this extrusion
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.accessibility_cost(...)[source]#
Computes how much objs b block front access to a. b obj blockages are not summed. the closest b obj to a is taken as the representative blockage
- Parameters:
scene
a
b
normal
visualize -- (default:
False)fast -- (default:
True)
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.center_stable_surface(scene, a, state)[source]#
center a objects on their assigned surfaces.
- Parameters:
scene
a
state
- infinigen.core.constraints.evaluator.node_impl.trimesh_geometry.reflectional_asymmetry_score(...)[source]#
Computes the reflectional asymmetry score between a and b
Module contents#
domain_contains#
- infinigen.core.constraints.evaluator.domain_contains.domain_contains(dom, state, obj)[source]#
- Parameters:
dom (Domain)
state (State)
obj (ObjectState)
eval_memo#
- infinigen.core.constraints.evaluator.eval_memo.evict_memo_for_obj(node, memo, obj)[source]#
- Parameters:
node (Problem)
memo (dict)
obj (ObjectState)
evaluate#
indoor_util#
- infinigen.core.constraints.evaluator.indoor_util.meshes_from_names(scene, names)[source]#
- Parameters:
scene
names
- infinigen.core.constraints.evaluator.indoor_util.blender_objs_from_names(names)[source]#
- Parameters:
names
- infinigen.core.constraints.evaluator.indoor_util.name_from_mesh(scene, mesh)[source]#
- Parameters:
scene
mesh
- infinigen.core.constraints.evaluator.indoor_util.project_to_xy_path2d(mesh) trimesh.path.path.Path2D[source]#
- Parameters:
mesh (Trimesh)
- infinigen.core.constraints.evaluator.indoor_util.project_to_xy_poly(mesh)[source]#
- Parameters:
mesh (Trimesh)
- infinigen.core.constraints.evaluator.indoor_util.closest_edge_to_point(polygon, point)[source]#
- Parameters:
polygon
point
- infinigen.core.constraints.evaluator.indoor_util.compute_outward_normal(line, polygon)[source]#
- Parameters:
line
polygon
- infinigen.core.constraints.evaluator.indoor_util.get_transformed_axis(scene, obj_name)[source]#
- Parameters:
scene
obj_name
- infinigen.core.constraints.evaluator.indoor_util.get_plane_from_3dmatrix(matrix)[source]#
Extract the plane_normal and plane_origin from a transformation matrix.
- Parameters:
matrix
- infinigen.core.constraints.evaluator.indoor_util.project_points_onto_plane(points, plane_origin, plane_normal)[source]#
Project 3D points onto a plane.
- Parameters:
points
plane_origin
plane_normal
- infinigen.core.constraints.evaluator.indoor_util.to_2d_coordinates(points, plane_normal)[source]#
Convert 3D points to 2D using the plane defined by its normal.
- Parameters:
points
plane_normal
- infinigen.core.constraints.evaluator.indoor_util.ensure_correct_order(points)[source]#
Ensures the points are in counter-clockwise order. If not, it reverses them.
- Parameters:
points
- infinigen.core.constraints.evaluator.indoor_util.sample_random_point(polygon)[source]#
Sample a random point from inside the given Shapely polygon.
- Parameters:
polygon
- infinigen.core.constraints.evaluator.indoor_util.delete_obj(a, scene=None)[source]#
- Parameters:
a
scene -- (default:
None)
- infinigen.core.constraints.evaluator.indoor_util.is_planar(obj, tolerance=1e-06)[source]#
- Parameters:
obj
tolerance -- (default:
1e-06)
- infinigen.core.constraints.evaluator.indoor_util.planes_parallel(plane_obj_a, plane_obj_b, tolerance=1e-06)[source]#
- Parameters:
plane_obj_a
plane_obj_b
tolerance -- (default:
1e-06)
Module contents#
Example Solver (.core.constraints.example_solver)#
Geometry (.core.constraints.example_solver.geometry)#
dof#
- infinigen.core.constraints.example_solver.geometry.dof.stable_against_matrix(point, normal)[source]#
Given a point and normal defining a plane, return a 3x3 matrix that restricts movement perpendicular to the plane.
- Parameters:
point
normal
- infinigen.core.constraints.example_solver.geometry.dof.combined_stability_matrix(parent_planes)[source]#
Given a list of relations (each a tuple of point and normal), compute the combined 3x3 matrix M.
- Parameters:
parent_planes
- infinigen.core.constraints.example_solver.geometry.dof.rotation_constraint(normal)[source]#
Given a normal defining a plane, return the axis of rotation allowed by this constraint.
- Parameters:
normal
- infinigen.core.constraints.example_solver.geometry.dof.combine_rotation_constraints(parent_planes, eps=0.01)[source]#
Given a list of normals, compute the combined axis of rotation. If there are conflicting constraints, return None.
- Parameters:
parent_planes
eps -- (default:
0.01)
- infinigen.core.constraints.example_solver.geometry.dof.rotate_object_around_axis(...)[source]#
Rotate an object around a given axis.
- Parameters:
obj
axis
std
angle -- (default:
None)
- infinigen.core.constraints.example_solver.geometry.dof.check_init_valid(...)[source]#
Check that the plane assignments to the object is valid. First checks that the rotations can be satisfied, then checks that the translations can be satisfied. Returns a boolean indicating if the assignments are valid, the number of degrees of freedom remaining, and the translation vector if the assignments are valid.
- infinigen.core.constraints.example_solver.geometry.dof.project(points, plane_normal)[source]#
- Parameters:
points
plane_normal
- infinigen.core.constraints.example_solver.geometry.dof.apply_relations_surfacesample(state, name)[source]#
Apply the relation constraints to the object. Place it in the scene according to the constraints.
- infinigen.core.constraints.example_solver.geometry.dof.validate_relations_feasible(state, name) bool[source]#
- infinigen.core.constraints.example_solver.geometry.dof.try_apply_relation_constraints(...)[source]#
name is in objs.name name has been recently reassigned or added or swapped it needs snapping, and dof updates
Result: dof_mat and dof axis for name are updated objstate for name has update location rotaton etc
parse_scene#
- infinigen.core.constraints.example_solver.geometry.parse_scene.to_trimesh(obj)[source]#
- Parameters:
obj (Object)
- infinigen.core.constraints.example_solver.geometry.parse_scene.preprocess_obj(obj)[source]#
- Parameters:
obj
- infinigen.core.constraints.example_solver.geometry.parse_scene.preprocess_scene(objects)[source]#
- Parameters:
objects
planes#
- class infinigen.core.constraints.example_solver.geometry.planes.Planes[source]#
Bases:
object- get_all_planes_cached(obj, face_mask, tolerance=0.0001)[source]#
- Parameters:
obj
face_mask
tolerance -- (default:
0.0001)
- static hash_plane(normal, point, tolerance=0.0001)[source]#
- Parameters:
normal
point
tolerance -- (default:
0.0001)
- compute_all_planes_fast(obj, face_mask, tolerance=0.0001)[source]#
- Parameters:
obj
face_mask
tolerance -- (default:
0.0001)
- get_all_planes_deprecated(obj, face_mask, tolerance=0.0001) tuple[str, int][source]#
get all unique planes formed by faces in face_mask
- Parameters:
obj
face_mask
tolerance -- (default:
0.0001)
- get_tagged_planes(obj, tags, fast=True)[source]#
get all unique planes formed by faces tagged with tags
- Parameters:
obj (Object)
tags (set)
fast -- (default:
True)
stability#
- infinigen.core.constraints.example_solver.geometry.stability.project_and_align_z_with_x(polygons, z_direction)[source]#
Rotate polygons so that the Z-direction is aligned with the X-axis in 2D.
Parameters: polygons (list[Polygon]): List of Shapely Polygons representing the projected 2D polygons. z_direction (np.array): The 2D direction vector where the Z-axis is projected.
Returns: list[Polygon]: Rotated polygons with the Z-direction aligned with the X-axis.
- Parameters:
polygons
z_direction
- infinigen.core.constraints.example_solver.geometry.stability.is_vertically_contained(poly_a, poly_b)[source]#
Check if polygon A is vertically contained within polygon B, ignoring X-axis spillover.
Parameters: poly_a (Polygon): Polygon A. poly_b (Polygon): Polygon B.
Returns: bool: True if A is vertically contained within B.
- Parameters:
poly_a
poly_b
- infinigen.core.constraints.example_solver.geometry.stability.project_vector(vector, origin, normal)[source]#
- Parameters:
vector
origin
normal
- infinigen.core.constraints.example_solver.geometry.stability.stable_against(...)[source]#
check paralell, close to, and not overhanging.
- Parameters:
state (State)
obj_name (str)
relation_state (RelationState)
visualize -- (default:
False)allow_overhangs -- (default:
False)
- infinigen.core.constraints.example_solver.geometry.stability.coplanar(state, obj_name, relation_state)[source]#
check that the object’s tagged surface is coplanar with the target object’s tagged surface translated with margin.
- Parameters:
state (State)
obj_name (str)
relation_state (RelationState)
- infinigen.core.constraints.example_solver.geometry.stability.snap_against(...)[source]#
snap a against b with some margin.
- Parameters:
scene
a
b
a_plane
b_plane
margin -- (default:
0)rev_normal -- (default:
False)
- infinigen.core.constraints.example_solver.geometry.stability.random_sample_point(...) pf.Vector[source]#
Given a plane, return a random point on the plane.
validity#
- infinigen.core.constraints.example_solver.geometry.validity.check_pre_move_validity(...)[source]#
- Parameters:
scene
a
parent_dict
dx
dy
Greedy (.core.constraints.example_solver.greedy)#
active_for_stage#
- infinigen.core.constraints.example_solver.greedy.active_for_stage.find_ancestors_of_type(...) set[str][source]#
Find objkeys of all ancestors of objkey which match filter_type
Object A is a parent of objkey if there exists a sequence of objects A, B, C, …, objkey where A is in B’s relations, B is in C’s relations, etc, AND only A matches the filter
all_substitutions#
- infinigen.core.constraints.example_solver.greedy.all_substitutions.substitutions(...) Iterator[r.Domain][source]#
Find all t.Variable in d’s tags or relations, and return one Domain for each possible assignment
limits cuts off enumeration of each varname with some integer count
- infinigen.core.constraints.example_solver.greedy.all_substitutions.iterate_assignments(...) Iterator[dict[Variable, str]][source]#
Find all combinations of assignments for the listed vars.
Variables will be considered IN ORDER, IE first variable can affect options for second variable, but not the other way around.
- Parameters:
dom (r.Domain) -- The domain to substitute variables in
state (State) -- The state to substitute variables in
vars (list[str]) -- The names of the variables to substitute
limits (dict[str, int]) -- Consider only the first N objects for each variable
nonempty (bool) -- Raise an error if no substitutions are found
- Returns:
Iterator over dicts of variable assignments to domains
- Return type:
constraint_partition#
- infinigen.core.constraints.example_solver.greedy.constraint_partition.filter_constraints(
- ...,
Return a constraint graph representing the component of node that is relevant for to a particular greedy filter domain.
- Parameters:
node (cl.Node) -- The constraint program to partition
filter_dom (Domain) -- The domain which determines whether a constraint is relevant
var_assignments (Domain) -- Domains to substitute for any t.Variable(name: str) in the constraint program, typically used for recursive calls.
check_correctness -- (default:
True)
- Returns:
partitioned (cl.Node) -- The partitioned constraint program
relevant (bool) -- Was any part of the constraint program relevant?
Module contents#
Moves (.core.constraints.example_solver.moves)#
addition#
- infinigen.core.constraints.example_solver.moves.addition.sample_rand_placeholder(gen_class)[source]#
- Parameters:
gen_class (type[AssetFactory])
- class infinigen.core.constraints.example_solver.moves.addition.Addition(names, gen_class, relation_assignments, temp_force_tags, _new_obj=None)[source]#
Bases:
MoveMove which generates an object and adds it to the scene with certain relations
- Parameters:
deletion#
- class infinigen.core.constraints.example_solver.moves.deletion.Deletion(
- names: List[str],
- _backup_state: ObjectState = None,
Bases:
Move- Parameters:
_backup_state (ObjectState)
moves#
pose#
- class infinigen.core.constraints.example_solver.moves.pose.TranslateMove(names: List[str], translation: <built-in function array>, _backup_pose: dict = None)[source]#
Bases:
Move
reassignment#
- infinigen.core.constraints.example_solver.moves.reassignment.pose_backup(os, dof=True)[source]#
- Parameters:
os (ObjectState)
dof -- (default:
True)
- infinigen.core.constraints.example_solver.moves.reassignment.restore_pose_backup(state, name, bak)[source]#
- Parameters:
state
name
bak
- class infinigen.core.constraints.example_solver.moves.reassignment.RelationPlaneChange(names: List[str], relation_idx: int, plane_idx: int)[source]#
Bases:
Move
swap#
Module contents#
Room (.core.constraints.example_solver.room)#
base#
- class infinigen.core.constraints.example_solver.room.base.RoomGraph(children, names, entrance=None)[source]#
Bases:
object- property is_planar#
- property to_nx#
- property cycle_basis#
- property neighbours#
- property valid_neighbours#
- property valid_ns#
- property entrance#
- property root#
contour#
decorate#
- infinigen.core.constraints.example_solver.room.decorate.split_rooms(rooms_meshed)[source]#
- Parameters:
rooms_meshed (list[Object])
- infinigen.core.constraints.example_solver.room.decorate.import_material(factory_name)[source]#
- Parameters:
factory_name
- infinigen.core.constraints.example_solver.room.decorate.room_walls(walls, constants, n_walls=3)[source]#
- Parameters:
walls (list[Object])
constants (RoomConstants)
n_walls -- (default:
3)
- infinigen.core.constraints.example_solver.room.decorate.room_ceilings(ceilings)[source]#
- Parameters:
ceilings
- infinigen.core.constraints.example_solver.room.decorate.room_floors(floors, n_floors=3)[source]#
- Parameters:
floors
n_floors -- (default:
3)
- infinigen.core.constraints.example_solver.room.decorate.populate_doors(...)[source]#
- Parameters:
placeholders (list[Object])
constants (RoomConstants)
n_doors -- (default:
3)door_chance -- (default:
1)casing_chance -- (default:
0.0)all_open -- (default:
False)
- infinigen.core.constraints.example_solver.room.decorate.room_stairs(constants, state, rooms_meshed)[source]#
- Parameters:
constants
state
rooms_meshed
- infinigen.core.constraints.example_solver.room.decorate.room_pillars(walls, constants)[source]#
- Parameters:
walls (list[Object])
constants (RoomConstants)
floor_plan#
graph#
predefined#
- class infinigen.core.constraints.example_solver.room.predefined.PredefinedBlueprintSolidifier(consgraph, config, level)[source]#
Bases:
BlueprintSolidifier
segment#
- class infinigen.core.constraints.example_solver.room.segment.SegmentMaker(factory_seed, constants, consgraph, contour, graph, level)[source]#
Bases:
object- Parameters:
constants (RoomConstants)
graph (RoomGraph)
solidifier#
- infinigen.core.constraints.example_solver.room.solidifier.split_mls(mls, min_length=-inf)[source]#
- Parameters:
mls
min_length -- (default:
-inf)
- class infinigen.core.constraints.example_solver.room.solidifier.BlueprintSolidifier(consgraph, graph, level, enable_open=True)[source]#
Bases:
object- Parameters:
graph (RoomGraph)
solver#
- class infinigen.core.constraints.example_solver.room.solver.FloorPlanMoves(constants)[source]#
Bases:
object- Parameters:
constants (RoomConstants)
utils#
- infinigen.core.constraints.example_solver.room.utils.update_contour(state_, state, indices)[source]#
- Parameters:
s
t
Module contents#
annealing#
- class infinigen.core.constraints.example_solver.annealing.SimulatedAnnealingSolver(
- max_invalid_candidates,
- initial_temp,
- final_temp,
- finetune_pct,
- checkpoint_best=False,
- output_folder=None,
- visualize=False,
- print_report_freq=1,
- print_breakdown_freq=0,
Bases:
object- validate_lazy_eval(...)[source]#
- Parameters:
state (State)
consgraph (Problem)
prop_result (EvalResult)
filter_domain (Domain)
- retry_attempt_proposals(
- ...,
- metrop_hastings_with_viol(prop_result, temp)[source]#
- Parameters:
prop_result (EvalResult)
temp (float)
populate#
propose_continous#
- infinigen.core.constraints.example_solver.propose_continous.propose_translate(
- ...,
- infinigen.core.constraints.example_solver.propose_continous.propose_rotate(
- ...,
- infinigen.core.constraints.example_solver.propose_continous.propose_reinit_pose(
- ...,
propose_discrete#
- class infinigen.core.constraints.example_solver.propose_discrete.DummyCubeGenerator(seed)[source]#
Bases:
AssetFactory
- infinigen.core.constraints.example_solver.propose_discrete.propose_addition_bound_gen(...)[source]#
Try to propose any addition move involving the specified bound and generator
- infinigen.core.constraints.example_solver.propose_discrete.active_for_stage(prop_dom, filter_dom)[source]#
- infinigen.core.constraints.example_solver.propose_discrete.propose_relation_plane_change(...)[source]#
propose_relations#
- infinigen.core.constraints.example_solver.propose_relations.minimize_redundant_relations(relations)[source]#
Given a list of relations that must be true, use the first as a constraint to tighten the remaining relations
- infinigen.core.constraints.example_solver.propose_relations.find_assignments(
- curr,
- relations,
- assignments=None,
Iterate over possible assignments that satisfy the given relations. Some assignments may not be feasible geometrically - a naive implementation of this function would just enumerate all possible objects matching the assignments, and let the solver discover that many combinations are impossible. This implementation attemps to never generate guaranteed-invalid combinations in the first place.
Complexity is pretty astronomical: - N^M where N is number of candidates per relation, and M is number of relations - reduced somewhat when relations intersect or imply eachother - luckily, M is typically 1, 2 or 3, as objects arent often related to lots of other objects
TODO: - discover new relations constraints, which can arise from the particular choice of objects - prune early when object choice causes bounds to be violated
This function essentially does a complex form of SAT-solving. It really shouldnt be written in python
solve#
- infinigen.core.constraints.example_solver.solve.map_range(...)[source]#
- Parameters:
x
xmin
xmax
ymin
ymax
exp -- (default:
1)
- class infinigen.core.constraints.example_solver.solve.LinearDecaySchedule(start, end, pct_duration)[source]#
Bases:
object
state_def#
- class infinigen.core.constraints.example_solver.state_def.RelationState(
- relation: 'cl.Relation',
- target_name: 'str',
- child_plane_idx: 'int' = None,
- parent_plane_idx: 'int' = None,
- value: 'typing.Optional[shapely.MultiLineString]' = None,
Bases:
object- Parameters:
- class infinigen.core.constraints.example_solver.state_def.ObjectState(
- obj: 'bpy.types.Object' = None,
- polygon: 'shapely.Polygon' = None,
- generator: 'typing.Optional[AssetFactory]' = None,
- tags: 'set' = <factory>,
- relations: 'list[RelationState]' = <factory>,
- dof_matrix_translation: 'np.array' = None,
- dof_rotation_axis: 'np.array' = None,
- active: 'bool' = True,
Bases:
object- Parameters:
obj (Object)
polygon (Polygon)
generator (AssetFactory | None)
tags (set)
relations (list[RelationState])
dof_matrix_translation (array)
dof_rotation_axis (array)
active (bool)
- obj: Object = None#
- polygon: Polygon = None#
- generator: AssetFactory | None = None#
- dof_matrix_translation: array = None#
- dof_rotation_axis: array = None#
- fcl_obj = None#
- col_obj = None#
- class infinigen.core.constraints.example_solver.state_def.State(
- objs: 'OrderedDict[str,
- ObjectState]'=<factory>,
- trimesh_scene: 'trimesh.Scene' = None,
- graphs: 'list[RoomGraph]' = <factory>,
- bvh_cache: 'dict' = <factory>,
- planes: 'Planes' = None,
Bases:
object- Parameters:
objs (OrderedDict[str, ObjectState])
trimesh_scene (Scene)
bvh_cache (dict)
planes (Planes)
- trimesh_scene: Scene = None#
Module contents#
Reasoning (.core.constraints.reasoning)#
constraint_bounding#
- infinigen.core.constraints.reasoning.constraint_bounding.evaluate_known_vars(
- node,
- known_vars,
- Parameters:
node (Node)
known_vars
- infinigen.core.constraints.reasoning.constraint_bounding.expression_map_bound(
- node,
- bound,
constraint_constancy#
constraint_domain#
- infinigen.core.constraints.reasoning.constraint_domain.constraint_domain(node, finalize_variables=False) Domain[source]#
Given an expression, find a compact representation of what types of objects it is applying to.
User can compared the resulting Domain against their State and see what objects fit.
- Parameters:
node (ObjectSetExpression)
finalize_variables -- (default:
False)
- class infinigen.core.constraints.reasoning.constraint_domain.FilterByDomain(objs, filter)[source]#
Bases:
ObjectSetExpressionConstraint node which says to return all objects matching a domain.
Used as a compacted representation of the filtering performed many cl.tagged and cl.related_to calls. One r.Domain is sufficient to represent the effect of and combination of intersection-style filtering.
Introduced (currently) only by greedy.filter_constraints, since that function needs to work with domains in order to narrow the scope of some constraints.
- Parameters:
objs (ObjectSetExpression)
filter (Domain)
domain#
- infinigen.core.constraints.reasoning.domain.reldom_implies(a, b)[source]#
If relation a is satisfied, is relation guaranteed to be satisfied?
- infinigen.core.constraints.reasoning.domain.reldom_compatible(a, b)[source]#
If relation a is satisfied, can relation b be satisfied?
- infinigen.core.constraints.reasoning.domain.domain_finalized(dom, check_anyrel=False, check_variable=True)[source]#
- Parameters:
dom (Domain)
check_anyrel -- (default:
False)check_variable -- (default:
True)
- class infinigen.core.constraints.reasoning.domain.Domain(tags=<factory>, relations=<factory>)[source]#
Bases:
objectDescribes a class of object in the scene
Objects are in the domain if: - Some part of the object is tagged with each of ‘tags’ - It is related to an object matching each Domain in relations
WARNING: Recurive datastructure, here be dragons
Note: Default-constructed Domain contains Everything
- repr(abbrv=False, onelevel=False, oneline=False)[source]#
- Parameters:
abbrv -- (default:
False)onelevel -- (default:
False)oneline -- (default:
False)
- add_relation(new_rel, new_dom, optimize_check_implies=True)[source]#
new_rel, new_dom: the relation and domain to be added
optimize_check_implies: if enabled, dont add relations (aka predicates) that are already provably true based on existing predicates. This should not be necessary for correctness: object addition should check if relation constraints are satisfied/implied before adding more. But it may (?) help speed, and the unit tests assume it is enabled for the most part
- satisfies(other)[source]#
Assumes that ‘self’ is fully specified: any predicates that arent listed are false.
Different from ‘implies’ in that if other contains negative predicates, self need not imply these, it just needs to not contradict them.
Different from ‘intersects’ in that
- Parameters:
other (Domain)
- intersects(other, require_satisfies_left=False, require_satisfies_right=False)[source]#
Return True if self and other could have a non-empty intersection.
- Parameters:
self (Domain - the domain to check)
other (Domain - the domain to check against)
require_satisfies_left (bool -) -- If True, assume that self is exhaustively specified (ie, any predicates not listed are false), and therefore other must imply self for the intersection to be non-empty.
require_satisfies_right (bool -) -- If True, assume that other is exhaustively specified (ie, any predicates not listed are false), and therefore self must imply other for the intersection to be non-empty.
- intersection(other)[source]#
Return a domain representing the intersection of self and other. Result is at least as strict as self and other.
contains(self, x) and contains(other, x) -> contains(intersection, x)
TODO:
- does order relations are checked for intersection matter? - almost certainly yes, intersection is not transitive. - so what order is best? fewest remaining relations? does it matter?
- Parameters:
other (Domain)
domain_substitute#
expr_equal#
- infinigen.core.constraints.reasoning.expr_equal.expr_equal(
- n1,
- n2,
- name=None,
An equality comparison operator for constraint Node expressions
Using the default Node == Node is unsafe since Nodes override == in order to return another expression
Module contents#
checks#
- infinigen.core.constraints.checks.iter_domains(node) Iterator[r.Domain][source]#
- Parameters:
node (Node)
- infinigen.core.constraints.checks.check_unfinalized_constraints(prob)[source]#
- Parameters:
prob (Problem)
- infinigen.core.constraints.checks.check_contradictory_domains(prob)[source]#
- Parameters:
prob (Problem)