Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f8b2893eaa | |||
| 09f2f79ca3 | |||
|
|
86b123685e | ||
|
|
efab6f655d | ||
|
|
555b6124fa | ||
|
|
7cb7d0993b | ||
|
|
677c98297a | ||
| 1f76f4da44 | |||
|
|
11764eb0a5 | ||
|
|
351918a8a2 | ||
| 270da6998b | |||
|
|
679062ca9a | ||
|
|
ea7759344d | ||
|
|
cf268b6788 | ||
|
|
40232be787 | ||
|
|
f91df3253e | ||
|
|
0c0193a171 | ||
| 845b6336ac | |||
|
|
2d4943804c | ||
|
|
a25cec6f27 | ||
|
|
08896d8565 | ||
|
|
3acd7faddb | ||
|
|
ed2ed9eeb8 | ||
|
|
2ef289e76b | ||
|
|
1be1bfc1e6 | ||
| 24a67302be | |||
|
|
21f783b37c | ||
|
|
56730c0c87 | ||
|
|
76a425c0d2 | ||
|
|
c430a6e464 | ||
|
|
5dee3c685a | ||
|
|
1b6de62253 | ||
|
|
e98b6a4da1 | ||
|
|
8b702c537e | ||
|
|
29566492b5 | ||
|
|
fcf09bfae2 | ||
|
|
3bf5d73658 | ||
|
|
53eac397c7 | ||
|
|
198b79590e | ||
|
|
4779e6cc5c | ||
| 396f4283d9 | |||
| ad615a4f03 | |||
|
|
a570eb8478 | ||
|
|
643dc599ab | ||
|
|
5de5c3b5b1 | ||
|
|
e41d51282c | ||
|
|
ba5672b47f | ||
|
|
2ffb3b6460 | ||
|
|
9815bad8d1 | ||
|
|
18adf73a27 | ||
|
|
3b56cdec6e | ||
|
|
404849a30e | ||
|
|
c4ac06c2dd | ||
|
|
7282c02d44 | ||
|
|
d94dace75f | ||
|
|
fd1f4ed2c2 | ||
|
|
3c1344d776 | ||
|
|
2be27f0c0c | ||
|
|
6034831288 | ||
|
|
fa64f43a35 |
38 changed files with 9464 additions and 318 deletions
|
|
@ -29,7 +29,7 @@
|
|||
{"name": "targetObjectName", "type": "string", "required": true, "doc": "the object's name"},
|
||||
{"name": "visible", "type": "boolean", "default": true}
|
||||
]},
|
||||
{"name": "setObjectParent", "doc": "Parent an object to another.", "changesScene": true, "editModeSafe": false, "fields": [
|
||||
{"name": "setObjectParent", "doc": "Parent an object to another. Refused, with nothing changed, when an enabled add-on that defines brokkr_parent_refusal(object, parent) answers a reason, which is the message: brokkr_kitbash refuses a parent that would give a loop that follows a second driver, and any parent of a part such a loop hangs from while the loop already has one (both drivers are named; hold the joint, make it follow the driver, or clear the loop first). An object no loop hangs from is not refused.", "changesScene": true, "editModeSafe": false, "fields": [
|
||||
{"name": "targetObjectName", "type": "string", "required": true, "doc": "the object's name"},
|
||||
{"name": "parentObjectName", "type": "string", "doc": "empty or absent clears the parent"}
|
||||
]},
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ HOST_SNAPSHOT_SCHEMA = "brokkr.blender.host_snapshot.v0"
|
|||
HOST_ACTIONS_FILE = "brokkr_actions.json"
|
||||
HOST_RESULT_LIMIT = 16000 # characters of a host operator's result copied into a receipt
|
||||
KIT_RESERVED = "kit_" # brokkr_kitbash owns every custom property so named: kit_owned is the one test, setObjectCustomProperty refuses them and importGltf drops them
|
||||
PARENT_REFUSAL = "brokkr_parent_refusal" # a function(object, parent or None) -> why not, or None, that an enabled add-on may define: setObjectParent asks each before it writes (brokkr_kitbash: its one-driver rule)
|
||||
KIT_FROZEN = "kit_frozen" # brokkr_kitbash's frozen state (its FROZEN): read here only, to refuse an export that would apply a stack twice
|
||||
COMMAND_INTENT_SCHEMA = "brokkr.blender.command_intent.v0"
|
||||
COMMAND_RECEIPT_SCHEMA = "brokkr.blender.command_receipt.v0"
|
||||
|
|
@ -934,6 +935,11 @@ class BrokkrBlenderTarget:
|
|||
if ancestor.name == obj.name:
|
||||
raise sa.ActionRefused(f"{obj.name!r} cannot be parented to itself or to one of its own children.")
|
||||
ancestor = getattr(ancestor, "parent", None)
|
||||
for module in self.bpy.context.preferences.addons.keys(): # an enabled add-on that owns a rule over parents is asked before the write
|
||||
refusal = getattr(sys.modules.get(module), PARENT_REFUSAL, None)
|
||||
reason = refusal(obj, parent) if callable(refusal) else None
|
||||
if reason:
|
||||
raise sa.ActionRefused(reason)
|
||||
|
||||
obj.parent = parent
|
||||
return self._receipt(command, "accepted", "Blender object parent updated.", obj.name)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -109,7 +109,7 @@
|
|||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.attach",
|
||||
"doc": "Seat a socket of a kit part on a socket of a part of any kit whose socket types agree and parent it there: origins together, normals opposed. Refuses sockets of different types or sizes that do not match, an occupied socket, a child that has a parent, and a loop. The connection's DOF is its parent socket's type's (revolute, prismatic or rigid); it starts with no joint record: brokkr_kitbash.joint states one. Reports the child with its connection.",
|
||||
"doc": "Seat a socket of a kit part on a socket of a part of any kit whose socket types agree and parent it there: origins together, normals opposed. Refuses sockets of different types or sizes that do not match, an occupied socket, a child that has a parent, a loop, and a new pin or slide between the two ends of a loop that follows (a second driver: both are named; hold it or clear the loop first). The connection's DOF is its parent socket's type's (revolute, prismatic or rigid); it starts with no joint record: brokkr_kitbash.joint states one. Reports the child with its connection.",
|
||||
"changesScene": true,
|
||||
"editModeSafe": false,
|
||||
"result": "brokkr_mesh_polish_result",
|
||||
|
|
@ -160,7 +160,7 @@
|
|||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.detach",
|
||||
"doc": "Clear a kit part's connection and the closure it states: it keeps its place in the world and loses its parent; parts attached to it stay attached to it.",
|
||||
"doc": "Clear a kit part's connection and the closure it states: it keeps its place in the world and loses its parent; parts attached to it stay attached to it. A loop follower's partner stops following with it. Refused, with nothing changed, when it would leave a loop that follows with a second driver: a part between one end of the loop and the part both ends hang from, whose going leaves a joint with travel between the ends (both drivers are named).",
|
||||
"changesScene": true,
|
||||
"editModeSafe": false,
|
||||
"result": "brokkr_mesh_polish_result",
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.roll",
|
||||
"doc": "Turn an attached kit part to a roll about its parent socket's normal, in place: its parent and both sockets stay, and what is attached to it follows. Refuses a part that is not attached and, on a revolute joint with limits, a roll with no turn of itself inside them (the roll written is the one inside). Reports the part and closures, every closure in the scene as {part, to, holds}, its own first: a roll can open one and never seats one.",
|
||||
"doc": "Turn an attached kit part to a roll about its parent socket's normal, in place: its parent and both sockets stay, and what is attached to it follows. Refuses a part that is not attached and, on a revolute joint with limits, a roll with no turn of itself inside them (the roll written is the one inside). Refused on a follower (a part whose connection states follows), naming its driver: its value is derived. On a driver, every follower moves with it in the same action, and a follower outside its own limits or a loop that cannot close refuses the pose with nothing changed; the report's followers lists each as {part, value}. Reports the part and closures, every closure in the scene as {part, to, holds}, its own first: a roll can open one and seats none but those of the loops that follow the part.",
|
||||
"changesScene": true,
|
||||
"editModeSafe": false,
|
||||
"result": "brokkr_mesh_polish_result",
|
||||
|
|
@ -201,7 +201,7 @@
|
|||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.aim",
|
||||
"doc": "Turn an attached kit part about its pin until one of its own axes points as near a world direction as the pin lets it. The roll is solved exactly, not searched. On a revolute joint with limits the roll stays inside them: where the free roll is outside, the end of the limits that points the axis nearer. Refuses an axis or a direction that lies along the pin (within about 0.06 degrees), and a zero direction. Reports the part, aimed: {roll, dot} (dot 1 when the axis reaches the direction) and closures as roll does.",
|
||||
"doc": "Turn an attached kit part about its pin until one of its own axes points as near a world direction as the pin lets it. The roll is solved exactly, not searched. On a revolute joint with limits the roll stays inside them: where the free roll is outside, the end of the limits that points the axis nearer. Refuses an axis or a direction that lies along the pin (within about 0.06 degrees), and a zero direction. Refused on a follower, and moves a driver's followers, as roll does. Reports the part, aimed: {roll, dot} (dot 1 when the axis reaches the direction) and closures as roll does.",
|
||||
"changesScene": true,
|
||||
"editModeSafe": false,
|
||||
"result": "brokkr_mesh_polish_result",
|
||||
|
|
@ -254,7 +254,7 @@
|
|||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.reach",
|
||||
"doc": "Turn an attached kit part about its pin until one of its sockets' origins stands at a height along a world direction (by default world z): of the two rolls that do it, the one nearer the roll it has. Solved exactly. On a revolute joint with limits only a roll inside them is taken; with neither inside it refuses, naming both rolls and the limits. Refuses a height the socket cannot reach, naming the range it can (either end of the range is taken), and a socket that lies on the pin. Reports the part, reached: {roll, residual} and closures as roll does.",
|
||||
"doc": "Turn an attached kit part about its pin until one of its sockets' origins stands at a height along a world direction (by default world z): of the two rolls that do it, the one nearer the roll it has. Solved exactly. On a revolute joint with limits only a roll inside them is taken; with neither inside it refuses, naming both rolls and the limits. Refuses a height the socket cannot reach, naming the range it can (either end of the range is taken), and a socket that lies on the pin. Reports the part, reached: {roll, residual} and closures as roll does. Refused on a follower, and moves a driver's followers, as roll does.",
|
||||
"changesScene": true,
|
||||
"editModeSafe": false,
|
||||
"result": "brokkr_mesh_polish_result",
|
||||
|
|
@ -310,7 +310,7 @@
|
|||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.joint",
|
||||
"doc": "State the joint record of an attached kit part's connection. The connection's DOF is its parent socket's type's: revolute (its value is the roll, degrees) or prismatic (the slide, metres). record is a JSON object of any of limits ([lo, hi] or null), mechanism (a label of 1 to 32 a-z, 0-9 and _, or null) and compliance ({\"hertz\": over 0 to 30, \"damping_ratio\": 0 to 2} or null: a slide in the load path that settles under load, a record for a runtime, solved by nothing here); a key left out keeps what is stated and null clears it. Refuses a rigid connection naming its socket type, limits that do not hold the value the joint has, revolute limits spanning over 360 degrees or with an end past 360, prismatic limits with an end past 10 m, and compliance on a revolute joint or without limits. Moves nothing but a roll to its turn inside the limits. Reports the part and closures as roll does.",
|
||||
"doc": "State the joint record of an attached kit part's connection. The connection's DOF is its parent socket's type's: revolute (its value is the roll, degrees) or prismatic (the slide, metres). record is a JSON object of any of limits ([lo, hi] or null), mechanism (a label of 1 to 32 a-z, 0-9 and _, or null) and compliance ({\"hertz\": over 0 to 30, \"damping_ratio\": 0 to 2} or null: a slide in the load path that settles under load, a record for a runtime, solved by nothing here); a key left out keeps what is stated and null clears it. Refuses a rigid connection naming its socket type, limits that do not hold the value the joint has, revolute limits spanning over 360 degrees or with an end past 360, prismatic limits with an end past 10 m, and compliance on a revolute joint or without limits. Moves nothing but a roll to its turn inside the limits: a follower keeps its derived value (limits that do not hold it are refused), and a driver's followers are derived again where it stands. Limits cannot be cleared from a driver a ratio follows, nor widened or cleared on a pin that limits of one value hold between the two ends of a loop that follows (it would be a second driver: both are named). Reports the part and closures as roll does.",
|
||||
"changesScene": true,
|
||||
"editModeSafe": false,
|
||||
"result": "brokkr_mesh_polish_result",
|
||||
|
|
@ -335,7 +335,7 @@
|
|||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.slide",
|
||||
"doc": "Slide an attached kit part along its parent socket's normal, in place, on a prismatic connection (a ram_rod in a ram_barrel's bore: slide 0 is closed, the slide is the extension): its parent and both sockets stay, and what is attached to it follows. Refuses a revolute or rigid connection naming its socket type, and a slide outside the joint's limits. Reports the part and closures as roll does.",
|
||||
"doc": "Slide an attached kit part along its parent socket's normal, in place, on a prismatic connection (a ram_rod in a ram_barrel's bore: slide 0 is closed, the slide is the extension): its parent and both sockets stay, and what is attached to it follows. Refuses a revolute or rigid connection naming its socket type, and a slide outside the joint's limits. Reports the part and closures as roll does. Refused on a follower, and moves a driver's followers, as roll does.",
|
||||
"changesScene": true,
|
||||
"editModeSafe": false,
|
||||
"result": "brokkr_mesh_polish_result",
|
||||
|
|
@ -360,7 +360,7 @@
|
|||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.joints",
|
||||
"doc": "The joints of the tree of kit parts attached under a root part, as {schema: brokkr.joints, version: 1, root, frame, rigid, joints}. A row per revolute or prismatic connection, depth first with children by name, so a joint's parent row comes before it: id (the child object), parent (the id of the nearest joint above, or null: rigid connections fold into it and are counted in rigid), part, socket ('Object:socket', the parent socket), kind, axis and origin (that socket's z and origin in the root object's frame: Blender axes, +Z up, metres), value (the roll in degrees or the slide in metres now), limits ([lo, hi] or null), min and max (the limits less the value: the travel either way from this pose), mechanism and compliance. Axis, origin and order are derived at each report from the kits and the parent tree; nothing stores them. Rows a receipt cannot carry are counted in jointsOmitted. Refuses a connection that cannot be read. Evaluates no modifier.",
|
||||
"doc": "The joints of the tree of kit parts attached under a root part, as {schema: brokkr.joints, version: 2, root, frame, rigid, unlimited, manyDrivers, next, joints}. A row per revolute or prismatic connection, depth first with children by name, so a joint's parent row comes before it; a root that itself states a revolute or prismatic connection has its own row first, parent null: id (the child object), parent (the id of the nearest joint above, or null: rigid connections fold into it and are counted in rigid), part, socket ('Object:socket', the parent socket), kind, axis and origin (that socket's z and origin in the root object's frame: Blender axes, +Z up, metres), value (the roll in degrees or the slide in metres now), limits ([lo, hi] or null), min and max (the limits less the value: the travel either way from this pose), held (true when the limits are of one value: the joint has no travel, as a torque link's lug held at [90, 90], so a rig makes a fixed bone and not a DOF; such a row is in neither unlimited nor rigid), mechanism, compliance and driven (null, or {by: the driver's id, kind: ratio | loop, k, offset}: the value is derived from the driver's, so a rig makes a driven bone and not a DOF). kind is revolute or prismatic: Aetheria's ShipJoint calls them rotate and slide, one to one. unlimited lists the ids of the rows this report carries that are not driven and state no limits: an exporter that needs limits refuses by this one field of each report. manyDrivers lists each loop with more than one driver that has a part in the tree (a limit widened by hand, a saved file: no action writes one), as {loop: the closing part, drivers: [the loop's driver, each other one]}: its driven rows are not a function of one driver, so a rig refuses the tree while the list is not empty; it is of the whole tree and every page carries it. Axis, origin and order are derived at each report from the kits and the parent tree; nothing stores them. Rows a receipt cannot carry are counted in jointsOmitted, and next is then the id of the last row carried (else null): call again with after set to it for the rows that follow and their unlimited ids; a report is never over a receipt and always carries a row. after refuses an id that is no row's. Refuses a connection that cannot be read. Evaluates no modifier.",
|
||||
"changesScene": false,
|
||||
"editModeSafe": true,
|
||||
"result": "brokkr_mesh_polish_result",
|
||||
|
|
@ -372,6 +372,38 @@
|
|||
"minLength": 1,
|
||||
"maxLength": 63,
|
||||
"doc": "the root: a kit part"
|
||||
},
|
||||
{
|
||||
"name": "after",
|
||||
"type": "string",
|
||||
"maxLength": 63,
|
||||
"default": "",
|
||||
"doc": "empty, or the next of the report before: the rows after that id"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.follow",
|
||||
"doc": "State that an attached kit part's joint follows another's: its roll or slide is then derived from the driver's whenever the driver is posed, and roll, aim, reach and slide on it are refused. record is JSON. {\"driver\": name, \"kind\": \"ratio\", \"k\": number, \"offset\": number}: the value is k x the driver's value + offset (a kneecap at k 0.5, a pinion at minus ring over pinion, a crosshead's slide in metres per degree of a roll); the driver states limits, so its value is one number. {\"driver\": name, \"kind\": \"loop\"}: object_name is a part that states a closure that holds; its joint and its parent's are the two unknowns solved so the closure keeps holding (a rocker and coupler closing on a crank; a ram's barrel and rod closing on the part it pushes; a torque link's two arms), and both follow the driver. Exactly one end of the loop, the parent's parent or the part closed on, moves with the driver: it is the driver, follows it, or hangs from one that does. The driver is the one input the two ends depend on: every revolute or prismatic joint between an end and the part both ends hang from is the driver, follows it, or is held by limits of one value (a torque link's lug on its rod: limits [90, 90]). The loop is planar: its pins are parallel. null clears the statement, and a loop partner's with it; it is refused for a follower between the two ends of another loop, which it would leave with a second driver. The one-driver rule is read again before every write of a connection and before detach, so no later attach, detach, clear, limits or pose breaks it. The follower moves at once and the report's followers lists every follower of the driver as {part, value}. Refuses, with nothing changed: a rigid connection; a driver that is the follower, below it, or itself a follower; a follower that already follows or that drives another; a ratio whose driver states no limits; a value outside the follower's own limits; a loop with no closure that holds, with both ends or neither moving with the driver, whose ends depend on more than one driver (another driver's follower, or a joint with travel that follows nothing: both are named), that is not planar, or at or past a dead centre (its two joints in line, a ram's rod end on its barrel's pin, or a step that would take the pair to its other assembly). Nothing stores a pin or a linkage: a loop is solved from the kits' socket frames each time, and no Blender driver or constraint is made.",
|
||||
"changesScene": true,
|
||||
"editModeSafe": false,
|
||||
"result": "brokkr_mesh_polish_result",
|
||||
"fields": [
|
||||
{
|
||||
"name": "object_name",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"minLength": 1,
|
||||
"maxLength": 63,
|
||||
"doc": "the follower: a part attached on a revolute or prismatic socket; for a loop, the part that states the closure"
|
||||
},
|
||||
{
|
||||
"name": "record",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"minLength": 4,
|
||||
"maxLength": 400,
|
||||
"doc": "{driver, kind: ratio, k, offset}, {driver, kind: loop}, or null"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -969,6 +1001,56 @@
|
|||
"default": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.plates",
|
||||
"doc": "Write a table of hard armour plates into the scene. table is a brokkr.plates.v0 document as JSON (docs/kitbash.md, Hard plates): {\"schema\": \"brokkr.plates.v0\", \"plates\": [row, ...]}, each row a convex faceted solid with optional clad (raised panels and their bolts) and fits (anchors on its face, and fittings: parts of the fittings kit, rim bolts and steps). The table's coordinates are metres in frame: a JSON 4x4 of rows in the world, rigid; empty, the host's world matrix, or the world with no host. side 1 builds the table as written and -1 mirrored across its x = 0. Each built plate is a mesh object named prefix + its name (.R and .L on a two-sided row), every face flat, parented to host under an identity parent inverse, with material mat, a Kit Bevel of the row's bevel (angle 12 degrees) and the properties plate_kind \"hard\" and kit_plate (its checked row, a record). Its panels are the child <plate>.fit.<clad mat>, its bolts <plate>.fit.<clad bolt_mat> and each fitting <plate>.fit.<the fit's mat>, one mesh per material, made only when not empty; a child that holds panels carries a Kit Bevel of clad.bevel (angle 20 degrees, one segment). Each anchor is an empty child at the anchor's frame: <plate>.mark.<id> with kit_anchor {kind, id, height}, <plate>.port.<name> with kit_anchor {kind, name}; brokkr_kitbash.hose takes a port empty's name as an end and leaves along its z. An object that carries kit_plate under a made name is rebuilt in place: it keeps its identity, its other children and its modifiers; its fit children are rewritten, made or removed, its anchors moved, and one the row no longer names removed. A plate is no kit part: joints and report do not list it, and a roll of its host carries it. Every material must exist (createMaterial). Refuses before it writes anything: a table the format refuses (the path is named), a missing material (named with its path), a host that is missing, scaled, mirrored or sheared, a frame that is not a rigid 4x4, a made name of over 63 bytes or taken by an object that is not this plate's, a frozen plate or one sharing its mesh, and a report over 16000 characters. Reports plates [{name, rebuilt, corners, facets, panels, bolts, anchors (the empties' names)}], host and side.",
|
||||
"changesScene": true,
|
||||
"editModeSafe": false,
|
||||
"result": "brokkr_mesh_polish_result",
|
||||
"fields": [
|
||||
{
|
||||
"name": "host",
|
||||
"type": "string",
|
||||
"minLength": 0,
|
||||
"maxLength": 63,
|
||||
"default": "",
|
||||
"doc": "the object every plate is parented to; empty: no parent"
|
||||
},
|
||||
{
|
||||
"name": "frame",
|
||||
"type": "string",
|
||||
"minLength": 0,
|
||||
"maxLength": 1000,
|
||||
"default": "",
|
||||
"doc": "the table's frame in the world, a JSON array of 4 rows of 4 numbers, rigid; empty: the host's world matrix, or the world with no host"
|
||||
},
|
||||
{
|
||||
"name": "side",
|
||||
"type": "integer",
|
||||
"minimum": -1,
|
||||
"maximum": 1,
|
||||
"default": 1,
|
||||
"doc": "1, or -1 for the table mirrored across its x = 0; 0 is refused"
|
||||
},
|
||||
{
|
||||
"name": "prefix",
|
||||
"type": "string",
|
||||
"minLength": 0,
|
||||
"maxLength": 32,
|
||||
"chars": "id",
|
||||
"default": "",
|
||||
"doc": "written before every plate's name: a-z A-Z 0-9 _ . (the action refuses a '-')"
|
||||
},
|
||||
{
|
||||
"name": "table",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"minLength": 1,
|
||||
"maxLength": 32000,
|
||||
"doc": "a brokkr.plates.v0 document, as JSON"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1470,9 +1470,12 @@ def residual(parent_world, parent_socket: dict, child_world, child_socket: dict,
|
|||
|
||||
DOFS = ("revolute", "prismatic") # what a socket type's dof may state: the child turns about the parent socket's z, or slides along it
|
||||
# How far past an end of its limits a joint's value may stand and still be inside them, as a fraction of the larger
|
||||
# of 1 and the ends' sizes. A rule: an action's roll and slide are float32 fields and limits are JSON doubles, so a
|
||||
# value typed as an end of its own limits stands up to 6e-08 of itself off that end; 1e-06 is 17 of those.
|
||||
LIMIT_SLACK = 1e-6
|
||||
# of 1 and the ends' sizes. An action's roll and slide are float32 fields and limits are JSON doubles, so a value
|
||||
# typed as an end of its own limits stands off that end: shipped worst 1.9e-08 of it (float32(-20.1), which must be
|
||||
# inside); the least a test refuses stood 3e-06 off. The geometric mean, separation 12.6 each side. JointRecordTests
|
||||
# reads both sides of it at 1.2: a slack of 2e-06 or 2.9e-06 takes the value 2.9e-07 off, one of 1.9e-08 loses the
|
||||
# one 2e-07 off.
|
||||
LIMIT_SLACK = 2.4e-7
|
||||
|
||||
|
||||
def within(value: float, lo: float, hi: float, revolute: bool) -> float | None:
|
||||
|
|
@ -1577,6 +1580,118 @@ def closure_residual(world_a, socket_a: dict, world_b, socket_b: dict) -> float:
|
|||
return float(max(np.abs(a[:3, 3] - b[:3, 3]).max(), np.abs(a[:3, 2] + b[:3, 2]).max()))
|
||||
|
||||
|
||||
HELD = 1e-5 # a connection or a closure holds when its residual is at most this: the add-on's HELD is this one
|
||||
# close_loop's three bounds, each read in FollowTests (lodur:ruling:deterministic-bound-margin).
|
||||
# Metres of in-plane closure error Newton stops at. Shipped worst error of an accepted solve 4.1e-11; the least
|
||||
# error it was still iterating on 2.5e-10, which a tolerance of 3e-10 accepts; the geometric mean, separation 2.4
|
||||
# each side. FollowTests reads both from the solved frames: its sweep's worst error is under 1.0e-10.
|
||||
FOLLOW_TOLERANCE = 1e-10
|
||||
# Newton steps one solve may take. Shipped worst 4 (a driver step of 5 degrees toward a dead centre, and one solve
|
||||
# across a 40 degree jump); a rule, four times the worst, which FollowTests asserts of its sweep.
|
||||
FOLLOW_ITERATIONS = 16
|
||||
# The smaller singular value of the Jacobian with each column scaled by its lever: about sin(angle between the columns)
|
||||
# / sqrt(2) for two revolute joints, 0 at a dead centre, where the two unknowns move the closing pin along one line. A
|
||||
# revolute column is scaled to unit length (so a linkage's size and the metres-per-degree of a column do not move
|
||||
# it), but for a ram, a revolute joint and then a prismatic one, by its lever with the slide at 0: that column is across
|
||||
# the slide wherever the rod's end is on the bore's axis, and its dead centre is the rod's end on the barrel's pin,
|
||||
# where the column vanishes; so a ram reads its lever over its closed lever, 1 at most. The reading is negative once
|
||||
# the pair stands on the other assembly from its seed (the Jacobian's determinant about the pin has changed sign: an
|
||||
# elbow bent the other way, a rod's end past its barrel's pin). Shipped least over the solves that are accepted 0.184
|
||||
# (the four-bar 30 degrees back from rest; a ram at 0.184 of its closed lever is accepted too); the greatest a refused
|
||||
# solve reads 0.047 (the four-bar 6.7 degrees from straight; a ram at 0.047 of its closed lever); the geometric mean,
|
||||
# separation 2.0 each side.
|
||||
FOLLOW_SINGULAR = 0.093
|
||||
|
||||
|
||||
def close_loop(base_world, joints, closing: dict, target_world, seed) -> tuple[tuple[float, float], int]:
|
||||
"""((value 1, value 2), Newton iterations) that close a planar loop of two unknowns. `joints` is two
|
||||
(parent socket, child socket, kind) in series: the first child mated on a socket of the part at base_world, the
|
||||
second on a socket of the first; a value is a revolute joint's roll in degrees or a prismatic one's slide in
|
||||
metres (its other coordinate is 0: a caller with a prismatic joint's stated roll turns the parent socket by it).
|
||||
`closing` is the second child's socket that closes, target_world the 4x4 world frame of the socket it closes on.
|
||||
Newton on the closing origin's error across the target's z, with the analytic Jacobian (a revolute column
|
||||
z x (q - o) pi / 180 for the joint's pin z through o, a prismatic one z), from `seed`: the root found is the one
|
||||
on the seed's assembly branch when the seed is near, so a caller steps its input. Refuses, naming which: pins
|
||||
that are not parallel (each revolute z along the target's z, each prismatic z across it, the closing z opposed
|
||||
to it: the loop is planar); a dead centre (FOLLOW_SINGULAR), and an iterate past one, on the other assembly from
|
||||
the seed, so no solve answers the other branch; no convergence in FOLLOW_ITERATIONS; and a loop that closes in
|
||||
the plane and misses along the pin (closure_residual over HELD)."""
|
||||
base, target = np.asarray(base_world, dtype=np.float64), np.asarray(target_world, dtype=np.float64)
|
||||
(parent_1, child_1, kind_1), (parent_2, child_2, kind_2) = joints
|
||||
n, values = target[:3, 2], np.array([float(seed[0]), float(seed[1])], dtype=np.float64)
|
||||
|
||||
def placed(values):
|
||||
at_1 = base @ parent_1["matrix"]
|
||||
world_1 = base @ (mate(parent_1, child_1, values[0]) if kind_1 == "revolute" else mate(parent_1, child_1, 0.0, values[0]))
|
||||
at_2 = world_1 @ parent_2["matrix"]
|
||||
world_2 = world_1 @ (mate(parent_2, child_2, values[1]) if kind_2 == "revolute" else mate(parent_2, child_2, 0.0, values[1]))
|
||||
return at_1, at_2, world_2 @ closing["matrix"]
|
||||
|
||||
at_1, at_2, end = placed(values)
|
||||
for name, kind, at in ((parent_1["name"], kind_1, at_1), (parent_2["name"], kind_2, at_2)):
|
||||
off = float(np.abs(np.cross(at[:3, 2], n)).max() if kind == "revolute" else abs(at[:3, 2] @ n))
|
||||
if off > HELD:
|
||||
raise KitError(f"the loop is not planar: the {kind} joint on socket {name!r} "
|
||||
f"{'turns about a pin that is not parallel to' if kind == 'revolute' else 'slides along a line that is not across'} "
|
||||
f"the pin it closes on (off by {off:.6g})")
|
||||
if float(np.abs(end[:3, 2] + n).max()) > HELD:
|
||||
raise KitError(f"the loop is not planar: closing socket {closing['name']!r} does not face the pin it closes on "
|
||||
f"(normals off by {float(np.abs(end[:3, 2] + n).max()):.6g})")
|
||||
ram, side = (kind_1, kind_2) == ("revolute", "prismatic"), None
|
||||
for iteration in range(FOLLOW_ITERATIONS + 1):
|
||||
at_1, at_2, end = placed(values)
|
||||
error = target[:3, 3] - end[:3, 3]
|
||||
error = error - n * (error @ n)
|
||||
J = np.stack([np.cross(at[:3, 2], end[:3, 3] - at[:3, 3]) * (math.pi / 180.0) if kind == "revolute" else at[:3, 2]
|
||||
for kind, at in ((kind_1, at_1), (kind_2, at_2))], axis=1)
|
||||
levers = np.linalg.norm(J, axis=0)
|
||||
if ram: # the barrel's lever with the rod's slide at 0
|
||||
levers[0] = np.linalg.norm(np.cross(at_1[:3, 2], placed((values[0], 0.0))[2][:3, 3] - at_1[:3, 3])) * (math.pi / 180.0)
|
||||
singular = 0.0 if levers.min() < 1e-12 else float(np.linalg.svd(J / levers, compute_uv=False)[-1])
|
||||
here = float(n @ np.cross(J[:, 0], J[:, 1])) > 0.0
|
||||
side = here if side is None else side
|
||||
if here != side:
|
||||
raise KitError(f"the loop is past a dead centre (the step takes the two joints that move closing socket {closing['name']!r} to their "
|
||||
f"other assembly: conditioning {singular:.3g} on that side)")
|
||||
if singular < FOLLOW_SINGULAR:
|
||||
raise KitError(f"the loop is at a dead centre (its two joints move closing socket {closing['name']!r} along one line: "
|
||||
f"conditioning {singular:.3g}, under {FOLLOW_SINGULAR:g})")
|
||||
if float(np.linalg.norm(error)) <= FOLLOW_TOLERANCE:
|
||||
break
|
||||
if iteration == FOLLOW_ITERATIONS:
|
||||
raise KitError(f"the loop did not close in {FOLLOW_ITERATIONS} steps (closing socket {closing['name']!r} stands "
|
||||
f"{float(np.linalg.norm(error)):.6g} m off in the plane)")
|
||||
values = values + np.linalg.lstsq(J, error, rcond=None)[0]
|
||||
apart = closure_residual(np.eye(4), {"matrix": end}, np.eye(4), {"matrix": target})
|
||||
if apart > HELD:
|
||||
raise KitError(f"the loop closes in its plane and closing socket {closing['name']!r} misses along the pin by {apart:.6g} m")
|
||||
return (float(values[0]), float(values[1])), iteration
|
||||
|
||||
|
||||
def joint_rows(root_world, entries) -> tuple[list, int]:
|
||||
"""(the rows of a joints report, how many rigid connections folded into them). `entries` is every connection of
|
||||
a tree in an order where a part comes after its parent: (id, the parent part's id, part name, parent socket, the
|
||||
parent's 4x4 world, DOF kind or None for rigid, value, joint record, driven: what the report says drives it, or
|
||||
None). A row is a revolute or prismatic connection; its parent is the nearest one above it (a rigid connection
|
||||
belongs to the joint above it), its axis and origin the parent socket's z and origin in the frame of root_world,
|
||||
min and max what the limits leave of the value either way, and held whether the limits are of one value: a
|
||||
joint with no travel, which is no degree of freedom (the one-driver rule's held pin)."""
|
||||
frame, nearest, rows, rigid = np.linalg.inv(np.asarray(root_world, dtype=np.float64)), {}, [], 0
|
||||
for name, parent, part_name, socket, parent_world, kind, value, record, driven in entries:
|
||||
if kind is None:
|
||||
nearest[name], rigid = nearest.get(parent), rigid + 1
|
||||
continue
|
||||
at = frame @ np.asarray(parent_world, dtype=np.float64) @ socket["matrix"]
|
||||
limits = record["limits"] and [round(v, 6) for v in record["limits"]]
|
||||
rows.append({"id": name, "parent": nearest.get(parent), "part": part_name, "socket": f"{parent}:{socket['name']}", "kind": kind,
|
||||
"axis": [round(float(v), 6) for v in at[:3, 2]], "origin": [round(float(v), 6) for v in at[:3, 3]], "value": round(value, 6),
|
||||
"limits": limits, "min": limits and round(record["limits"][0] - value, 6), "max": limits and round(record["limits"][1] - value, 6),
|
||||
"held": limits is not None and record["limits"][0] == record["limits"][1],
|
||||
"mechanism": record["mechanism"], "compliance": record["compliance"], "driven": driven})
|
||||
nearest[name] = name
|
||||
return rows, rigid
|
||||
|
||||
|
||||
EQUAL, SLACK = 0.01, 1e-9 # 'equal' sizes may differ by 1 percent of the larger; SLACK keeps a size at the limit inside it
|
||||
|
||||
|
||||
|
|
|
|||
144
surfaces/blender/brokkr_kitbash/kits/fittings.v0.json
Normal file
144
surfaces/blender/brokkr_kitbash/kits/fittings.v0.json
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
{
|
||||
"schema": "brokkr.kit.v0",
|
||||
"kit": "fittings",
|
||||
"doc": "What stands on a hard plate's face (brokkr_kitbash.plate's fit rows): each part stands on +z from z = 0 in its own frame, whose origin is the fit's place on the face, z the face's normal and y the face's up; metres. One material a part; no sockets.",
|
||||
"socketTypes": {},
|
||||
"parts": [
|
||||
{
|
||||
"name": "bolt",
|
||||
"doc": "A hex head on a washer: a rim bolt, and what a bolts row stands along a slab's outline.",
|
||||
"params": [
|
||||
{"name": "r", "type": "number", "min": 0.004, "max": 0.1, "default": 0.017, "doc": "the head's radius to its corners; the washer is 1.55 r"}
|
||||
],
|
||||
"shapes": [
|
||||
{"shape": "tube", "r0": "1.55*r", "r1": "1.55*r", "length": 0.004, "segments": 14, "at": [0, 0, -0.0005], "rot": [0, 0, 90]},
|
||||
{"shape": "tube", "r0": "r", "r1": "r", "length": "0.7*r", "segments": 6, "at": [0, 0, 0.0035], "rot": [0, 0, 90]}
|
||||
],
|
||||
"sockets": []
|
||||
},
|
||||
{
|
||||
"name": "slot",
|
||||
"doc": "The raised rim of a w by h slot: four bars around the opening. The opening's dark floor is a pit row under it.",
|
||||
"params": [
|
||||
{"name": "w", "type": "number", "min": 0.01, "max": 2, "default": 0.2, "doc": "the opening across (x)"},
|
||||
{"name": "h", "type": "number", "min": 0.005, "max": 2, "default": 0.04, "doc": "the opening along up (y)"}
|
||||
],
|
||||
"shapes": [
|
||||
{"shape": "box", "size": ["w+0.06", 0.032, 0.028], "at": [0, "h/2+0.016", 0.014]},
|
||||
{"shape": "box", "size": ["w+0.06", 0.032, 0.028], "at": [0, "-h/2-0.016", 0.014]},
|
||||
{"shape": "box", "size": [0.032, "h", 0.028], "at": ["w/2+0.016", 0, 0.014]},
|
||||
{"shape": "box", "size": [0.032, "h", 0.028], "at": ["-w/2-0.016", 0, 0.014]}
|
||||
],
|
||||
"sockets": []
|
||||
},
|
||||
{
|
||||
"name": "pit",
|
||||
"doc": "The dark box that reads as the hole under a slot or behind a vent: w by h, depth tall, count of them pitch apart along y, centred. A slot's is 0.012 deep; a vents row's is 0.01 deep with the vents' count and a pitch of 2.7 h.",
|
||||
"params": [
|
||||
{"name": "w", "type": "number", "min": 0.005, "max": 2, "default": 0.2, "doc": "across (x)"},
|
||||
{"name": "h", "type": "number", "min": 0.005, "max": 2, "default": 0.04, "doc": "along up (y)"},
|
||||
{"name": "depth", "type": "number", "min": 0.001, "max": 0.2, "default": 0.012, "doc": "how far it stands off the face"},
|
||||
{"name": "count", "type": "integer", "min": 1, "max": 64, "default": 1, "doc": "copies along y, centred"},
|
||||
{"name": "pitch", "type": "number", "min": 0, "max": 4, "default": 0, "doc": "distance between copies"}
|
||||
],
|
||||
"shapes": [
|
||||
{"shape": "repeat", "count": "count", "step": [0, "pitch", 0], "of": {"shape": "box", "size": ["w", "h", "depth"], "at": [0, "-(count-1)*pitch/2", "depth/2"]}}
|
||||
],
|
||||
"sockets": []
|
||||
},
|
||||
{
|
||||
"name": "vents",
|
||||
"doc": "A stack of louvre lips tilted 28 degrees over w by h openings, 2.7 h apart along y, centred. The openings' dark floors are a pit row under it.",
|
||||
"params": [
|
||||
{"name": "w", "type": "number", "min": 0.01, "max": 2, "default": 0.3, "doc": "an opening across (x)"},
|
||||
{"name": "h", "type": "number", "min": 0.005, "max": 0.5, "default": 0.03, "doc": "an opening along up (y)"},
|
||||
{"name": "count", "type": "integer", "min": 1, "max": 64, "default": 4, "doc": "lips"}
|
||||
],
|
||||
"shapes": [
|
||||
{"shape": "repeat", "count": "count", "step": [0, "2.7*h", 0], "of": {"shape": "box", "size": ["w+0.04", "0.9*h", 0.012], "at": [0, "0.75*h-(count-1)*2.7*h/2", 0.014], "rot": [-28, 0, 0]}}
|
||||
],
|
||||
"sockets": []
|
||||
},
|
||||
{
|
||||
"name": "access_port",
|
||||
"doc": "A round access port's body: a turned ring of radius r around a sunk cover with a raised boss. Its eight bolts are a port_bolts row at the same place.",
|
||||
"params": [
|
||||
{"name": "r", "type": "number", "min": 0.02, "max": 1, "default": 0.12, "doc": "the port's radius"}
|
||||
],
|
||||
"shapes": [
|
||||
{"shape": "lathe", "segments": 28, "profile": [[0, 0], ["r", 0], ["r", 0.035], ["0.82*r", 0.05], ["0.82*r", 0.022], ["0.34*r", 0.022], ["0.34*r", 0.045], [0, 0.045]]}
|
||||
],
|
||||
"sockets": []
|
||||
},
|
||||
{
|
||||
"name": "port_bolts",
|
||||
"doc": "The eight hex heads on an access port's rim, on a circle 0.91 r, standing from the rim's shoulder (z 0.035): a row of its own, so the heads take their own material.",
|
||||
"params": [
|
||||
{"name": "r", "type": "number", "min": 0.02, "max": 1, "default": 0.12, "doc": "the port's radius"}
|
||||
],
|
||||
"shapes": [
|
||||
{"shape": "tube", "r0": "0.07*r", "r1": "0.07*r", "length": 0.012, "segments": 6, "at": ["0.91*r", 0, 0.035], "rot": [0, 0, 90]},
|
||||
{"shape": "tube", "r0": "0.07*r", "r1": "0.07*r", "length": 0.012, "segments": 6, "at": ["0.6434671708797584*r", "0.6434671708797584*r", 0.035], "rot": [0, 0, 90]},
|
||||
{"shape": "tube", "r0": "0.07*r", "r1": "0.07*r", "length": 0.012, "segments": 6, "at": [0, "0.91*r", 0.035], "rot": [0, 0, 90]},
|
||||
{"shape": "tube", "r0": "0.07*r", "r1": "0.07*r", "length": 0.012, "segments": 6, "at": ["-0.6434671708797584*r", "0.6434671708797584*r", 0.035], "rot": [0, 0, 90]},
|
||||
{"shape": "tube", "r0": "0.07*r", "r1": "0.07*r", "length": 0.012, "segments": 6, "at": ["-0.91*r", 0, 0.035], "rot": [0, 0, 90]},
|
||||
{"shape": "tube", "r0": "0.07*r", "r1": "0.07*r", "length": 0.012, "segments": 6, "at": ["-0.6434671708797584*r", "-0.6434671708797584*r", 0.035], "rot": [0, 0, 90]},
|
||||
{"shape": "tube", "r0": "0.07*r", "r1": "0.07*r", "length": 0.012, "segments": 6, "at": [0, "-0.91*r", 0.035], "rot": [0, 0, 90]},
|
||||
{"shape": "tube", "r0": "0.07*r", "r1": "0.07*r", "length": 0.012, "segments": 6, "at": ["0.6434671708797584*r", "-0.6434671708797584*r", 0.035], "rot": [0, 0, 90]}
|
||||
],
|
||||
"sockets": []
|
||||
},
|
||||
{
|
||||
"name": "handle",
|
||||
"doc": "A grab handle along y: a square bar of side 2 r on two posts, bent over at lift, each post on a washer and a hex foot. Roll 90 lays it along the face's a.",
|
||||
"params": [
|
||||
{"name": "length", "type": "number", "min": 0.05, "max": 2, "default": 0.3, "doc": "between the posts"},
|
||||
{"name": "lift", "type": "number", "min": 0.02, "max": 0.5, "default": 0.065, "doc": "the bar's centre over the face"},
|
||||
{"name": "r", "type": "number", "min": 0.004, "max": 0.05, "default": 0.016, "doc": "half the bar's side"}
|
||||
],
|
||||
"shapes": [
|
||||
{"shape": "extrude", "section": "box", "w": "2*r", "h": "2*r", "t": "r", "path": [[0, "-length/2", -0.004], [0, "-length/2", "lift-min(0.4*lift,0.2*length)"], [0, "-length/2+0.1339745962155613*min(0.4*lift,0.2*length)", "lift-0.5*min(0.4*lift,0.2*length)"], [0, "-length/2+0.5*min(0.4*lift,0.2*length)", "lift-0.1339745962155613*min(0.4*lift,0.2*length)"], [0, "-length/2+min(0.4*lift,0.2*length)", "lift"], [0, "length/2-min(0.4*lift,0.2*length)", "lift"], [0, "length/2-0.5*min(0.4*lift,0.2*length)", "lift-0.1339745962155613*min(0.4*lift,0.2*length)"], [0, "length/2-0.1339745962155613*min(0.4*lift,0.2*length)", "lift-0.5*min(0.4*lift,0.2*length)"], [0, "length/2", "lift-min(0.4*lift,0.2*length)"], [0, "length/2", -0.004]], "up": [1, 0, 0]},
|
||||
{"shape": "tube", "r0": "2.3*r", "r1": "2.3*r", "length": 0.008, "segments": 12, "at": [0, "-length/2", 0], "rot": [0, 0, 90]},
|
||||
{"shape": "tube", "r0": "2.3*r", "r1": "2.3*r", "length": 0.008, "segments": 12, "at": [0, "length/2", 0], "rot": [0, 0, 90]},
|
||||
{"shape": "tube", "r0": "1.5*r", "r1": "1.5*r", "length": 0.008, "segments": 6, "at": [0, "-length/2", 0.008], "rot": [0, 0, 90]},
|
||||
{"shape": "tube", "r0": "1.5*r", "r1": "1.5*r", "length": 0.008, "segments": 6, "at": [0, "length/2", 0.008], "rot": [0, 0, 90]}
|
||||
],
|
||||
"sockets": []
|
||||
},
|
||||
{
|
||||
"name": "eye",
|
||||
"doc": "A lifting eye: a bolted pad, a neck, and a ring standing in the plane of y and z.",
|
||||
"params": [
|
||||
{"name": "size", "type": "number", "min": 0.03, "max": 0.5, "default": 0.1, "doc": "the ring's outer diameter is 1.1 size"}
|
||||
],
|
||||
"shapes": [
|
||||
{"shape": "box", "size": ["1.1*size", "2*size", 0.012], "at": [0, 0, 0.004]},
|
||||
{"shape": "tube", "r0": "0.11*size", "r1": "0.11*size", "length": 0.008, "segments": 6, "at": [0, "-0.72*size", 0.01], "rot": [0, 0, 90]},
|
||||
{"shape": "tube", "r0": "0.11*size", "r1": "0.11*size", "length": 0.008, "segments": 6, "at": [0, "0.72*size", 0.01], "rot": [0, 0, 90]},
|
||||
{"shape": "box", "size": ["0.34*size", "0.5*size", "0.24*size"], "at": [0, 0, "0.012+0.1*size"]},
|
||||
{"shape": "lathe", "segments": 20, "loop": true, "profile": [["0.55*size", 0], ["0.5119238815542512*size", "0.09192388155425119*size"], ["0.42*size", "0.13*size"], ["0.3280761184457488*size", "0.09192388155425119*size"], ["0.29*size", 0], ["0.3280761184457488*size", "-0.09192388155425119*size"], ["0.42*size", "-0.13*size"], ["0.5119238815542512*size", "-0.09192388155425119*size"]], "at": [0, 0, "0.012+0.62*size"], "rot": [0, 90, 0]}
|
||||
],
|
||||
"sockets": []
|
||||
},
|
||||
{
|
||||
"name": "louvres",
|
||||
"doc": "A framed bank of n slanted slats, w by h between the frame's middles: x along the slats, y up.",
|
||||
"params": [
|
||||
{"name": "w", "type": "number", "min": 0.1, "max": 4, "default": 0.6, "doc": "across (x), between the side bars' middles"},
|
||||
{"name": "h", "type": "number", "min": 0.1, "max": 4, "default": 0.72, "doc": "along up (y), between the top and bottom bars' middles"},
|
||||
{"name": "n", "type": "integer", "min": 1, "max": 64, "default": 6, "doc": "slats"},
|
||||
{"name": "depth", "type": "number", "min": 0.01, "max": 0.5, "default": 0.05, "doc": "how far the frame stands"},
|
||||
{"name": "frame", "type": "number", "min": 0.01, "max": 0.5, "default": 0.07, "doc": "the frame bars' width, under w and h"},
|
||||
{"name": "slant", "type": "number", "min": 0, "max": 80, "default": 25, "doc": "degrees a slat is tilted about x"}
|
||||
],
|
||||
"shapes": [
|
||||
{"shape": "box", "size": ["w+frame", "frame", "depth"], "at": [0, "-0.5*h", "0.5*depth"]},
|
||||
{"shape": "box", "size": ["w+frame", "frame", "depth"], "at": [0, "0.5*h", "0.5*depth"]},
|
||||
{"shape": "box", "size": ["frame", "h+frame", "depth"], "at": ["-0.5*w", 0, "0.5*depth"]},
|
||||
{"shape": "box", "size": ["frame", "h+frame", "depth"], "at": ["0.5*w", 0, "0.5*depth"]},
|
||||
{"shape": "repeat", "count": "n", "step": [0, "(h-frame)/n", 0], "of": {"shape": "box", "size": ["w-frame", "0.75*(h-frame)/n", "0.25*depth"], "at": [0, "-0.5*(h-frame)+0.5*(h-frame)/n", "0.3*depth"], "rot": ["slant", 0, 0]}}
|
||||
],
|
||||
"sockets": []
|
||||
}
|
||||
]
|
||||
}
|
||||
1061
surfaces/blender/brokkr_kitbash/plate.py
Normal file
1061
surfaces/blender/brokkr_kitbash/plate.py
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -24,13 +24,21 @@ the coupler bar at c's, the ram at a's plus each of `offsets`.
|
|||
search(kind, hinge, ram, seats, ...) the best of a seat grid, or the tally and the nearest miss
|
||||
record(m, ram), from_record the JSON record a rig or runtime drives from
|
||||
swept(fit, body, ...) points of the swept ram's surface in a body's rest frame
|
||||
Signed(shells, cap) the distance oracle over closed meshes, signed by three rays
|
||||
winding(vertices, triangles, points) the generalized winding number of a triangle soup about points
|
||||
inside(vertices, triangles, points) whether points are inside it: the number is 0.5 or more
|
||||
weld(vertices, tolerance) the vertex each vertex is read as: those within the tolerance are one
|
||||
solids(part, vertices, faces) the closed, outward wound solids of a part, or the refusal
|
||||
placed(vertices, faces, matrix) a local mesh carried by a matrix, turned back where it mirrors
|
||||
Signed(shells, cap) the distance oracle over meshes, signed by the winding number
|
||||
|
||||
Clearance. The record names the mechanism's `parts`, each a piece of one body (part -> the body whose rest frame
|
||||
it turns with: a thigh's core, the bracket that carries the rocker's pivot, a link's plates, a pin), and `touch`:
|
||||
for each member of MEMBERS[kind], zones (part, pin, radius, depth). Every member meets every part. A zone lowers
|
||||
what the member's samples keep from one part, and only within `radius` of the axis of `pin`, one of the member's
|
||||
own (RIDES), measured across the hinge axis: there a sample may come as near the part as -depth and no nearer.
|
||||
The part is one of a body that pin joins (JOINS: a the parent; the rocker's pivot the parent and the rocker; p the
|
||||
rocker and the coupler; c the coupler and the child; b the child; d the rocker), or the record is refused: what a
|
||||
member meets at a pin is of the bodies pinned there, and a part of any other body is never let near it.
|
||||
depth is 0 for what is stacked beside the member on the pin (a plate, the bracket or horn the pin stands in: the
|
||||
member's axis stays outside it, so a pin whose place along the axis is inside the part it claims to stand beside
|
||||
is refused), the pin's radius for the pin through the member's eye, half the thickness for the member's own plate
|
||||
|
|
@ -54,6 +62,7 @@ between two points.
|
|||
A RamError of a gate (assembly, stroke, toggle, arm, load, clash) names the angle and the pin; one of the record
|
||||
or of a call (an unknown kind, a range, a grid over the limit, a version) names the pin or the field it refuses.
|
||||
"""
|
||||
import itertools
|
||||
import math
|
||||
from dataclasses import dataclass, field, fields, replace
|
||||
|
||||
|
|
@ -68,13 +77,17 @@ MEMBERS = {"direct": ("barrel", "rod"), "four_bar": ("barrel", "rod", "rocker",
|
|||
EYE = {"direct": "b", "four_bar": "d", "bell_crank": "d"} # the pin the rod's eye rides
|
||||
RIDES = {kind: {"barrel": ("a", EYE[kind]), "rod": ("a", EYE[kind]), "rocker": ("rocker", "p"), "coupler": ("p", "c"), "rocker arm": ("rocker", "d")}
|
||||
for kind in KINDS} # member -> the pins at its start and its end
|
||||
JOINS = {kind: {"a": ("parent",), "b": ("child",)} if kind == "direct" else
|
||||
{"a": ("parent",), "rocker": ("parent", "rocker"), "p": ("rocker", "coupler"), "c": ("coupler", "child"), "d": ("rocker",)}
|
||||
for kind in KINDS} # pin -> the bodies it joins: only their parts are zoned about it
|
||||
GATES = ("assembly", "stroke", "toggle", "arm", "load", "clash")
|
||||
SCHEMA, VERSION = "brokkr.ram", 1
|
||||
SCHEMA, VERSION = "brokkr.ram", 2
|
||||
ZONE = ("part", "pin", "radius", "depth") # a zone of `touch`, as the record writes it
|
||||
COMPLIANCE = ("stiffness", "damping", "travel") # reserved: a load-path ram's settle, solved by a later version
|
||||
BAND = 1e-9 # the loop is refused within this of a dead centre of the rocker and coupler
|
||||
WELD = 3e-4 # of a part's extent: vertices no farther apart than this along every axis are one vertex to `solids`
|
||||
NUDGE = 1e-6 # of a part's extent: how far off a face's centroid its two sides are read
|
||||
THIN = 1.1e-4 # of a part's extent cubed: a region winding -1 where no solid's volume is negative is let be when it holds less
|
||||
FINE = 64 # in a zone a segment between samples is halved down to spacing / FINE
|
||||
RAYS = ((0.5377, 0.6211, 0.5701), (-0.7071, 0.2903, 0.6447), (0.1873, -0.8011, -0.5684)) # Signed's, in order
|
||||
|
||||
|
||||
class RamError(ValueError):
|
||||
|
|
@ -216,6 +229,9 @@ class Mechanism:
|
|||
radius, depth = _number(self.kind, f"{member} {part} radius", radius, 0.0), _number(self.kind, f"{member} {part} depth", depth)
|
||||
if depth < 0.0:
|
||||
raise RamError(self.kind, "record", f"a depth of 0 or more, got {depth!r}", pin=f"{member} {part} depth")
|
||||
if self.parts[part] not in JOINS[self.kind][pin]:
|
||||
raise RamError(self.kind, "record", f"{member} may touch about {pin} a part of a body the pin joins ({', '.join(JOINS[self.kind][pin])}); "
|
||||
f"{part!r} turns with {self.parts[part]}", pin=f"{member} {part} pin")
|
||||
span = _span(self, member)
|
||||
for name, value in (("radius", radius), ("depth", depth)):
|
||||
if value > span:
|
||||
|
|
@ -661,21 +677,20 @@ def search(kind, hinge, ram, seats, world=None, limit=20000, steps=25, spacing=N
|
|||
def record(m, ram):
|
||||
"""The mechanism record: plain JSON types, everything a rig or runtime needs to drive the ram from the hinge
|
||||
angle (from_record, then length or extension). It holds what is authored and nothing derived from it: barrel,
|
||||
closed length and link lengths come from the pins and the ram. `compliance` is reserved for a load-path ram's
|
||||
settle (COMPLIANCE: stiffness, damping, travel); version 1 writes it null and solves none."""
|
||||
closed length and link lengths come from the pins and the ram."""
|
||||
return {"schema": SCHEMA, "version": VERSION, "kind": m.kind,
|
||||
"hinge": {"pivot": m.pivot.tolist(), "axis": m.axis.tolist(), "lo": m.lo, "hi": m.hi},
|
||||
"pins": {name: getattr(m, name).tolist() for name in PINS[m.kind]}, "offsets": list(m.offsets),
|
||||
"ram": {f.name: getattr(ram, f.name) for f in fields(Ram)},
|
||||
"parts": dict(m.parts), "compliance": None,
|
||||
"parts": dict(m.parts),
|
||||
"touch": {member: [dict(zip(ZONE, zone)) for zone in zones] for member, zones in m.touch.items()}}
|
||||
|
||||
|
||||
def from_record(data):
|
||||
"""(Mechanism, Ram) of a record. A record of another schema or version (the integer 1: not 1.0, not true), with
|
||||
a key this version does not know or without one it does, with a compliance block, or with a value that is not
|
||||
its field's type (a finite number, three of them, a name), or with a zone wider or deeper than its member is
|
||||
refused whole, as a RamError naming the field: nothing is read past and dropped."""
|
||||
"""(Mechanism, Ram) of a record. A record of another schema or version (the integer 2: not 2.0, not true), with
|
||||
a key this version does not know or without one it does, or with a value that is not its field's type (a finite
|
||||
number, three of them, a name), or with a zone of a body its pin does not join, or wider or deeper than its
|
||||
member, is refused whole, as a RamError naming the field: nothing is read past and dropped."""
|
||||
if not isinstance(data, dict):
|
||||
raise RamError("None", "record", f"a record is an object, got {type(data).__name__}")
|
||||
kind, version = str(data.get("kind")), data.get("version")
|
||||
|
|
@ -695,13 +710,11 @@ def from_record(data):
|
|||
raise RamError(kind, "record", f"three finite numbers, got {value!r}", pin=name)
|
||||
return [_number(kind, name, x) for x in value]
|
||||
|
||||
keys("record", data, ("schema", "version", "kind", "hinge", "pins", "offsets", "ram", "parts", "touch", "compliance"))
|
||||
keys("record", data, ("schema", "version", "kind", "hinge", "pins", "offsets", "ram", "parts", "touch"))
|
||||
hinge, pins, ram = data["hinge"], data["pins"], data["ram"]
|
||||
keys("hinge", hinge, ("pivot", "axis", "lo", "hi"))
|
||||
keys("pins", pins, PINS[kind])
|
||||
keys("ram", ram, [f.name for f in fields(Ram)])
|
||||
if data["compliance"] is not None:
|
||||
raise RamError(kind, "record", f"a compliance block ({', '.join(COMPLIANCE)}) is a later version's: version {VERSION} solves none and will not drop it")
|
||||
for name, value in ram.items():
|
||||
_number(kind, name, value, 0.0 if name == "bore" else None)
|
||||
if not isinstance(data["offsets"], list):
|
||||
|
|
@ -744,47 +757,212 @@ def swept(f, body, margin=0.0, steps=13, around=8):
|
|||
return _into(m, p, body, np.concatenate(pts, axis=1)).reshape(-1, 3)
|
||||
|
||||
|
||||
class Signed:
|
||||
"""The distance oracle over closed meshes: distance(part, points) is the nearest face's distance, negative
|
||||
where the point is inside one of the part's shells (its depth below the nearest face), capped at `cap` outside
|
||||
only. shells: part -> [(vertices (N, 3), faces)], each shell closed, in the rest frame of the part's body.
|
||||
Inside is the crossing parity of `rays` of RAYS, by majority: one ray that runs through an edge or a vertex
|
||||
miscounts, and a sample then reads inside a plate it stands clear of. An unknown part raises. Needs Blender's
|
||||
mathutils (BVHTree)."""
|
||||
def winding(vertices, triangles, points):
|
||||
"""The generalized winding number of a triangle soup about each of `points` (Jacobson, Kavan and Sorkine-Hornung
|
||||
2013): the triangles' signed solid angles, summed, over 4 pi. A triangle counts positive from the side its normal
|
||||
points away from (counterclockwise seen from outside). About a closed mesh it is the whole number of times the
|
||||
surface wraps the point: 0 outside, 1 inside, 2 where two solids of one mesh overlap, whether they share vertices
|
||||
or cut through one another. About an open mesh it is a fraction that falls off toward the hole (the closed
|
||||
mesh's number less the missing faces' share of the sphere about the point), and about a mesh wound inside out
|
||||
it is the negative: neither has an inside to read, and Signed refuses both. The plain sum: a point costs every
|
||||
triangle. The corners' offsets from the point are taken in double precision and the angles in single (2.4 times
|
||||
the pace): the number is good to 1e-5 a millimetre off a face and to 1e-2 at 1e-7 off it, and nearer than that
|
||||
its side of the face is not held."""
|
||||
v, t, pts = np.asarray(vertices, dtype=float).reshape(-1, 3), np.asarray(triangles, dtype=int).reshape(-1, 3), np.asarray(points, dtype=float).reshape(-1, 3)
|
||||
A, B, C = (np.ascontiguousarray(v[t[:, k]].T) for k in range(3)) # each (3, F): a corner of every triangle
|
||||
out, step = np.zeros(len(pts)), max(1, 32768 // max(len(t), 1)) # a block of pairs that stays in cache: 3.1 times the pace of 400,000
|
||||
for k in range(0, len(pts), step):
|
||||
p = pts[k:k + step].T[:, :, None]
|
||||
(ax, ay, az), (bx, by, bz), (cx, cy, cz) = ((corner[:, None, :] - p).astype(np.float32) for corner in (A, B, C))
|
||||
la, lb, lc = np.sqrt(ax * ax + ay * ay + az * az), np.sqrt(bx * bx + by * by + bz * bz), np.sqrt(cx * cx + cy * cy + cz * cz)
|
||||
volume = ax * (by * cz - bz * cy) + ay * (bz * cx - bx * cz) + az * (bx * cy - by * cx)
|
||||
out[k:k + step] = np.arctan2(volume, la * lb * lc + (ax * bx + ay * by + az * bz) * lc + (bx * cx + by * cy + bz * cz) * la + (cx * ax + cy * ay + cz * az) * lb).sum(axis=1, dtype=float)
|
||||
return out / (2.0 * math.pi)
|
||||
|
||||
def __init__(self, shells, cap=None, rays=3):
|
||||
|
||||
def inside(vertices, triangles, points):
|
||||
"""Whether each of `points` is inside the triangle soup: its winding number is 0.5 or more. About the closed,
|
||||
outward wound solids `solids` passes the number is whole and any bound over 0 and up to 1 reads the same; 0.5
|
||||
is the bound because it is the middle, the farthest from both whole numbers the single-precision sum rounds
|
||||
about."""
|
||||
return winding(vertices, triangles, points) >= 0.5
|
||||
|
||||
|
||||
def weld(vertices, tolerance):
|
||||
"""The vertex each of `vertices` is read as: one index, the least, for all that stand within `tolerance` of one
|
||||
another along every axis, and for a chain of such. Two vertices are joined where no coordinate of theirs differs
|
||||
by more than the tolerance, and only there, wherever the mesh stands: each vertex is compared with those of its
|
||||
own cell and of the cells about it on one grid of the tolerance, and the grid only finds the pairs."""
|
||||
v = np.asarray(vertices, dtype=float).reshape(-1, 3)
|
||||
label = np.arange(len(v))
|
||||
if not len(v) or not tolerance > 0.0:
|
||||
return label
|
||||
cell = np.floor((v - v.min(axis=0)) / (tolerance * (1.0 + 1e-9))).astype(np.int64) # two within the tolerance are in one cell or in two that touch
|
||||
about = [step for step in itertools.product((-1, 0, 1), repeat=3) if step >= (0, 0, 0)] # a cell and half the 26 about it: each pair of cells once
|
||||
at = np.unique(np.concatenate([cell + step for step in about]), axis=0, return_inverse=True)[1].reshape(len(about), len(v))
|
||||
order, count = np.argsort(at[0], kind="stable"), np.bincount(at[0], minlength=int(at.max()) + 1)
|
||||
start, first, second = np.cumsum(count) - count, [], []
|
||||
for there in at:
|
||||
n = count[there]
|
||||
i = np.repeat(label, n)
|
||||
j = order[np.repeat(start[there], n) + np.arange(int(n.sum())) - np.repeat(np.cumsum(n) - n, n)]
|
||||
near = (np.abs(v[i] - v[j]) <= tolerance).all(axis=1)
|
||||
first.append(i[near])
|
||||
second.append(j[near])
|
||||
first, second = np.concatenate(first), np.concatenate(second)
|
||||
while True:
|
||||
before, least = label, label.copy()
|
||||
low = np.minimum(label[first], label[second])
|
||||
np.minimum.at(least, first, low)
|
||||
np.minimum.at(least, second, low)
|
||||
label = least[least]
|
||||
if (label == before).all():
|
||||
return label
|
||||
|
||||
|
||||
def _read(part, vertices, faces):
|
||||
"""`solids`, and with each face's solid the fan of triangles, the faces of some area and the winding number
|
||||
before each of those: what Signed keeps."""
|
||||
v = np.asarray(vertices, dtype=float).reshape(-1, 3)
|
||||
face_of = np.repeat(np.arange(len(faces)), [len(face) - 2 for face in faces])
|
||||
fan = np.array([(face[0], face[k], face[k + 1]) for face in faces for k in range(1, len(face) - 1)], dtype=int).reshape(-1, 3)
|
||||
extent = float(np.linalg.norm(np.ptp(v, axis=0))) if len(v) else 0.0
|
||||
one = weld(v, WELD * extent)
|
||||
owner, edges, seam = list(range(len(faces))), {}, np.zeros(len(faces), dtype=bool)
|
||||
|
||||
def root(k):
|
||||
while owner[k] != k:
|
||||
owner[k] = k = owner[owner[k]]
|
||||
return k
|
||||
|
||||
for k, face in enumerate(faces):
|
||||
face = [int(one[i]) for i in face]
|
||||
seam[k] = len(set(face)) < 3 # the weld leaves it a point or a line
|
||||
for i, j in zip(face, face[1:] + face[:1]):
|
||||
if i != j:
|
||||
there = edges.setdefault((min(i, j), max(i, j)), [k, 0])
|
||||
there[1] += 1 if i < j else -1
|
||||
owner[root(k)] = root(there[0])
|
||||
of = np.array([root(k) for k in range(len(faces))], dtype=int)
|
||||
names = {r: n for n, r in enumerate(dict.fromkeys(of.tolist()))} # solids numbered in the order of their first faces
|
||||
unmatched = {}
|
||||
for first, balance in edges.values():
|
||||
if balance:
|
||||
unmatched[names[of[first]]] = unmatched.get(names[of[first]], 0) + 1
|
||||
for n, count in sorted(unmatched.items()):
|
||||
raise RamError("mesh", "signed", f"part {part!r} is open: solid {n} of {len(names)} has {count} edge{'s' if count > 1 else ''} no face runs the other way")
|
||||
of = np.array([names[r] for r in of.tolist()], dtype=int)
|
||||
normal = np.zeros((len(faces), 3))
|
||||
np.add.at(normal, face_of, np.cross(v[fan[:, 1]] - v[fan[:, 0]], v[fan[:, 2]] - v[fan[:, 0]]))
|
||||
size = np.linalg.norm(normal, axis=1)
|
||||
flat = np.flatnonzero(size > 0.0) # a face of no area has no side to be read on
|
||||
centre = np.array([v[list(faces[k])].mean(axis=0) for k in flat]).reshape(-1, 3)
|
||||
before = winding(v, fan, centre + NUDGE * extent * normal[flat] / size[flat, None])
|
||||
turned = np.flatnonzero(before < -0.5)
|
||||
if len(turned):
|
||||
mid = v.mean(axis=0)
|
||||
cone = np.einsum("ij,ij->i", v[fan[:, 0]] - mid, np.cross(v[fan[:, 1]] - mid, v[fan[:, 2]] - mid)) / 6.0
|
||||
for n in dict.fromkeys(of[flat[turned]].tolist()): # the solids with a turned face, in the order of those faces
|
||||
volume = math.fsum(cone[of[face_of] == n].tolist())
|
||||
if volume < 0.0 and not seam[of == n].all(): # faces the weld closes up alone hold nothing: their sum is no volume
|
||||
mine = flat[turned[of[flat[turned]] == n]]
|
||||
raise RamError("mesh", "signed", f"part {part!r} is wound inside out: solid {n} of {len(names)} has a volume of {volume / extent ** 3:.3g} of the part's extent cubed, and {len(mine)} of its faces, from face {int(mine[0])}, stand before a region that winds {float(before[turned[of[flat[turned]] == n][0]]):.3g}")
|
||||
unit, rungs = normal[flat[turned]] / size[flat[turned], None], NUDGE * 10.0 ** (np.arange(25) / 4.0) # the nudge to the whole extent, four to a decade
|
||||
still = winding(v, fan, (centre[turned][:, None, :] + (rungs[1:] * extent)[None, :, None] * unit[:, None, :]).reshape(-1, 3)).reshape(len(turned), -1) < -0.5
|
||||
held = float((0.5 * size[flat[turned]] * rungs[np.cumprod(still, axis=1).sum(axis=1)]).sum()) / extent ** 2
|
||||
if held >= THIN:
|
||||
k, area = int(flat[turned[0]]), size[flat[turned]]
|
||||
about = (centre[turned] * area[:, None]).sum(axis=0) / area.sum()
|
||||
reach = float(np.linalg.norm(centre[turned] - about, axis=1).max())
|
||||
raise RamError("mesh", "signed", f"part {part!r} crosses itself: {len(turned)} faces, from face {k} of solid {int(of[k])} of {len(names)}, stand before a region that winds {float(before[turned[0]]):.3g} and holds {held:.3g} of the part's extent cubed, "
|
||||
f"about ({about[0]:.4g}, {about[1]:.4g}, {about[2]:.4g}) and within {reach:.3g} of it, and no solid there has a negative volume: its surfaces cut through one another (cutters never joined, a fold), or a turned piece is welded into a whole one")
|
||||
return of, fan, flat, before
|
||||
|
||||
|
||||
def solids(part, vertices, faces):
|
||||
"""The solid each face of a part belongs to (faces joined across an edge are one solid), or a RamError where
|
||||
the part has no inside to sign. Nothing is repaired.
|
||||
|
||||
Open. Vertices within WELD of the part's extent (its box's diagonal) of one another along every axis are read
|
||||
as one (`weld`), so a seam of coincident vertices is no hole. A solid with an edge no face runs the other way (a
|
||||
boundary edge, or two faces wound against each other across it) is open.
|
||||
|
||||
A face is read NUDGE of the extent before its centroid, along its normal. Before a face of a whole solid the
|
||||
winding number is 0, or more where another solid covers it. A face is turned where the number there is under
|
||||
-0.5: it stands before a region that winds -1.
|
||||
|
||||
Inside out. A solid with a turned face whose signed volume (the sum of a . (b x c) / 6 over its triangles, summed
|
||||
exactly) is negative is wound inside out, however little it holds: the bound is zero. A solid whose every face
|
||||
the weld closes up to a point or a line is a seam's leftover and has no volume to read. The turned face tells it
|
||||
from a cavity cut as its own inward shell, whose volume is negative too but whose faces have the cavity before
|
||||
them, which winds 0: that passes. So does a sliver, two sheets back to back, with no volume and nothing between
|
||||
the sheets to wind.
|
||||
|
||||
Crossing. Turned faces where no solid's volume is negative stand before a region where the part's surfaces cut
|
||||
through one another: two cutters taken out of one solid and never joined, a bevel folded over a corner, a
|
||||
lathe's profile crossing itself, or a turned piece welded into a whole one, which the volume of the one solid
|
||||
hides. The region is measured: each turned face's area by how far out along its normal the number stays under
|
||||
-0.5 (the nudge, then four rungs to a decade up to the extent), summed. A part whose region holds THIN of its
|
||||
extent cubed or more is refused as crossing itself, with the faces, the region and where it lies (the turned
|
||||
faces' centre by area, in the frame the vertices are given in, and how far the farthest is from it). Less is
|
||||
let be: there the part reads outside in what its author took for inside."""
|
||||
return _read(part, vertices, faces)[0]
|
||||
|
||||
|
||||
def placed(vertices, faces, matrix):
|
||||
"""A local mesh in the frame a 4 by 4 `matrix` carries it to: the vertices carried, and each face turned back
|
||||
where the matrix mirrors (its determinant is negative), so a part mirrored by a negative scale is wound as its
|
||||
own mesh is."""
|
||||
m = np.asarray(matrix, dtype=float).reshape(4, 4)
|
||||
v = np.asarray(vertices, dtype=float).reshape(-1, 3) @ m[:3, :3].T + m[:3, 3]
|
||||
return v, [tuple(face)[::-1] if np.linalg.det(m[:3, :3]) < 0.0 else tuple(face) for face in faces]
|
||||
|
||||
|
||||
class Signed:
|
||||
"""The distance oracle over meshes: distance(part, points) is the distance to the part's surface, negative
|
||||
where the point is inside the part (its depth), capped at `cap` outside only. shells: part -> [(vertices
|
||||
(N, 3), faces)], in the rest frame of the part's body. Every solid of a part (`solids`) is closed and wound
|
||||
counterclockwise seen from outside: a part that is open, wound inside out or crossing itself is refused when
|
||||
the oracle is made, by a RamError that names the part and the solid with its edge count or its negative volume,
|
||||
or the turned faces, their region and where it lies. A
|
||||
shell may be (vertices, faces, matrix), a local mesh and the 4 by 4 that carries it to the body's rest frame:
|
||||
it is read as `placed` gives it, the faces of a mirrored one (a negative scale) turned back, so a caller hands
|
||||
a mirrored object's own mesh and its matrix and never a mesh it carried itself. Inside is where `inside`
|
||||
says, by the winding number of all the part's faces (a face of more than three corners as a fan): solids that
|
||||
overlap, in one mesh or several, welded or not, read inside wherever any is. The depth is to the nearest
|
||||
exposed face: one whose centroid, set NUDGE of the part's extent off the face along its normal, is not inside
|
||||
the part. A face buried in another solid is not the part's surface and is left out. A face that crosses
|
||||
another solid is taken whole by where its centroid is: left out, the depth by it reads greater than it is;
|
||||
kept, a point by its buried stretch reads shallower than the part's surface is. Outside, the distance is to
|
||||
the nearest face of all. An unknown part raises. Needs Blender's mathutils (BVHTree) for the nearest face."""
|
||||
|
||||
def __init__(self, shells, cap=None):
|
||||
from mathutils import Vector
|
||||
from mathutils.bvhtree import BVHTree
|
||||
self.cap, self.asked, self.vector = cap, 0, Vector
|
||||
self.rays = [Vector(ray).normalized() for ray in RAYS[:rays]]
|
||||
self.trees = {part: [(BVHTree.FromPolygons(np.asarray(v, dtype=float).tolist(), [tuple(face) for face in f], epsilon=0.0),
|
||||
np.min(v, axis=0), np.max(v, axis=0)) for v, f in made] for part, made in shells.items()}
|
||||
|
||||
@staticmethod
|
||||
def crossings(tree, v, ray):
|
||||
count, o = 0, v
|
||||
for _ in range(64):
|
||||
loc = tree.ray_cast(o, ray)[0]
|
||||
if loc is None:
|
||||
break
|
||||
count, o = count + 1, loc + ray * 1e-6
|
||||
return count
|
||||
|
||||
def inside(self, tree, v):
|
||||
return 2 * sum(self.crossings(tree, v, ray) % 2 for ray in self.rays) > len(self.rays)
|
||||
self.cap, self.asked, self.vector, self.parts = cap, 0, Vector, {}
|
||||
for part, made in shells.items():
|
||||
verts, faces, at = [], [], 0
|
||||
for v, f, *matrix in made:
|
||||
v, f = placed(v, f, *matrix) if matrix else (np.asarray(v, dtype=float).reshape(-1, 3), f)
|
||||
verts.append(v)
|
||||
faces += [tuple(at + int(i) for i in face) for face in f]
|
||||
at += len(v)
|
||||
verts = np.concatenate(verts)
|
||||
_, fan, flat, before = _read(part, verts, faces)
|
||||
exposed = [faces[k] for k in flat[before < 0.5]]
|
||||
if not exposed:
|
||||
raise RamError("mesh", "signed", f"part {part!r} has no exposed face")
|
||||
self.parts[part] = (BVHTree.FromPolygons(verts.tolist(), faces, epsilon=0.0), BVHTree.FromPolygons(verts.tolist(), exposed, epsilon=0.0), verts, fan)
|
||||
|
||||
def __call__(self, part, pts):
|
||||
pts = np.asarray(pts, dtype=float)
|
||||
pts = np.asarray(pts, dtype=float).reshape(-1, 3)
|
||||
self.asked += len(pts)
|
||||
tree, surface, verts, fan = self.parts[part]
|
||||
out = np.full(len(pts), math.inf if self.cap is None else self.cap)
|
||||
for tree, lo, hi in self.trees[part]:
|
||||
boxed = ((pts >= lo) & (pts <= hi)).all(axis=1)
|
||||
for i, p in enumerate(pts):
|
||||
v = self.vector(p)
|
||||
if boxed[i] and self.inside(tree, v):
|
||||
out[i] = min(out[i], -tree.find_nearest(v)[3])
|
||||
continue
|
||||
hit = tree.find_nearest(v, self.cap) if self.cap else tree.find_nearest(v)
|
||||
if hit[0] is not None and hit[3] < out[i]:
|
||||
out[i] = hit[3]
|
||||
for i in np.flatnonzero(inside(verts, fan, pts)):
|
||||
out[i] = -surface.find_nearest(self.vector(pts[i]))[3]
|
||||
for i in np.flatnonzero(out >= 0):
|
||||
hit = tree.find_nearest(self.vector(pts[i]), self.cap) if self.cap else tree.find_nearest(self.vector(pts[i]))
|
||||
if hit[0] is not None:
|
||||
out[i] = hit[3]
|
||||
return out
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ cameras, scores and a fitted sheet. The edges flow_score reads are computed on e
|
|||
|
||||
fit_shell reads a shell's request through brokkr_kitbash (the sheet's one parser) and returns a sheet; it writes
|
||||
nothing. brokkr_kitbash.shell is the cage's one writer: the caller applies the fitted sheet with it.
|
||||
block_plate returns a plate's first sheet from traces of its outline, checked by the same parser, and the traces as
|
||||
fit_shell takes them; it writes nothing either.
|
||||
"""
|
||||
bl_info = {"name": "Brokkr Reference", "author": "GameCult", "version": (0, 1, 0), "blender": (4, 2, 0),
|
||||
"category": "Camera", "description": "Solve a reference view's camera from marked points; agent-callable through Brokkr."}
|
||||
|
|
@ -263,7 +265,63 @@ class BROKKR_REFERENCE_OT_fit_shell(PolishOperator):
|
|||
return {"object": obj.name, **out, "seconds": round(time.perf_counter() - started, 3)}
|
||||
|
||||
|
||||
classes = (BROKKR_REFERENCE_OT_solve_camera, BROKKR_REFERENCE_OT_flow_score, BROKKR_REFERENCE_OT_fit_shell)
|
||||
class BROKKR_REFERENCE_OT_block_plate(PolishOperator):
|
||||
"""Block a plate's first free cage from traces of its outline through solved cameras, each trace naming the two
|
||||
corners it runs between, and say what decided each corner's depth; nothing is written"""
|
||||
bl_idname = "brokkr_reference.block_plate"
|
||||
bl_label = "Block Plate From Traces"
|
||||
frame_object: bpy.props.StringProperty(name="Frame", maxlen=63, description="An empty or object, unscaled, whose place in the world is the plate's frame")
|
||||
plate: bpy.props.StringProperty(name="Plate", maxlen=2000, description="JSON {corners: [names in the outline's order], mirror, seam: [corners on x = 0]}")
|
||||
traces: bpy.props.StringProperty(name="Traces", maxlen=12000, description="A JSON array of {camera, box, frame, from, to, side, line: [[u, v], ...]}")
|
||||
plane: bpy.props.StringProperty(name="Plane", maxlen=200, description="'' for the plane through the corners the views decide, or 'x,y,z; nx,ny,nz' in the frame")
|
||||
share: bpy.props.FloatProperty(name="Share", default=0.1, min=0.0009, max=10.0, description="A crown point this share of the plate's extent off the plane costs what one pixel of miss does")
|
||||
tol: bpy.props.FloatProperty(name="Tolerance", default=core.TOL, min=0.09, max=100.0, description="Pixels: nine tenths of every trace must lie this near its built side, or the side gains a point")
|
||||
|
||||
def work(self, context):
|
||||
try:
|
||||
import brokkr_kitbash
|
||||
except ImportError as error:
|
||||
raise Refused(f"block_plate needs the brokkr_kitbash add-on beside this one ({error}).") from None
|
||||
obj = bpy.data.objects.get(self.frame_object)
|
||||
if obj is None or obj.name not in context.scene.objects:
|
||||
raise Refused(f"frame_object {self.frame_object!r} is not an object of this scene.")
|
||||
if max(abs(v - 1.0) for v in obj.matrix_world.to_scale()) > 1e-6:
|
||||
raise Refused(f"frame_object {obj.name!r} is scaled {tuple(round(v, 6) for v in obj.matrix_world.to_scale())}: a plate is in metres of its frame. Apply or clear the scale.")
|
||||
try:
|
||||
plate, traces = json.loads(self.plate), json.loads(self.traces)
|
||||
except ValueError as error:
|
||||
raise Refused(f"plate and traces must be JSON ({error}).") from None
|
||||
if not isinstance(traces, list) or not all(isinstance(trace, dict) for trace in traces):
|
||||
raise Refused("traces must be a JSON array of objects {camera, box, frame, from, to, side, line}.")
|
||||
plane = None
|
||||
if self.plane.strip():
|
||||
halves = self.plane.split(";")
|
||||
try:
|
||||
if len(halves) != 2:
|
||||
raise core.ReferenceFitError(f"plane {self.plane.strip()!r} is not 'x,y,z; nx,ny,nz'")
|
||||
plane = {"point": core.numbers(halves[0], 3, "plane's point"), "normal": core.numbers(halves[1], 3, "plane's normal")}
|
||||
except core.ReferenceFitError as refusal:
|
||||
raise Refused(f"{refusal}.") from None
|
||||
own, views = [list(row) for row in obj.matrix_world], []
|
||||
for k, trace in enumerate(traces):
|
||||
box = trace.get("box")
|
||||
if box is not None and not (isinstance(box, list) and len(box) == 4 and all(isinstance(v, (int, float)) and not isinstance(v, bool) for v in box)):
|
||||
raise Refused(f"traces[{k}].box must be [u0, v0, u1, v1], or absent for the render's own frame.")
|
||||
if not isinstance(trace.get("camera"), str):
|
||||
raise Refused(f"traces[{k}].camera must name a camera object.")
|
||||
try:
|
||||
views.append((record(context, trace["camera"], "" if box is None else ",".join(repr(float(v)) for v in box)), trace.get("frame") or own))
|
||||
except (Refused, core.ReferenceFitError) as refusal:
|
||||
raise Refused(f"traces[{k}]: {refusal}") from None
|
||||
started = time.perf_counter()
|
||||
try:
|
||||
out = core.block_plate(views, plate, traces, brokkr_kitbash.core.sheet, plane=plane, share=self.share, tol=self.tol)
|
||||
except core.ReferenceFitError as refusal:
|
||||
raise Refused(f"{refusal}. Nothing changed.") from None
|
||||
return {"frame_object": obj.name, **out, "seconds": round(time.perf_counter() - started, 3)}
|
||||
|
||||
|
||||
classes = (BROKKR_REFERENCE_OT_solve_camera, BROKKR_REFERENCE_OT_flow_score, BROKKR_REFERENCE_OT_fit_shell, BROKKR_REFERENCE_OT_block_plate)
|
||||
|
||||
|
||||
def register():
|
||||
|
|
|
|||
|
|
@ -174,6 +174,63 @@
|
|||
"doc": "pixels: nine tenths of every trace must lie this near its built run, or the fit is refused"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "brokkr_reference.block_plate",
|
||||
"doc": "Block a plate's first free cage from traces of its outline, each seen through a scene camera and naming the two consecutive corners it runs between: the only correspondence is a trace's ends to its corners. The crown (the corners and each side's points between) is solved until the sides as built draw on the traces; a side whose trace is not explained gains a point, up to 6. Depth comes from the views where two see a corner and a pixel moves their meeting point less than share x the plate's extent, from x = 0 for a mirrored plate's seam corners whose view crosses it, and otherwise from a plane: the one given, or the one through the corners the views and the seam decide. Every corner, and every point between corners (sides[].inner), says what decided it by its prior_share: plane from 0.2 up, else mirror on the seam, else views; a side says corners, views, mirror or plane. A corner one view sees, a seam corner seen along x = 0 included, is refused when the plane stands over 66 degrees off that view. Returns the sheet for brokkr_kitbash.shell, checked by its parser, and fit_traces for brokkr_reference.fit_shell (left_out lists the traces fit_shell cannot state: another frame, or a partner's side -1). Writes nothing (docs/reference.md).",
|
||||
"changesScene": true,
|
||||
"editModeSafe": false,
|
||||
"result": "brokkr_mesh_polish_result",
|
||||
"fields": [
|
||||
{
|
||||
"name": "frame_object",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"minLength": 1,
|
||||
"maxLength": 63,
|
||||
"doc": "an empty or object, unscaled, whose place in the world is the plate's frame"
|
||||
},
|
||||
{
|
||||
"name": "plate",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"minLength": 2,
|
||||
"maxLength": 2000,
|
||||
"doc": "JSON {corners: [names, in the outline's order], mirror: true or false, seam: [the corners on x = 0 of a mirrored plate, two or more next to each other]}; side i runs from corner i to corner i + 1 and is one hard crease"
|
||||
},
|
||||
{
|
||||
"name": "traces",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"minLength": 2,
|
||||
"maxLength": 12000,
|
||||
"doc": "a JSON array of {camera, box, frame, from, to, side, line}: camera a camera object's name; box [u0,v0,u1,v1], its frame on the image, absent for the render's own; frame a 4 x 4 (rows), the part's pose in that view, absent for frame_object's; from and to two consecutive corners; side 1, or -1 for the mirrored half or the partner across the frame's x = 0; line [[u,v],...] drawn from `from` to `to`"
|
||||
},
|
||||
{
|
||||
"name": "plane",
|
||||
"type": "string",
|
||||
"required": false,
|
||||
"maxLength": 200,
|
||||
"default": "",
|
||||
"doc": "'' for the plane through the corners the views and the seam decide, or 'x,y,z; nx,ny,nz' in the frame: a point of the plane and its normal"
|
||||
},
|
||||
{
|
||||
"name": "share",
|
||||
"type": "number",
|
||||
"minimum": 0.001,
|
||||
"maximum": 10,
|
||||
"default": 0.1,
|
||||
"doc": "the prior: a crown point this share of the corners' extent off the plane costs what one pixel of miss does"
|
||||
},
|
||||
{
|
||||
"name": "tol",
|
||||
"type": "number",
|
||||
"minimum": 0.1,
|
||||
"maximum": 100,
|
||||
"default": 5.2,
|
||||
"doc": "pixels: nine tenths of every trace must lie this near its built side, or the side gains a point"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,13 @@ only where the built runs explain every trace; docs/reference.md, "fit_shell", s
|
|||
|
||||
fit_runs(views, cage, runs, movable, mirror_of, share, diag, tol) the moved cage and the report
|
||||
fit_sheet(document, cage, frame, traces, cams, share, tol) the same for a sheet's named runs: the fitted sheet
|
||||
|
||||
A plate's first cage is blocked from traces of its outline, each naming the two corners it runs between: the crown
|
||||
is solved by fit_runs with a plane and fairness for its prior; docs/reference.md, "block_plate".
|
||||
|
||||
triangulate(obs, seam) where sight lines meet, and how far apart they stand
|
||||
plate_sheet(crown, corners, flare, drop, dome, mirror, seam, facing) the crown, skirt and centre free-cage document
|
||||
block_plate(views, plate, traces, parse, plane, share, tol) the blocked sheet and what decided each crown point
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
@ -527,7 +534,7 @@ def _hard_runs(cage, runs):
|
|||
"more hard edges meet, or on the rim")
|
||||
|
||||
|
||||
def fit_runs(views, cage, runs, movable, mirror_of, share, diag, tol=TOL):
|
||||
def fit_runs(views, cage, runs, movable, mirror_of, share, diag, tol=TOL, prior_rows=None):
|
||||
"""Move a cage's points until its hard runs, as built and as cameras draw them, lie on their traces.
|
||||
|
||||
views [(camera record, frame)]: the frame is the 4 x 4 that carries the cage to the world
|
||||
|
|
@ -538,7 +545,10 @@ def fit_runs(views, cage, runs, movable, mirror_of, share, diag, tol=TOL):
|
|||
movable (vertices, 3) of bool: the coordinates that may move. Only authored vertices move
|
||||
mirror_of per vertex, the authored vertex it mirrors across x = 0, or itself: a mirrored half is the same
|
||||
parameters seen again, x negated
|
||||
share the prior: a move of share x diag from the cage as given costs what one pixel of miss does
|
||||
share the prior's weight: a prior row that reads share x diag metres costs what one pixel of miss does
|
||||
prior_rows (A, b) in metres over the movable coordinates, in the order of movable's True entries: the prior is
|
||||
the rows A p - b. None is the identity, A = I and b the cage as given: a move from where each
|
||||
point was blocked. block_plate gives distances to a plane and a side's second differences instead
|
||||
tol pixels: PART in a hundred of each trace must lie this near its built run as drawn
|
||||
|
||||
The residual per run is the pixel distance from each built point (crease_run LEVELS times, drawn through the
|
||||
|
|
@ -581,6 +591,9 @@ def fit_runs(views, cage, runs, movable, mirror_of, share, diag, tol=TOL):
|
|||
prepared.append((run["name"], views[run["view"]], line, W, source, np.stack([flip[chain], np.ones(len(chain)), np.ones(len(chain))], 1),
|
||||
column.reshape(-1, 3)[source])) # the parameter column of each chain point's coordinate, -1 where held
|
||||
p0 = V0.ravel()[index]
|
||||
A0, b0 = (np.eye(len(p0)), p0) if prior_rows is None else (np.asarray(prior_rows[0], float), np.asarray(prior_rows[1], float))
|
||||
if A0.ndim != 2 or A0.shape != (len(b0), len(p0)):
|
||||
raise ReferenceFitError(f"prior_rows must be (A, b) with a column of A per movable coordinate ({len(p0)}) and a row per entry of b")
|
||||
|
||||
def terms(p):
|
||||
"""(residual, Jacobian, each run's built points as drawn) at parameters p."""
|
||||
|
|
@ -603,7 +616,7 @@ def fit_runs(views, cage, runs, movable, mirror_of, share, diag, tol=TOL):
|
|||
res += [dist, u[0] - line[0], u[-1] - line[-1]]
|
||||
rows.append(block)
|
||||
drawn.append((u, dist))
|
||||
return np.concatenate(res + [prior * (p - p0)]), np.vstack(rows + [prior * np.eye(len(p))]), drawn
|
||||
return np.concatenate(res + [prior * (A0 @ p - b0)]), np.vstack(rows + [prior * A0]), drawn
|
||||
|
||||
p, lam, rounds = p0.copy(), 1e-3, 0
|
||||
r, J, drawn = terms(p)
|
||||
|
|
@ -730,6 +743,372 @@ def fit_sheet(document, cage, frame, traces, cams, share=0.1, tol=TOL):
|
|||
return {"sheet": out, "traces": report["traces"], "points": points}
|
||||
|
||||
|
||||
# --- a plate's first cage from its traces ------------------------------------------------------------------------------
|
||||
|
||||
FAIR = 0.2 # a side's second differences of this share of its chord cost what one pixel of miss does (0.02 held a bowed side straight; docs/reference.md)
|
||||
K_MAX = 6 # points a side grows to before its trace is refused as fit_runs refuses it
|
||||
SQUARE = 0.4 # the cosine between a plane's normal and a sight line under which a trace is not lifted onto it: past 66 degrees the lift stretches over 2.5 times
|
||||
START = 1.0 # a corner's views start it where one pixel moves their meeting point less than this x share x the plate's extent, the prior's own scale: past it the views alone hold the corner looser than the plane would. 1 is the prior's own unit, not a derived value: tests/test_reference.py BlockTests pins it between a plate that must block (its third corner starts at 0.831, views 16.5 degrees apart at Paladin's lens and range) and one that must be refused (11 degrees: it turns to blocked between 1.22 and 1.23)
|
||||
VIEWS = 0.2 # a prior_share under this: the views decide the point (fit_shell's line)
|
||||
FLARE, DROP, DOME = 0.05, 0.06, 0.017 # of the crown's extent (its two furthest points): a plate's skirt out from and back of its crown, and its centre's rise. A template's proportions, not readings: the crown is what is solved
|
||||
TRACE_KEYS = ("camera", "box", "frame", "from", "to", "side", "line")
|
||||
|
||||
|
||||
def _unit(v):
|
||||
v = np.asarray(v, float)
|
||||
return v / max(float(np.linalg.norm(v)), 1e-12)
|
||||
|
||||
|
||||
def _partner(frame, side):
|
||||
"""The frame a trace's side is seen through: the part's own, or for side -1 its reflection across the frame's
|
||||
x = 0 (the mirrored half of a plate, or the plate's partner on the other limb)."""
|
||||
F = np.array(frame, float)
|
||||
if side == -1:
|
||||
F[:3, 0] = -F[:3, 0]
|
||||
return F
|
||||
|
||||
|
||||
def _sight(cam, frame, pixel):
|
||||
"""A pixel's line of sight (origin, unit direction) in a frame's own coordinates."""
|
||||
o, d = ray(cam, pixel)
|
||||
inv = np.linalg.inv(np.asarray(frame, float))
|
||||
return inv[:3, :3] @ o + inv[:3, 3], _unit(inv[:3, :3] @ d)
|
||||
|
||||
|
||||
def triangulate(obs, seam=False):
|
||||
"""Where sight lines meet. `obs` is [(camera record, frame, side, pixel)]: the pixel each view draws one point
|
||||
of the frame at, side -1 a view of the point's reflection across x = 0. The midpoint of the sight lines, then
|
||||
Gauss-Newton on the reprojection; `seam` holds the point on x = 0, which one view then decides. Returns (the
|
||||
point in the frame, parallax_deg: the angle between the widest pair of sight lines, the worst reprojection miss
|
||||
in pixels, m_per_px: the most one pixel of error moves the point). One sight line and no seam is no point."""
|
||||
frames = [_partner(frame, side) for _, frame, side, _ in obs]
|
||||
rays = [_sight(cam, F, pixel) for (cam, _, _, pixel), F in zip(obs, frames)]
|
||||
free = [1, 2] if seam else [0, 1, 2]
|
||||
if len(rays) < 2 and not seam:
|
||||
raise ReferenceFitError("one sight line meets nothing: a point is triangulated from two or more views, or held on the mirror plane")
|
||||
A, b = np.zeros((3, 3)), np.zeros(3)
|
||||
for o, d in rays:
|
||||
P = np.eye(3) - np.outer(d, d)
|
||||
A, b = A + P, b + P @ o
|
||||
X = np.zeros(3)
|
||||
X[free] = np.linalg.lstsq(A[:, free], b, rcond=None)[0]
|
||||
|
||||
def terms(X):
|
||||
drawn = [_drawn(cam, F, X[None]) for (cam, _, _, _), F in zip(obs, frames)]
|
||||
if any(seen_ is None for seen_ in drawn):
|
||||
raise ReferenceFitError("the sight lines meet behind a camera")
|
||||
return np.concatenate([seen_[0][0] - np.asarray(pixel, float) for seen_, (_, _, _, pixel) in zip(drawn, obs)]), np.vstack([seen_[1][0] for seen_ in drawn])[:, free]
|
||||
|
||||
for _ in range(10):
|
||||
r, J = terms(X)
|
||||
X[free] -= np.linalg.lstsq(J, r, rcond=None)[0]
|
||||
r, J = terms(X)
|
||||
parallax = max((math.degrees(math.acos(min(1.0, abs(float(a[1] @ c[1]))))) for a in rays for c in rays), default=0.0)
|
||||
return X, parallax, float(np.abs(r).max()), float(math.sqrt(max(np.linalg.eigvalsh(np.linalg.pinv(J.T @ J)).max(), 0.0)))
|
||||
|
||||
|
||||
def plate_sheet(crown, corners, flare=FLARE, drop=DROP, dome=DOME, mirror=False, seam=(), facing=None):
|
||||
"""The free-cage document of a plate whose raised outline is `crown`, a closed ring of points in the plate's
|
||||
frame: the crown ring (vertices 0 to n - 1, in the ring's order), a skirt ring `flare` out from it and `drop`
|
||||
back of it (the chamfered wall), and one centre vertex `dome` proud of the ring's middle; the three are shares
|
||||
of the crown's extent, the distance between its two furthest points, so a plate of any size has the same
|
||||
proportions. Every crown side is
|
||||
creased 1; `corners` (ring indices) are pinned 1 on crown and skirt, so the crown between two corners is one
|
||||
hard run, and the points between them are free to round it. The centre is the cage's pole unless the ring has
|
||||
four points. `facing` is a direction the outer face looks along; the ring is taken as wound that way, or the
|
||||
sheet is flipped.
|
||||
|
||||
mirror: `seam` names the ring's points on x = 0 (one unbroken stretch of it). The crown between them is the
|
||||
crease the two halves meet at: it has no skirt, the skirt of its two ends stands on x = 0, and those ends are
|
||||
poles (six edges meet there once the half is reflected). The centre stands in the half, not on the plane: a
|
||||
face of three points of x = 0 is its own reflection and the cage's parser refuses it."""
|
||||
P = np.asarray(crown, float)
|
||||
n, seam = len(P), set(seam) if mirror else set()
|
||||
extent = float(np.linalg.norm(P[:, None] - P[None], axis=2).max())
|
||||
flare, drop, dome = flare * extent, drop * extent, dome * extent
|
||||
Q = np.roll(P, -1, axis=0)
|
||||
normal = _unit(np.cross(P, Q).sum(0)) # Newell's: the ring's own facing, counter-clockwise seen from where it points
|
||||
flip = facing is not None and float(normal @ np.asarray(facing, float)) < 0
|
||||
out_ = -normal if flip else normal
|
||||
middle = P.mean(0)
|
||||
walled = [i for i in range(n) if not (i in seam and (i - 1) % n in seam and (i + 1) % n in seam)] # a point inside the seam has no skirt
|
||||
skirt = {}
|
||||
for i in walled:
|
||||
away = (P[i] - middle) - out_ * ((P[i] - middle) @ out_)
|
||||
back = out_.copy()
|
||||
if i in seam:
|
||||
away[0], back[0] = 0.0, 0.0
|
||||
point = P[i] + _unit(away) * flare - back * drop
|
||||
if i in seam:
|
||||
point[0] = 0.0
|
||||
skirt[i] = point
|
||||
under = {i: n + m for m, i in enumerate(walled)}
|
||||
centre = n + len(walled)
|
||||
verts = [[round(float(x), 6) + 0.0 for x in p] for p in list(P) + [skirt[i] for i in walled] + [middle + out_ * dome]]
|
||||
faces, creases = [], []
|
||||
for i in range(n):
|
||||
j = (i + 1) % n
|
||||
faces.append([i, j, centre])
|
||||
creases.append([i, j, 1.0])
|
||||
if not (i in seam and j in seam):
|
||||
faces.append([under[i], under[j], j, i])
|
||||
pinned = [[i, 1.0] for i in corners] + [[under[i], 1.0] for i in corners if i in under]
|
||||
poles = ([] if n == 4 else [centre]) + sorted(i for i in seam if i in under)
|
||||
document = {"verts": verts, "faces": faces, "creases": creases, "corners": pinned, "poles": sorted(poles), "rim": 0.0}
|
||||
if mirror:
|
||||
document["mirror"] = True
|
||||
if flip:
|
||||
document["flip"] = True
|
||||
return document
|
||||
|
||||
|
||||
def block_plate(views, plate, traces, parse, plane=None, share=0.1, tol=TOL):
|
||||
"""A plate's first cage from traces of its outline across solved views; docs/reference.md, "block_plate".
|
||||
|
||||
plate {"corners": [names, in loop order], "mirror": bool, "seam": [corner names on x = 0]}: side i runs from
|
||||
corner i to corner i + 1 and is one hard crease of the crown
|
||||
traces [{"from", "to": two consecutive corners, "side": 1, or -1 for the mirrored half or partner, "line":
|
||||
[[u, v], ...] drawn from `from` to `to`}]; "camera", "box" and "frame" are the caller's and are echoed
|
||||
views per trace, (camera record, the 4 x 4 that carries the plate's coordinates to the world as that view
|
||||
poses the part): the plate's own frame, or the trace's "frame" where it states one
|
||||
parse brokkr_kitbash.core.sheet, the cage's one parser: every sheet built here goes through it
|
||||
plane {"point", "normal"} in the plate's coordinates, or None for the plane through the corners the views
|
||||
or the seam decide
|
||||
|
||||
The one correspondence is a trace's two ends to its named corners. The crown's points (the corners and each
|
||||
side's points between them) are solved by fit_runs: its residual on every trace, and for a prior each crown
|
||||
point's distance to the plane (one pixel per share x diag, diag the corners' extent) and each side's second
|
||||
differences (one pixel per FAIR x the side's chord). A distance to a plane does not resist a move in the
|
||||
plane, so the views decide wherever they see. A side starts as its two corners; a side with a trace not
|
||||
explained gains a point and the plate is solved again, to K_MAX points. Skirt and centre are rebuilt from the
|
||||
solved crown (plate_sheet). Returns {"sheet", "fit_traces", "left_out", "corners", "sides", "plane", "rounds"};
|
||||
raises ReferenceFitError naming the field for everything it refuses.
|
||||
|
||||
A corner starts where its views meet when a pixel moves that point less than START x share x the plate's
|
||||
extent; a seam corner where its sight line crosses x = 0, unless the line runs along the plane (SQUARE); any
|
||||
other on the plane, lifted and guarded by SQUARE. What decided a point is read after the solve from its
|
||||
prior_share, the same for every crown point: "plane" from VIEWS up (the prior holds its depth: the plane, and
|
||||
for a side's inner points its fairness), else "mirror" on the seam, else "views". corners[] and each side's
|
||||
"inner" (its points between corners) carry {"decided_by", "m_per_px", "prior_share"}; a side's own
|
||||
"decided_by" is "corners" with no inner point, "plane" when any inner point is, else its inner points'."""
|
||||
if not isinstance(plate, dict) or set(plate) - {"corners", "mirror", "seam"}:
|
||||
raise ReferenceFitError("plate must be {corners, mirror, seam}")
|
||||
names, mirror, seam_names = plate.get("corners"), plate.get("mirror", False), plate.get("seam", [])
|
||||
if not isinstance(names, list) or len(names) < 3 or not all(isinstance(name, str) and name for name in names) or len(set(names)) != len(names):
|
||||
raise ReferenceFitError("plate.corners must be three or more different names, in the outline's order")
|
||||
if not isinstance(mirror, bool):
|
||||
raise ReferenceFitError(f"plate.mirror must be true or false, not {mirror!r}")
|
||||
N, at = len(names), {name: i for i, name in enumerate(names)}
|
||||
if not isinstance(seam_names, list) or any(name not in at for name in seam_names) or len(set(seam_names)) != len(seam_names):
|
||||
raise ReferenceFitError("plate.seam must name corners of plate.corners, none twice")
|
||||
held = {at[name] for name in seam_names}
|
||||
if mirror != bool(held) or (mirror and (not 2 <= len(held) < N or sum(1 for i in held if (i + 1) % N not in held) != 1)):
|
||||
raise ReferenceFitError("plate.seam must name two or more corners next to each other in the outline, and not all of them, on a mirrored plate, and none otherwise: "
|
||||
"the halves meet along the sides between them. A plate that only has a partner across x = 0 is not mirrored: trace the partner with side -1")
|
||||
if not isinstance(traces, list) or not traces:
|
||||
raise ReferenceFitError("traces must be an array of one or more {camera, box, frame, from, to, side, line}")
|
||||
if len(views) != len(traces):
|
||||
raise ReferenceFitError(f"views must be one (camera, frame) a trace: {len(views)} for {len(traces)} traces")
|
||||
seen_by, per_side, runs_of, frames = [dict() for _ in names], [[] for _ in names], [], []
|
||||
for k, trace in enumerate(traces):
|
||||
where = f"traces[{k}]"
|
||||
if not isinstance(trace, dict) or set(trace) - set(TRACE_KEYS):
|
||||
raise ReferenceFitError(f"{where} must be {{camera, box, frame, from, to, side, line}}")
|
||||
a, b, side = trace.get("from"), trace.get("to"), trace.get("side", 1)
|
||||
if a not in at or b not in at:
|
||||
raise ReferenceFitError(f"{where}.from and .to must name corners of plate.corners, not {a!r} and {b!r}")
|
||||
step = (at[b] - at[a]) % N
|
||||
if step not in (1, N - 1):
|
||||
raise ReferenceFitError(f"{where}.from {a!r} and .to {b!r} are not consecutive corners: a trace is one side of the outline, drawn from one corner to the next")
|
||||
if side not in (1, -1) or isinstance(side, bool):
|
||||
raise ReferenceFitError(f"{where}.side must be 1, or -1 for the mirrored half or partner, not {side!r}")
|
||||
cam, frame = views[k]
|
||||
if cam is None:
|
||||
raise ReferenceFitError(f"{where}.camera {trace.get('camera')!r} is no camera of this plate")
|
||||
try:
|
||||
F = np.array(frame, float)
|
||||
except (TypeError, ValueError):
|
||||
F = np.zeros(0)
|
||||
if F.shape != (4, 4) or not np.isfinite(F).all() or np.abs(F[:3, :3].T @ F[:3, :3] - np.eye(3)).max() > 1e-5 or np.abs(F[3] - [0, 0, 0, 1]).max() > 1e-9:
|
||||
raise ReferenceFitError(f"{where}.frame must be a 4 x 4 that only turns and moves the part: a scaled or sheared frame is not metres of the plate")
|
||||
try:
|
||||
line = np.array(trace.get("line"), float)
|
||||
except (TypeError, ValueError):
|
||||
line = np.zeros(0)
|
||||
if line.ndim != 2 or line.shape[1] != 2 or len(line) < 2 or not np.isfinite(line).all() or np.linalg.norm(np.diff(line, axis=0), axis=1).sum() < 1e-9:
|
||||
raise ReferenceFitError(f"{where}.line must be two or more [u, v] points, not all in one place")
|
||||
F = _partner(F, side)
|
||||
frames.append(F)
|
||||
i = at[a] if step == 1 else at[b]
|
||||
per_side[i].append(k)
|
||||
runs_of.append((i, step == 1))
|
||||
view = (json.dumps([cam["C"], cam["R"], cam["f"], cam["c"]], default=float), F.tobytes())
|
||||
for corner, pixel in ((at[a], line[0]), (at[b], line[-1])):
|
||||
seen_by[corner].setdefault(view, (cam, F, [], k))[2].append(pixel)
|
||||
for i, name in enumerate(names):
|
||||
if not seen_by[i]:
|
||||
raise ReferenceFitError(f"plate.corners[{i}] {name!r}: no trace ends at it. Every corner is the end of a traced side")
|
||||
for i, name in enumerate(names):
|
||||
if not per_side[i]:
|
||||
raise ReferenceFitError(f"the side from {name!r} to {names[(i + 1) % N]!r} is traced in no view: every side of the outline is traced, or the plate is given fewer corners")
|
||||
lines = sum(len(json.dumps(trace.get("line"), separators=(",", ":"))) for trace in traces)
|
||||
size = 44 * (2 * N * (K_MAX - 1) + 1) + 34 * N * (K_MAX - 1) + 62 * N * (K_MAX - 2) + lines + 90 * len(traces) + 190 * N + 400
|
||||
if size > RESULT_LIMIT:
|
||||
raise ReferenceFitError(f"traces: the sheet and its report could be about {size} characters, over the {RESULT_LIMIT} a receipt carries: nothing was solved. "
|
||||
"Trace with fewer points, or block the plate as two")
|
||||
|
||||
start, parallax, decided, loose = np.zeros((N, 3)), np.zeros(N), np.zeros(N, bool), np.full(N, np.inf)
|
||||
obs = [[(cam, F, 1, np.mean(pixels, axis=0)) for cam, F, pixels, _ in seen_by[i].values()] for i in range(N)]
|
||||
for i in range(N):
|
||||
if len(obs[i]) >= 2:
|
||||
start[i], parallax[i], _, loose[i] = triangulate(obs[i], seam=i in held)
|
||||
met = np.isfinite(loose)
|
||||
if met.any(): # the plate's extent as its views draw it: the corners' pixels at the range of where the sight lines meet, which a depth error hardly moves
|
||||
middle, drawn = start[met].mean(0), {}
|
||||
for i in range(N):
|
||||
for view, (cam, F, pixels, _) in seen_by[i].items():
|
||||
drawn.setdefault(view, (cam, F, []))[2].append(np.mean(pixels, axis=0))
|
||||
extent = max(float(np.linalg.norm(np.ptp(pixels, axis=0))) * float(np.linalg.norm(_sight(cam, F, cam["c"])[0] - middle)) / cam["f"] for cam, F, pixels in drawn.values())
|
||||
decided = loose < START * share * extent
|
||||
for i in held: # x = 0 meets a sight line that crosses it; one that runs along it within what SQUARE allows a plane is no meeting
|
||||
if not decided[i] and max(abs(float(_sight(cam, F, np.mean(pixels, axis=0))[1][0])) for cam, F, pixels, _ in seen_by[i].values()) >= SQUARE:
|
||||
start[i], decided[i] = triangulate(obs[i], seam=True)[0], True
|
||||
if plane is None:
|
||||
if decided.sum() < 3:
|
||||
raise ReferenceFitError(f"plane: none was given, and {', '.join(repr(names[i]) for i in np.flatnonzero(~decided))} are decided by no view (seen by one only, by views so close that a pixel "
|
||||
f"moves where they meet over {START * share:g} of the plate's extent, or on the seam by a view that runs along x = 0): three corners the views or the seam "
|
||||
"decide make the plane. Give plane, or trace those corners in another view")
|
||||
point = start[decided].mean(0)
|
||||
_, spread, axes = np.linalg.svd(start[decided] - point)
|
||||
if spread[1] < 1e-6 * max(spread[0], 1e-12):
|
||||
raise ReferenceFitError("plane: none was given, and the corners the views decide stand in one line. Give plane")
|
||||
normal, source = axes[2], "corners"
|
||||
else:
|
||||
try:
|
||||
point, normal = np.array(plane["point"], float), np.array(plane["normal"], float)
|
||||
fine = point.shape == (3,) and normal.shape == (3,) and np.isfinite(point).all() and np.isfinite(normal).all() and np.linalg.norm(normal) > 1e-9
|
||||
except (TypeError, ValueError, KeyError):
|
||||
fine = False
|
||||
if not fine:
|
||||
raise ReferenceFitError("plane must be {point: [x, y, z], normal: [x, y, z]} in the plate's frame, the normal not zero")
|
||||
normal, source = _unit(normal), "given"
|
||||
for i in np.flatnonzero(~decided):
|
||||
lifted = []
|
||||
for cam, F, pixels, k in seen_by[i].values():
|
||||
o, d = _sight(cam, F, np.mean(pixels, axis=0))
|
||||
square = abs(float(normal @ d))
|
||||
if square < SQUARE:
|
||||
raise ReferenceFitError(f"plate.corners[{i}] {names[i]!r}: the plane stands {math.degrees(math.acos(square)):.0f} degrees off square-on to the view of traces[{k}], the "
|
||||
f"only depth this corner has. A trace lifted onto it stretches past {1 / SQUARE:g} times: turn plane to the face the view shows, or trace the corner in another view")
|
||||
lifted.append(o + d * (((point - o) @ normal) / (d @ normal)))
|
||||
start[i] = np.mean(lifted, axis=0)
|
||||
if i in held:
|
||||
start[i, 0] = 0.0
|
||||
free_ = [i for i in range(N) if i not in held]
|
||||
|
||||
def crossed(corners_, what):
|
||||
side_ = 1.0 if sum(1 for i in free_ if corners_[i, 0] > 0) * 2 >= len(free_) else -1.0
|
||||
for i in free_:
|
||||
if mirror and corners_[i, 0] * side_ <= 0:
|
||||
raise ReferenceFitError(f"plate.corners[{i}] {names[i]!r} {what} at x = {corners_[i, 0]:.3f}, across the mirror plane from the plate's other corners. A corner on the "
|
||||
"plane is named in plate.seam; one off it is traced where the views agree which side it is on")
|
||||
|
||||
crossed(start, "starts")
|
||||
diag = float(np.linalg.norm(np.ptp(start, axis=0)))
|
||||
toward = _sight(views[0][0], frames[0], np.asarray(traces[0]["line"], float)[0])[0] - start.mean(0)
|
||||
count, solves = [2] * N, 0
|
||||
while True:
|
||||
solves += 1
|
||||
first = np.concatenate([[0], np.cumsum([k - 1 for k in count])]) # ring index of each corner; first[N] is the ring's size
|
||||
n = int(first[N])
|
||||
ring = np.concatenate([np.linspace(start[i], start[(i + 1) % N], count[i])[:-1] for i in range(N)])
|
||||
chains = [[int(first[i]) + m for m in range(count[i] - 1)] + [int(first[i + 1]) % n] for i in range(N)]
|
||||
on_seam = {v for i in range(N) if i in held and (i + 1) % N in held for v in chains[i]} | {int(first[i]) for i in held}
|
||||
build = lambda crown: plate_sheet(crown, [int(first[i]) for i in range(N)], mirror=mirror, seam=sorted(on_seam), facing=toward) # noqa: E731
|
||||
|
||||
def parsed(document):
|
||||
try:
|
||||
return parse(document)
|
||||
except Exception as refusal: # the parser's own error type is its package's
|
||||
raise ReferenceFitError(f"sheet: the cage's parser does not take the plate as blocked ({refusal})") from None
|
||||
|
||||
cage = parsed(build(ring))
|
||||
movable = np.zeros((len(cage.V), 3), bool)
|
||||
movable[:n] = True
|
||||
movable[sorted(on_seam), 0] = False
|
||||
index = np.flatnonzero(movable.ravel())
|
||||
column = np.full(movable.size, -1)
|
||||
column[index] = np.arange(len(index))
|
||||
column = column.reshape(-1, 3)
|
||||
V0, A, b = np.asarray(cage.V, float), [], []
|
||||
|
||||
def row(parts, weight):
|
||||
"""One prior row: weight x the sum of factor x coordinate over `parts`, the held coordinates on its right side."""
|
||||
line_, right = np.zeros(len(index)), 0.0
|
||||
for v, c, factor in parts:
|
||||
if column[v, c] >= 0:
|
||||
line_[column[v, c]] += weight * factor
|
||||
else:
|
||||
right -= weight * factor * V0[v, c]
|
||||
A.append(line_)
|
||||
b.append(right)
|
||||
|
||||
for v in range(n):
|
||||
row([(v, c, normal[c]) for c in range(3)], 1.0)
|
||||
b[-1] += float(normal @ point)
|
||||
for i, chain in enumerate(chains):
|
||||
fair = share * diag / (FAIR * max(float(np.linalg.norm(start[(i + 1) % N] - start[i])), 1e-9))
|
||||
for m in range(1, len(chain) - 1):
|
||||
for c in range(3):
|
||||
row([(chain[m - 1], c, 1.0), (chain[m], c, -2.0), (chain[m + 1], c, 1.0)], fair)
|
||||
runs = [{"name": f"traces[{k}]", "chain": chains[i] if forward else chains[i][::-1], "view": k, "line": trace["line"]} for k, (trace, (i, forward)) in enumerate(zip(traces, runs_of))]
|
||||
try:
|
||||
V, report = fit_runs([(cam, F) for (cam, _), F in zip(views, frames)], cage, runs, movable, cage.mirror_of, share, diag, tol, prior_rows=(np.array(A), np.array(b)))
|
||||
except ReferenceFitError as refusal:
|
||||
rows = getattr(refusal, "traces", None)
|
||||
if rows is None:
|
||||
raise
|
||||
grow = sorted({runs_of[k][0] for k, row_ in enumerate(rows) if row_["unexplained_px"] > tol})
|
||||
full = [i for i in grow if count[i] >= K_MAX]
|
||||
if full:
|
||||
error = ReferenceFitError(f"the side from {names[full[0]]!r} to {names[(full[0] + 1) % N]!r} is not explained at {K_MAX} points, the most a side is given: {refusal}")
|
||||
error.traces = rows
|
||||
raise error from None
|
||||
for i in grow:
|
||||
count[i] += 1
|
||||
continue
|
||||
break
|
||||
crown = V[:n]
|
||||
crossed(crown[first[:N]], "ends")
|
||||
document = build(crown)
|
||||
parsed(document)
|
||||
by_vertex = {row_["vertex"]: row_ for row_ in report["points"]}
|
||||
|
||||
def decided_at(v):
|
||||
"""What decided a crown point's depth, by its prior share: the prior (the plane, and a side's fairness) from VIEWS up, whatever the point is."""
|
||||
row_ = by_vertex[v]
|
||||
return {"decided_by": "plane" if row_["prior_share"] >= VIEWS else "mirror" if v in on_seam else "views", "m_per_px": round(row_["m_per_px"], 4), "prior_share": round(row_["prior_share"], 3)}
|
||||
|
||||
corners = []
|
||||
for i, name in enumerate(names):
|
||||
said = decided_at(int(first[i]))
|
||||
corners.append({"name": name, "decided_by": said["decided_by"], "parallax_deg": round(float(parallax[i]), 1), "m_per_px": said["m_per_px"], "prior_share": said["prior_share"]})
|
||||
sides = []
|
||||
for i in range(N):
|
||||
inner = [decided_at(v) for v in chains[i][1:-1]]
|
||||
sides.append({"from": names[i], "to": names[(i + 1) % N], "points": count[i], "inner": inner,
|
||||
"decided_by": "corners" if not inner else "plane" if any(point["decided_by"] == "plane" for point in inner) else inner[0]["decided_by"],
|
||||
"traces": [report["traces"][k] for k in per_side[i]]})
|
||||
fit_traces, left_out = [], []
|
||||
for k, (trace, (i, forward)) in enumerate(zip(traces, runs_of)):
|
||||
if (trace.get("side", 1) == -1 and not mirror) or trace.get("frame") is not None:
|
||||
left_out.append(k) # fit_shell takes one frame, the shell's own, and side -1 only as a mirrored sheet's other half
|
||||
continue
|
||||
fit_traces.append({**{key: trace[key] for key in ("camera", "box") if key in trace}, "run": {"verts": chains[i] if forward else chains[i][::-1]}, "side": trace.get("side", 1), "line": trace["line"]})
|
||||
return {"sheet": document, "fit_traces": fit_traces, "left_out": left_out, "corners": corners, "sides": sides,
|
||||
"plane": {"point": [round(float(x), 6) for x in point], "normal": [round(float(x), 6) for x in normal], "from": source}, "rounds": solves}
|
||||
|
||||
|
||||
# --- fields ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,10 @@ Behaviour the table does not say, per action:
|
|||
|
||||
- `createObject`: a `MESH` is a cube of `size`. `lightType`, `emptyDisplayType` and `meshType` apply
|
||||
only to their own `objectType`.
|
||||
- `setObjectParent`: an empty or absent `parentObjectName` clears the parent.
|
||||
- `setObjectParent`: an empty or absent `parentObjectName` clears the parent. Before it writes, each enabled
|
||||
add-on that defines `brokkr_parent_refusal(object, parent)` is asked, and a reason it answers refuses the
|
||||
intent with nothing changed (`brokkr_kitbash` answers its one-driver rule over the loops the object is part
|
||||
of or stands above, `docs/kitbash.md`; an object no loop hangs from is never refused by it).
|
||||
- `importGltf`: `filepath`, `.gltf` or `.glb`, relative to the add-on preference
|
||||
`Import Directory` (absolute paths, `..` and symlinks that resolve outside it are
|
||||
refused). Empty `Import Directory` disables the action. Needs Blender's glTF add-on.
|
||||
|
|
|
|||
|
|
@ -176,8 +176,8 @@ matrix_basis = S_parent @ T(0, 0, slide) @ Rz(roll) @ FLIP @ inverse(S_child)
|
|||
```
|
||||
|
||||
with `S` each socket's frame in its own part at that part's stored params (`core.mate`); a turn about z and a move
|
||||
along it commute, so one connection carries both. `attach`, `set_params`, `roll`, `aim`, `reach`, `slide` and
|
||||
`joint` write it; nothing else should.
|
||||
along it commute, so one connection carries both. `attach`, `set_params`, `roll`, `aim`, `reach`, `slide`,
|
||||
`joint` and `follow` write it; nothing else should.
|
||||
|
||||
**Joint records.** A connection's degree of freedom is its parent socket's type's: a socket type states
|
||||
`"dof": "revolute"` (the child turns about the socket's z: `pivot`), `"dof": "prismatic"` (it slides along it:
|
||||
|
|
@ -191,14 +191,91 @@ roll is a build angle. Beside the value the child's connection carries a record:
|
|||
| `kit_min`, `kit_max` | the limits of the value, both or neither: degrees on a revolute joint (a span of at most 360, each end within 360 of 0), metres on a prismatic one (each end within 10 m of 0) | `joint` |
|
||||
| `kit_mechanism` | a label of 1 to 32 `a-z`, `0-9` and `_`: which mechanism the joint is (`knee`, `shock`) | `joint` |
|
||||
| `kit_compliance` | `{"hertz", "damping_ratio"}` (hertz over 0 to 30, damping ratio 0 to 2): a slide in the load path that settles and rebounds under load. Prismatic only, and it needs limits, the travel it settles within | `joint` |
|
||||
| `kit_follows`, `kit_follows_driver` | that the value is derived from another joint's: `{"kind": "ratio", "k", "offset"}` or `{"kind": "loop"}`, and an ID pointer to the driver, which follows a rename | `follow` |
|
||||
|
||||
Every one of them is written by one function, `write_connection`, which `attach`, `roll`, `aim`, `reach`, `slide`
|
||||
and `joint` all seat through; `detach` clears them with the connection. So the limits have one check: a value with
|
||||
no representative inside them is refused before anything is written, naming value and limits, and a roll a turn
|
||||
away from its limits is written as the roll inside them (limits 150 to 210 and a roll of -170: 190). `aim` inside
|
||||
limits takes the free roll when the limits hold it and otherwise the end that points the axis nearer; `reach`
|
||||
takes only a root inside them. A new connection states no record. A value written by hand outside its limits
|
||||
reads `within: false` in every report and the next pose of that part is refused.
|
||||
Every one of them is written by one function, `write_connections`, which `attach`, `set_params`, `roll`, `aim`,
|
||||
`reach`, `slide`, `joint` and `follow` all seat through; `detach` clears them with the connection. It takes
|
||||
several connections and checks every one before it writes any, so a driver and its followers are written together
|
||||
or not at all. So the limits have one check: a value with no representative inside them is refused before anything
|
||||
is written, naming value and limits, and a roll a turn away from its limits is written as the roll inside them
|
||||
(limits 150 to 210 and a roll of -170: 190). `aim` inside limits takes the free roll when the limits hold it and
|
||||
otherwise the end that points the axis nearer; `reach` takes only a root inside them. A new connection states no
|
||||
record. A value written by hand outside its limits reads `within: false` in every report; a pose that puts it
|
||||
inside them is accepted and clears that, and `set_params` of the part or of its parent is refused until then, as
|
||||
it is for a slide written by hand on a connection that is not prismatic. A record written by hand that its
|
||||
connection may not carry (a compliance on a revolute joint) reads null in every report and goes at the next write.
|
||||
|
||||
**Followers.** A joint whose value is a function of another's is a follower, and `follow` states it. A follower has
|
||||
exactly one driver and a driver is never a follower (aetheria-release:ruling:one-joint-one-driver); `roll`, `aim`,
|
||||
`reach` and `slide` on a follower are refused naming its driver, and `joint` on one states limits and a mechanism
|
||||
and keeps the derived value. Posing a driver derives every follower in the same action and writes them with it: a
|
||||
follower outside its own limits, or a loop that cannot close, refuses the pose with nothing changed.
|
||||
|
||||
| Kind | The follower's value | For |
|
||||
| --- | --- | --- |
|
||||
| `ratio` | `k` x the driver's value + `offset`, either joint revolute or prismatic (a slide following a roll has `k` in metres per degree). The driver states limits, so its value is one number and not one of many a turn apart | a kneecap on the bisector (`k` 0.5), lames at `k/n` of the knee, a pinion at minus ring over pinion, a crosshead |
|
||||
| `loop` | solved: the part that states a closure and its parent both follow, and their two values are the ones at which the closure holds | a rocker and coupler closing on a crank; a ram's barrel and rod closing on the part it pushes; a torque link's two arms |
|
||||
|
||||
A loop has exactly two unknowns, the closing part's joint and its parent's, and it is planar: each revolute pin is
|
||||
parallel to the pin it closes on and each slide runs across it. Exactly one of its two ends (the parent's parent,
|
||||
and the part closed on) moves with the driver: it is the driver, follows it, or hangs from one that does. And the
|
||||
driver is the only input the two ends depend on: every revolute or prismatic joint between an end and the part the
|
||||
two ends share (or the root, when they share none) is the driver, follows it, or is held by limits of one value. A
|
||||
joint there that follows another driver, or that follows nothing and has travel, is a second driver: a pose of it
|
||||
would open the loop, and nothing here solves a loop for two drivers. The rule is read before each write, over
|
||||
each loop the write touches, as the scene would stand after it (`one_driver`, asked by the one writer of
|
||||
connections, by `set_params` before it rebuilds a mesh, by `detach` and by Brokkr's `setObjectParent`), so it holds
|
||||
after the loop is stated as it does when `follow` states it. A write touches a loop when a part it writes is the
|
||||
closing follower, the part closed on or the driver, or one of those hangs from it; no other write can change what
|
||||
the loop's ends depend on, and no other loop is read. Each of these is refused with
|
||||
nothing changed, naming the loop's driver and each other one: `attach` of an end's root on a pin or a slide,
|
||||
`detach` of a part between an end and the part both ends hang from, `follow` with null on a follower between the
|
||||
ends, `joint` widening or clearing limits that held a pin there, `setObjectParent` giving or clearing a parent
|
||||
between the ends, and any write that touches the loop once such a joint was written by hand. To change a mechanism between a loop's ends, give the new joint its one driver or its one value first, or
|
||||
clear the loop and state it again. A loop whose driver is detached is derived by nothing and is not read; the
|
||||
attach that gives the driver a connection again reads it. A torque link is the case for limits of one value: a
|
||||
real torque link exists to stop the rod rolling in its barrel, so its lug has no travel, and a strut pinned to
|
||||
the rod's end and held by limits `[90, 90]` is that lug (a strut's two pins face one way, so the lower arm cannot
|
||||
close on the rod's own pin). The lug is held before the arms follow the rod's slide. Nothing
|
||||
stores a pin position or a linkage record: `core.close_loop` solves the pair from the kits' socket frames at the
|
||||
parts' stored params each time, by Newton's method on the closing pin's error in the loop's plane with the analytic
|
||||
Jacobian. That is the position analysis of the kinematics texts (Nikravesh, *Computer-Aided Analysis of Mechanical
|
||||
Systems*, 1988, ch. 4; Uicker, Pennock and Shigley, *Theory of Machines and Mechanisms*); the ratio is Box2D's
|
||||
`b2GearJoint` and Jolt's `GearConstraint` and `RackAndPinionConstraint`. A loop has two assembly branches and
|
||||
Newton finds the one nearest its seed, so a driver steps to its new value 5 degrees or 0.02 m at a time, each solve
|
||||
seeded by the one before, and only the last step is written: the linkage stays on the branch it was built on.
|
||||
Loops are solved in an order where a loop's base and the part it closes on are already placed (a ram closing on a
|
||||
four-bar's rocker waits for the four-bar); loops that wait on each other are refused. At a dead centre, where the
|
||||
pair's two joints move the closing pin along one line, the pose is refused naming the driver's value and the
|
||||
closing part: the bound is 0.093 on the smaller singular value of the Jacobian with each column scaled by its lever.
|
||||
For two revolute joints the columns are unit vectors and the reading is the two joints within about 7.6 degrees of
|
||||
in line (the four-bar of `tests/test_kitbash.py` reads 0.184 at its last accepted step and 0.047 at the first
|
||||
refused one). A ram's dead centre is its rod's end on its barrel's pin, where the barrel's roll is undefined, and
|
||||
its two columns are across each other everywhere else, so the barrel's column is scaled by its lever with the slide
|
||||
at 0 and the reading is the ram's lever over its closed lever: a ram drawn in to 0.184 of its closed lever is
|
||||
accepted and one at 0.047 refused. The sign of the Jacobian's determinant about the pin is the assembly branch (an
|
||||
elbow bent one way or the other, a rod's end on one side of its barrel's pin or the other), and a Newton step that
|
||||
lands on the other sign from its seed is refused as past the dead centre, so no pose answers the other branch.
|
||||
A ram whose limits keep its slide clear of minus its closed length never comes near either: its slide leaves its
|
||||
limits first. One whose limits reach that far is refused by the bound above before it leaves them.
|
||||
|
||||
What followers give up: a loop of three or more unknowns, or one out of a plane, is not solved (follow-up
|
||||
`kit-follows-wider-loops`); a follower does not drive another; `set_params` never derives a follower again, so a
|
||||
loop it opens reads `holds: false` until its driver is posed; and a loop
|
||||
with a second driver (a limit widened by hand, a parent set in Blender's own interface, a saved file) refuses
|
||||
every write that touches it (a write of a connection, a `set_params` or a `setObjectParent` of one of its parts
|
||||
or of a part it hangs from, whether or not that write is the fault) until the joint is held again, follows the
|
||||
driver, or the loop is cleared. A write that touches no such loop is made: a camera, an empty or a part of
|
||||
another mechanism is posed and given a parent as before, and so is an object parented under a part of the loop. A connection's row in a report carries `follows: {driver, kind, k, offset, holds, reason}`:
|
||||
`holds` is false, with a reason, when the value stands off the ratio, the loop has more than one driver, the loop's
|
||||
closure does not hold, or the driver is gone or states no revolute or prismatic connection. A loop with a second
|
||||
driver reads `holds: false` on both its followers whether or not its closure stands closed, and the reason names
|
||||
the loop, its driver and each other one: the remedy is to hold that joint, have it follow the driver or clear the
|
||||
loop, not to pose the driver. The joints report lists the same loops in `manyDrivers`. Both read the scene as it
|
||||
stands by the reading the refusals use, so a second driver that no action wrote is told by the next report and
|
||||
not first by a refused write. Detaching a driver leaves its followers'
|
||||
statements; detaching a loop follower clears its partner's. No Blender driver or constraint is made: a follower's
|
||||
pose is its stored value, as every connection's is.
|
||||
|
||||
Limits and springs follow Box2D v3's `b2PrismaticJointDef` and Jolt's `SliderConstraintSettings`: the slide's
|
||||
limits and a spring as a frequency in hertz and a damping ratio sit on the joint itself. Frequency and damping
|
||||
|
|
@ -211,24 +288,49 @@ is the parent tree. `brokkr_kitbash.joints` derives both at each call and emits
|
|||
nothing:
|
||||
|
||||
```json
|
||||
{"schema": "brokkr.joints", "version": 1, "root": "Tank", "frame": "the root object's: Blender axes (+Z up), metres",
|
||||
"rigid": 2, "joints": [
|
||||
{"schema": "brokkr.joints", "version": 2, "root": "Tank", "frame": "the root object's: Blender axes (+Z up), metres",
|
||||
"rigid": 2, "unlimited": ["Barrel"], "manyDrivers": [], "next": null, "joints": [
|
||||
{"id": "Strut", "parent": null, "part": "strut", "socket": "Mount:pivot", "kind": "revolute",
|
||||
"axis": [0.0, 1.0, 0.0], "origin": [0.436, 0.0, 0.85368], "value": -113.019997, "limits": [-116.02, -40.02],
|
||||
"min": -3.000003, "max": 72.999997, "mechanism": "knee", "compliance": null},
|
||||
"min": -3.000003, "max": 72.999997, "mechanism": "knee", "compliance": null, "held": false, "driven": null},
|
||||
{"id": "Cap", "parent": "Strut", "part": "strut", "socket": "Strut:end_a_back", "kind": "revolute",
|
||||
"axis": [0.0, -1.0, 0.0], "origin": [0.436, -0.09, 0.85368], "value": -56.509999, "limits": null,
|
||||
"min": null, "max": null, "mechanism": null, "compliance": null, "held": false,
|
||||
"driven": {"by": "Strut", "kind": "ratio", "k": 0.5, "offset": 0.0}},
|
||||
{"id": "Rod", "parent": "Barrel", "part": "ram_rod", "socket": "Barrel:bore", "kind": "prismatic",
|
||||
"axis": [0.97429, 0.0, 0.225296], "origin": [1.072572, 0.124, 1.312762], "value": 0.12, "limits": [0.0, 0.3],
|
||||
"min": -0.12, "max": 0.18, "mechanism": "shock", "compliance": {"damping_ratio": 0.7, "hertz": 4.0}}]}
|
||||
"min": -0.12, "max": 0.18, "mechanism": "shock", "compliance": {"damping_ratio": 0.7, "hertz": 4.0},
|
||||
"held": false, "driven": null}]}
|
||||
```
|
||||
|
||||
A row per revolute or prismatic connection under the root, depth first with children by name, so a row's parent
|
||||
comes before it. `parent` is the nearest joint above, not the object the part hangs from: rigid connections fold
|
||||
into it and are counted in `rigid`. `axis` and `origin` are the parent socket's z and origin in the root object's
|
||||
comes before it; a root that itself states a revolute or prismatic connection has its own row first, with `parent`
|
||||
null, so a report of a sub-tree carries the joint the sub-tree hangs by. `parent` is the nearest joint above, not
|
||||
the object the part hangs from: rigid connections fold into it and are counted in `rigid`. `axis` and `origin` are the parent socket's z and origin in the root object's
|
||||
frame. `min` and `max` are the limits less the value, the travel either way from the pose the report was taken at,
|
||||
which is the shape of Aetheria's `ShipJoint` (`Min` and `Max` about rest). What the report gives up: it is the
|
||||
pose at the call, so rest is whatever the assembly stood at; it carries no meshes or bone names, so a consumer
|
||||
joins rows to the exported objects by `id`; and `ShipJoint` has no slide and no spring yet
|
||||
(aetheria-release:question:shipjoint-prismatic-dof), so a prismatic row has no Aetheria reader today.
|
||||
which is the shape of Aetheria's `ShipJoint` (`Min` and `Max` about rest). `held` is true when the limits are of
|
||||
one value: the joint has no travel (a torque link's lug held at `[90, 90]`), its `min` and `max` are 0, and the
|
||||
rig generator will make a fixed bone for it and not a degree of freedom (nothing reads joints rows yet:
|
||||
`brokkr_rig` reads meshes); a held row is in neither `unlimited` nor `rigid`. `held` is computed from the limits
|
||||
alone and is not the free `mechanism` label: a joint labelled `"held"` that has travel reads `held: false`. `driven` is null, or what the row follows
|
||||
(`by` the driver's id, `kind`, `k`, `offset`): a driven row's value is derived, so the rig generator will make a
|
||||
driven bone for it and not a degree of freedom. `unlimited` lists the ids of the rows this report carries that are not driven and
|
||||
state no limits, so an exporter that needs limits on every degree of freedom refuses by reading one field of each
|
||||
report. `manyDrivers` lists each loop with more than one driver that has a part in the tree under the root (its
|
||||
closing part, that part's parent, the part closed on, the base, or one of its drivers), as
|
||||
`{"loop": the closing part, "drivers": [the loop's driver, each other one]}` by the closing part's name: its
|
||||
driven rows are not a function of one driver, so a rig generator refuses the tree while the list is not empty. It
|
||||
is of the whole tree, as `rigid` is, and every page carries it. A tree whose rows a receipt cannot carry (about 60 rows, 33 with names of 62 characters) is read in pages:
|
||||
`jointsOmitted` counts the rows left off, `next` is then the id of the last row carried, and a call with `after`
|
||||
set to it carries the rows that follow, with their own `unlimited`. A row and its id in `unlimited` are kept or left
|
||||
off together, so a report is never over a receipt and always carries a row.
|
||||
|
||||
`ShipJoint` is ruled to gain a kind per degree of freedom and an optional spring
|
||||
(aetheria-release:ruling:shipjoint-gains-kind-and-spring), and the rows map to it one to one: `revolute` is its
|
||||
`rotate` and `prismatic` its `slide`, with slide limits in metres, and `compliance` is its spring's hertz and
|
||||
damping ratio. Brokkr keeps the kinematics names, which its kits' socket types state. What the report gives up: it
|
||||
is the pose at the call, so rest is whatever the assembly stood at, and it carries no meshes or bone names, so a
|
||||
consumer joins rows to the exported objects by `id`.
|
||||
|
||||
**What may mate** (`core.mate_refusal`): two sockets of one type whose sizes agree as the type's
|
||||
`match` says: `equal` within 1 percent of the larger, `fits` with the child at most the parent. Socket types are a
|
||||
|
|
@ -341,7 +443,9 @@ that breaks one (a `pipe_r` that no longer matches the flange it is bolted to) i
|
|||
connection.
|
||||
|
||||
**Drift.** `setObjectTransform` and `setObjectParent` are Brokkr's own rows and can move or re-parent an attached
|
||||
child. Reports show it: a part's `connection` is `null`, or
|
||||
child; `setObjectParent` refuses only a parent that would give a stated loop a second driver, or the parent of a
|
||||
part a loop that already has one hangs from ("Followers").
|
||||
Reports show it: a part's `connection` is `null`, or
|
||||
|
||||
```json
|
||||
{"parent": "Tee", "socket": "mount", "parentSocket": "c", "roll": 37.0, "residual": 2.1e-07, "holds": true}
|
||||
|
|
@ -413,8 +517,8 @@ off in viewports and renders. Nothing is removed: the cutter objects stay, a cut
|
|||
is attached to it, and `booleans` still lists what cuts the object. The frozen mesh's material slots are the
|
||||
object's own (an empty one it had included), followed by any a cutter brought; faces a cutter made from an empty
|
||||
slot of its own take the first slot. A frozen kit part keeps `kit_kit`, `kit_part`, `kit_params` and its
|
||||
connections: its sockets are still derived from the params, so `attach`, `detach`, `roll`, `aim`, `reach` and
|
||||
`close` work on it and on what hangs from it. `freeze` reports the part (or `object`), `frozen`, `faces` (the live
|
||||
connections: its sockets are still derived from the params, so `attach`, `detach`, `roll`, `aim`, `reach`, `joint`,
|
||||
`slide`, `joints`, `follow` and `close` work on it and on what hangs from it. `freeze` reports the part (or `object`), `frozen`, `faces` (the live
|
||||
mesh's count, as in every report), `evaluated: {faces, volume, nonManifoldEdges}` (the frozen mesh), `modifiers`
|
||||
and `booleans`. `report` on a frozen part gives `faces`, still the live mesh's, and `evaluated: {faces}`, the
|
||||
frozen mesh's.
|
||||
|
|
@ -833,6 +937,308 @@ evaluate, but deleting the copy costs the same whole evaluation (1.44 to 1.54 s
|
|||
included, and the hole cut's temporary objects must be deleted too. So a hull with twenty cutters pays their
|
||||
evaluation once for every `ribs` call; iterate planes on the cage before it is cut, or with its Booleans off.
|
||||
|
||||
## Hard plates
|
||||
|
||||
`brokkr_kitbash/plate.py` owns a hard armour plate's geometry: a convex faceted solid, every facet flat, with
|
||||
raised detail panels, a bolt inside each panel corner, and the frames of what stands on it. It is numpy and the
|
||||
standard library, as `core.py` and `route.py` are: `plate.check(document)` and `plate.build(table, side=1)`.
|
||||
`brokkr_kitbash.plates` (The action, below) writes what `build` returns into the scene and decides none of it. A
|
||||
plate the concept draws curved is a shell (Making a shell); the two do not call each other.
|
||||
|
||||
A plate table is a data document:
|
||||
|
||||
```json
|
||||
{"schema": "brokkr.plates.v0", "plates": [
|
||||
{"name": "Thigh.Shield", "mat": "khaki", "bevel": 0.022,
|
||||
"slab": {"at": [0.02, 0.9, -0.5], "normal": [0.06, 1, 0.05], "up": [0, 0, 1], "right": [1, 0, 0],
|
||||
"outline": [[-0.42, 0.98], [0.42, 0.98], [0.66, 0.5], [0.66, -0.52], [0.42, -1.0], [-0.42, -1.0], [-0.66, -0.52], [-0.66, 0.5]],
|
||||
"thick": 0.26, "taper": 0.04},
|
||||
"clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.05, 0.05], "inset": 0.075, "gap": 0.045, "split": 99.0, "seed": 948708},
|
||||
"fits": [{"kind": "mark", "id": "tri", "at": [0.0, -0.05], "height": 0.5}]}
|
||||
]}
|
||||
```
|
||||
|
||||
Coordinates are metres in the table's own frame. The module never sees a host or a world: whoever stands the
|
||||
plates somewhere owns that matrix. The table alone decides the result. A table holds 1 to 256 rows.
|
||||
|
||||
### A row
|
||||
|
||||
| key | value |
|
||||
| --- | --- |
|
||||
| `name` | 1 to 48 of `a-z A-Z 0-9 _ .`, unique among the plates built |
|
||||
| `mat` | a material name, 1 to 63 characters; the caller resolves it |
|
||||
| `bevel` | 0 to 0.1 (default 0): the width of the chamfer the caller's Bevel gives every edge; carried, not built |
|
||||
| `sides` | `"one"` (default) or `"both"`: built at `side` and at `-side`, named `<name>.R` at side +1 and `<name>.L` at -1 |
|
||||
| `mirror` | `true`: the solid is the hull of its points and their x-mirrors, one solid across x = 0 |
|
||||
| one solid form | `faces`, `slab`, `sections` or `points` (below) |
|
||||
| `clad` | `null` or the detail plating (below) |
|
||||
| `face` | `{at, normal, up, right}`: the face anchors stand on, for a row that is not a slab |
|
||||
| `fits` | anchors and fittings (below) |
|
||||
|
||||
`mirror` and `sides` are independent. A two-sided row with one seed, or with no clad, is drawn once, at side +1,
|
||||
and its `.L` is the mirror of its `.R`: the same facets in the same order, the same cuts and lifts, every face
|
||||
wound the other way from the vertex it started at. Everywhere else, which is a one-sided row built at side -1 and
|
||||
a two-sided row with a pair of seeds, side -1 negates x of every point before the hull is built, and facets, ties
|
||||
and draws are those of the mirrored solid as built. That is not the mirror of side +1's panels even under the
|
||||
same seed: a cut is measured along its edge in the facet's winding, which a mirror reverses, and a tie goes to the
|
||||
greater x of the mirrored solid. The mech tracks' builders work this way (paladin's left thigh is its right
|
||||
thigh's table at side -1 with the same seeds, and its split panels are cut at the other share), and the fixtures
|
||||
hold `build` to them.
|
||||
|
||||
### Solid forms
|
||||
|
||||
Each form gives points; the plate is their convex hull.
|
||||
|
||||
- `faces`: 4 to 32 half-spaces, each `{at, normal}` (kept where `n . p <= n . at`) or
|
||||
`{through: [a, b, c], out}` (the plane through three points, outward toward `out`). The corners are every three
|
||||
faces' meeting point that lies inside all the others within 1e-6 m. Refused with fewer than four corners or a
|
||||
corner 1000 m or more away.
|
||||
- `slab`: `{at, normal, up, right, outline, thick, taper, back, gap}`. The outline is drawn on the plane through
|
||||
`at` facing `normal`, in (a, b): b is `up` projected into the plane, a is b cross normal, turned toward `right`
|
||||
where one is given. `outline` is 3 to 64 `[a, b]` points in either winding, or `{w, h, clip}`: a w by h
|
||||
rectangle with its corners cut by `clip`. The outline is drawn in by `gap` (default 0) on every edge; the outer
|
||||
face is that ring moved in by `taper` (default 0.04); the ring itself stands `taper` behind the face; the back
|
||||
ring stands `thick` behind, scaled by `back` (default 1) about the ring's middle (the mean of its points).
|
||||
- `slab` by corners: `{corners, names, inside, lift, thick, taper, back, gap, up}`. `corners` is 3 to 64 points;
|
||||
the outer face is their least-squares plane, outward away from `inside`, standing `lift` (default 0.06) off
|
||||
it; the outline is the corners in that plane's frame (`core.surface_frame` at centre + normal x lift). `names`
|
||||
is optional, one distinct name per corner, so a plate blocked by `brokkr_reference.block_plate` can become a
|
||||
row. Corners that stand off their plane by more than 0.05 of their extent (the greatest distance between two
|
||||
of them) are refused: that is not a plate.
|
||||
- `sections`: 2 to 16 `[z, w, y0, y1, c]`, each a rectangle w across x from y0 to y1 at height z with its corners
|
||||
cut c: a housing down a limb.
|
||||
- `points`: 4 to 64 `[x, y, z]`.
|
||||
|
||||
Where each came from on the three mech tracks: `faces` is bastion's carapace (`massing.corners`), `slab` paladin's
|
||||
limb armour (`massing.slab_points`) with raptor's `gap`, the corners slab raptor's hull plates
|
||||
(`raptor_body.wedge_plate`), `sections` paladin's and raptor's limb housings, `points` all three.
|
||||
|
||||
### The hull and its facets
|
||||
|
||||
The module builds the hull itself. A facet is every plane through three points that has all points on its inner
|
||||
side, taken once for the set of points on it and ordered by angle about their middle. Then two rules, both at
|
||||
0.5 degrees: adjacent facets whose normals are closer than that are one facet, and a vertex left with two edges
|
||||
that turn less than that is dropped.
|
||||
|
||||
Facets are ordered by area, largest first; areas within 1e-9 m2 tie and go to the greater centre by x, then y,
|
||||
then z (the centre is the mean of the facet's vertices). The order is computed on the solid as built in the table
|
||||
frame, never from where the plate stands or from a mesh's order, and it decides which facet draws from the seed
|
||||
first.
|
||||
|
||||
### Clad
|
||||
|
||||
`clad` raises a panel on each chosen facet:
|
||||
|
||||
| key | value |
|
||||
| --- | --- |
|
||||
| `mat` | the panels' material |
|
||||
| `facets` | `"outer"` (a slab's default): facets whose normal on the face's normal is over 0.97. `"all"`. Or 1 to 8 selectors, any of which chooses: `{n, cos}` (normal on `n` over `cos`) or `{radial: axis, min_r, cos}` (the facet's centre stands over `min_r` from the axis through the origin, and its normal on the outward radial is over `cos`). A selector's direction is mirrored with the side. |
|
||||
| `floor` | optional: facets whose normal's z is below it are left bare |
|
||||
| `min_area` | facets under it are left bare |
|
||||
| `lifts` | `[l0, l1]`: how proud panels stand |
|
||||
| `inset` | how far a panel stands in from its facet's edges |
|
||||
| `gap` | the seam between the two panels of a split facet |
|
||||
| `split` | a facet over this area is cut in two |
|
||||
| `seed` | an integer, or `[right, left]` on a row with `sides: "both"`. There is no default. One integer on a two-sided row makes a mirrored pair; a pair of seeds draws each side on its own solid, and an equal pair is refused: it would draw two different layouts, and one seed is how a row asks for the same on both sides. |
|
||||
| `bolt_r` | a bolt's corner radius (default 0.028) |
|
||||
| `bolt_mat` | the bolts' material, 1 to 63 characters (default `gunmetal`). Carried: `build` draws nothing from it; `brokkr_kitbash.plates` reads it |
|
||||
| `bevel` | the width of the panels' Bevel, 0 to 0.05 (default 0.012). Carried, as the row's `bevel` is |
|
||||
|
||||
One `random.Random(seed)` draws, in facet order. A chosen facet over `split` is cut across its longest edge at a
|
||||
share drawn from 0.36 to 0.64 of that edge, the two parts `gap` apart; edges within 1e-9 m of the longest tie and
|
||||
go to the edge whose middle is greater by x, y, z. Then every chosen facet draws once: under 0.5 the parts take
|
||||
`l0, l1`, otherwise `l1, l0`. A panel is its part moved in by `inset`, not made where that leaves nothing, under a
|
||||
quarter of the part's area or under 0.02 m2; it is a prism from 0.02 below the facet to its lift above, its far
|
||||
rim chamfered 0.02 (not chamfered where the chamfer would cost the rim a corner). A hexagonal bolt of radius
|
||||
`bolt_r` stands inside each panel corner, on the panel's outline moved in 3.2 `bolt_r`: a panel with no room for
|
||||
that ring has no bolts, and any two bolts whose centres would stand under 2 `bolt_r` apart are one bolt at their
|
||||
middle, in the first one's place in the ring. Neighbours in ring order are read first, from the first corner, then
|
||||
pairs one corner further apart round the ring, and after each joining the reading starts again; so no two bolt
|
||||
heads of a panel overlap, neighbours or not.
|
||||
|
||||
One inset, `inset2d`, makes every such ring: a slab's `gap` and `taper`, a panel's outline, its rim and its bolt
|
||||
ring. What it returns stands inside the outline. It moves each corner along its miter, where its two edges'
|
||||
lines, moved in, cross. Where no edge runs out of length on the way, those corners are the ring, a sharp one held
|
||||
to the distance / 0.3 from where it was (unless that would turn the ring the other way at some corner): the
|
||||
corner move alone, to the byte. Otherwise the ring is followed in, as a straight skeleton's front is: the edge
|
||||
that runs out first is dropped where it does and its two neighbours meet there, then the next, and the sharp
|
||||
corners stand where the lines cross. Two edges left facing each other on one line (a tab's sides when its end has
|
||||
run out) take the shorter away, both when they are equal, and two left on one line are one edge. Where nothing is
|
||||
left the ring is empty. For a convex outline that is what its edges' half-planes, each moved in, leave of it.
|
||||
|
||||
A held corner steps. While no edge has run out, a corner sharper than 35 degrees (the sine of its half angle
|
||||
under 0.3) stands distance / 0.3 along its miter; from the distance where the ring first loses an edge it stands
|
||||
where its lines cross, distance / that sine along the same miter. The step is their difference and no more: on a
|
||||
10.5 degree tip that loses its first edge at 0.109, from 0.36 to 1.19 m from the outline's corner. It is the
|
||||
skeleton's own corner the step lands on, and it is inside the outline before and after; a facet near that
|
||||
distance changes its panel by the step for a small change of `inset`.
|
||||
|
||||
An outline need not be convex: a slab's may be drawn so, and facets within 0.5 degrees of each other are one
|
||||
facet whose outline can turn right. Its corners that turn right move in too, faster the sharper they are (the
|
||||
distance / the sine of half the corner), and such a corner can reach an edge that is not its own: a neck between
|
||||
two parallel edges closes at half its width. From there the ring would meet itself and be two rings or none, and
|
||||
`inset2d` refuses it (`NotSimple`, a `PlateError`), naming the corner's two edges and the edge it reaches. For a
|
||||
slab's `gap` or `taper` that is the row's refusal at `slab.outline` (or `slab.corners`), from `check` and from
|
||||
`build` in the same words, since both make the slab's points the same way. A facet is no row's drawing: where
|
||||
the inset of a facet or of a facet's part would meet itself, that part takes no panel; where the bolt ring of a
|
||||
panel would, the panel takes no bolts; where the rim would, the rim is the outline. So `build` refuses nothing
|
||||
that `check` passed.
|
||||
|
||||
### Anchors and fits
|
||||
|
||||
A fit stands on the row's face (a slab's outer face, or the `face` another row names), at `[a, b]` in the face's
|
||||
(a, b). The face's top is the face, plus `lifts[0]` where a panel stands on it. Up to 64 a row; any other kind is
|
||||
refused.
|
||||
|
||||
Two kinds are anchors, a frame and no geometry:
|
||||
|
||||
- `{kind: "mark", id, at, height}`: z is the face's normal and y the table's +z projected off it, so a numeral
|
||||
stands upright whatever the plate's lean. On the face's top.
|
||||
- `{kind: "hose_port", name, at, lift}`: z out of the face, y the face's up, `lift` (default 0) over the top.
|
||||
|
||||
`build` returns each as `{kind, name, matrix, mirrored}` (and `height` for a mark). At side -1 the position, normal
|
||||
and up are mirrored and the frame is made right-handed again (x = y cross z); `mirrored` says so. What stands on
|
||||
an anchor is its owner's business.
|
||||
|
||||
Three kinds are fittings, geometry `build` makes:
|
||||
|
||||
- `{kind: "part", part, at, roll, lift, params, mat}`: a part of the fittings kit (below) built by `core.build` at
|
||||
`params` (`"k=v; ..."`, default the part's defaults) and placed by the fit's frame: z the face's normal, y the
|
||||
face's up, turned `roll` degrees about the normal (default 0, -360 to 360), its origin `lift` (default 0, -1 to
|
||||
1) over the face's top.
|
||||
- `{kind: "bolts", inset, spacing, lift, params, mat}`: the kit's `bolt` along a slab's outline. The outline as
|
||||
drawn (in by the slab's `gap`) is moved in by `inset` + the slab's `taper` (0 to 10), by `inset2d` as a
|
||||
panel's bolt ring is, so the ring can have fewer edges than the outline; each edge of that ring takes `max(1, int(length / spacing))` bolts, bolt j at
|
||||
`(j + 0.5) / count` along it. `params` are the bolt's. A rim bolt fastens the plate, not its cladding: the row
|
||||
stands on the bare face, `lift` (default 0) over it, whatever panel the face carries. Where the inset leaves no
|
||||
ring, or a ring that would meet itself (an outline that is not convex), the row stands no bolts: the ruling
|
||||
plate-bolts-follow-edge-event. Refused on a row that is no slab.
|
||||
- `{kind: "step", outline, at, lift, mat, bolt_mat}`: a raised panel on `outline` (3 to 64 `[a, b]` points, either
|
||||
winding, about `at`) on the face's top: the clad's panel with inset 0, from 0.02 under the top to `lift` (0 to
|
||||
1) over it, its far rim chamfered 0.02, a hexagonal bolt of radius 0.028 inside each corner in `bolt_mat`
|
||||
(default `gunmetal`). Refused under 0.02 m2.
|
||||
|
||||
`mat` is the fitting's material, 1 to 63 characters. A part is one material: a fitting of two is two rows at one
|
||||
place (a slot or a vents row and the `pit` under it; an `access_port` and its `port_bolts`).
|
||||
|
||||
At side -1 a fitting's place, normal and up are mirrored, its frame made right-handed and its roll negated, so a
|
||||
part that is the same across its own x stands as the mirror of side +1's. On a two-sided row drawn once (one seed,
|
||||
or no clad) the `.L` fittings are the `.R`'s mirrored across x = 0, as its panels are.
|
||||
|
||||
Refused, naming the path: a part the kit does not have (its parts are listed); params the part does not have or
|
||||
outside its bounds, and what the part's shapes refuse at those params (`core`'s message); a `mat` over 63
|
||||
characters.
|
||||
|
||||
### What build returns
|
||||
|
||||
One entry per plate built, in the table's order: `name`, `row` (its index), `mat`, `bevel`, `side`,
|
||||
`solid: (V, faces)`, `facets` (each face's `normal`, `area`, `centre`), `panels: (V, faces)`, `bolts: (V, faces)`,
|
||||
`fits: {mat: (V, faces)}` (the row's fittings, merged by material in row order), `anchors`, and
|
||||
`report: {corners, facets, panels, bolts, fits}`, `fits` the count that stand (a bolts row counts each bolt). `V` is an (N, 3) float64 array; faces are lists of
|
||||
vertex indices wound outward. `check` returns the table with every default written in. Both are pure functions.
|
||||
|
||||
Building the three mech fixtures takes 0.5 to 0.9 s each (23 to 50 plates, medians of 5 on Starfire, Python
|
||||
3.13); the hull tries every plane through three points, so a slab with a 64-point outline takes 1.5 s alone.
|
||||
|
||||
### Refusals
|
||||
|
||||
Every refusal is a `PlateError` (a `ValueError`) that names the path, as `plates[3].slab.outline[2]` or
|
||||
`plates[0].clad.seed`: a schema that is not `brokkr.plates.v0`; an unknown key anywhere; a row with no solid form
|
||||
or two; a name built twice; a number that is not finite; an outline under 3 points or over 64, one that crosses
|
||||
itself, repeats a point or has zero area; `thick`, `taper`, `back` or `gap` outside 0.001 to 2, 0 to 0.5, 0.1 to
|
||||
1.5 and 0 to 0.5; a `taper` of half the outline's least width or more; a `gap` or `taper` at which an outline
|
||||
that is not convex would meet itself; corners that are not a plate; faces that
|
||||
bound nothing; points in one plane; a pair of seeds on a one-sided row, an equal pair, or no seed; an `up` along
|
||||
the normal; a
|
||||
fit on a row with no face; an unknown fit kind; two anchors of one name in a row; and what Anchors and fits lists
|
||||
for a fitting.
|
||||
|
||||
### Against the mech tracks' builders
|
||||
|
||||
`tests/fixtures/plates_bastion.json`, `plates_paladin.json` and `plates_raptor.json` each hold a table converted
|
||||
from a mech branch's own numbers and the solids, panels and bolt counts that branch's builder made in Blender
|
||||
5.3; `tests/test_plate.py` holds `build` to them (solid vertices within 1e-6 m, panel vertices within 1e-5 m,
|
||||
facet and bolt counts equal). The branches' builders work in float32 and leave two choices to Blender's mesh
|
||||
order, so eleven of the 126 fixture plates are held to something else, each named in the test's `KNOWN`:
|
||||
eight stand 1 to 2 micrometres (solid) or 29 micrometres (panels) from the float64 result and are held at 4 and
|
||||
40; bastion's two quarter pods lack a corner their faces do bound (the branch's inside test lost it to float32),
|
||||
so the branch's solid is smaller than the table's and its panels are another solid's; and one of bastion's two
|
||||
belly-side plates splits its panel from the other of two equally long edges. Those three are held, solid, facets,
|
||||
panels and bolts, to `repaired` in `plates_bastion.json`: the branch's own builder run in Blender 5.3 with the
|
||||
inside test at 1e-5 m, and with its clad cutting from the other tied edge; `repaired.how` quotes both edits as
|
||||
code.
|
||||
|
||||
The branches' inset has no edge event, so 31 of the 126 are held to another bolt count, each named in the test's
|
||||
`EVENT`: eleven stand bare (raptor's thin trims and paladin's tail have no room for a bolt ring), and the
|
||||
others lose one to four to a ring with no room, a dropped edge or heads that would overlap. Two of them, bastion's `Hull.Cheek.R`
|
||||
and paladin's `Thigh.Outer`, have a panel whose outline dropped a corner, and that panel's vertices are held to
|
||||
no truth. What holds every ring instead: every `inset2d` call the three fixtures make at both sides (812) stands
|
||||
inside its outline. The 6 on a slab outline that is not convex are the corner move, every corner the distance
|
||||
clear of every edge; 24 hold a sharp corner at the 0.3 limit with every edge running forwards; the other 782
|
||||
equal, within 1e-12 m, the outline's half-planes moved in and clipped by the test's own clipper (37 of them an
|
||||
edge or more short, 22 empty). 3,000 drawn convex rings are held the same way, and every bolt of 104 blade plates
|
||||
(tips of 14 to 32 degrees) stands whole on its plate. No panel ring or bolt ring of any plate at either side turns
|
||||
right or crosses, and no two bolt heads of a panel overlap; nor do any two on 3,591 blade plates (tips of 8 to 44
|
||||
degrees), 50 of which kept such a pair while only neighbours were joined.
|
||||
|
||||
No fixture facet turns right, so 1,500 drawn sheets hold that case: 5 to 9 points up to 12 mm off one plane, whose
|
||||
top facets the hull makes one. Each passes `check` and builds. Of their 519 rings that turn right, 84 lose an
|
||||
edge, and each of those stands inside its outline without crossing, the distance clear of every edge, each of its
|
||||
edges along one of the outline's in the outline's order; 2, both bolt rings, would meet themselves, and their
|
||||
panels stand bare. A two-lobed facet with a neck holds the rest: no panel at an inset over half the neck, a bare
|
||||
panel under it, and a prism whose rim would meet itself keeps its outline for a rim.
|
||||
|
||||
The same test builds the three fixtures to one sha256 of every coordinate rounded to 1e-9 m and every face,
|
||||
pinned from Starfire (Windows 11, numpy 2.5.4) and Yggdrasil (Debian 13, numpy 2.2.4 on the system LAPACK). The
|
||||
two hosts' coordinates differ by up to 2.7e-15 m, so the bytes of `build`'s arrays are equal between runs on one
|
||||
host and not between hosts.
|
||||
|
||||
### The action
|
||||
|
||||
`brokkr_kitbash.plates` writes a table into the scene. It is the one writer of a hard plate's objects.
|
||||
|
||||
| field | value |
|
||||
| --- | --- |
|
||||
| `table` | the `brokkr.plates.v0` document as JSON, 1 to 32000 characters |
|
||||
| `host` | the object every plate is parented to, 0 to 63 characters; empty: no parent |
|
||||
| `frame` | the table's frame in the world, a JSON array of 4 rows of 4 numbers, at most 1000 characters; empty: the host's world matrix, or the world with no host |
|
||||
| `side` | 1, or -1 for the table mirrored across its x = 0 |
|
||||
| `prefix` | written before every plate's name: 0 to 32 of a-z A-Z 0-9 _ . |
|
||||
|
||||
Per built entry, N = `prefix` + its name:
|
||||
|
||||
- A mesh object N: `build`'s solid in the table frame (`mesh.from_pydata`, every face flat), material `mat`. Its
|
||||
parent is `host` under an identity parent inverse and its `matrix_basis` is host world^-1 x `frame`; with no
|
||||
host its world matrix is `frame`. A Kit Bevel of the row's `bevel`, angle 12 degrees. ID properties
|
||||
`plate_kind` = `"hard"` and `kit_plate`: the checked row with `side` and `prefix`, as JSON. `kit_plate` is a
|
||||
record: its presence admits a rebuild and nothing reads it to decide geometry.
|
||||
- `N.fit.<clad mat>` holds the panels, `N.fit.<clad bolt_mat>` the bolts and `N.fit.<mat>` each fitting of that
|
||||
`mat` (a step's corner bolts under its `bolt_mat`): a child mesh per material, the panels, then the bolts,
|
||||
then the fittings in row order where they share one; identity basis, made only when its mesh is not empty. A
|
||||
child that holds panels carries a Kit Bevel of `clad.bevel`, angle 20 degrees, one segment, and a fitting of
|
||||
the panels' material is bevelled with them; any other child carries none. Every material a fit names must be
|
||||
in the file.
|
||||
- One empty per anchor, a child of N at the anchor's matrix: `N.mark.<id>` with `kit_anchor`
|
||||
`{kind, id, height}`, `N.port.<name>` with `kit_anchor` `{kind, name}` (JSON). A port empty is an end
|
||||
`brokkr_kitbash.hose` takes by name: the hose leaves along its z, out of the face.
|
||||
|
||||
An object named N that carries `kit_plate` is rebuilt in place: its mesh is cleared and rewritten, each
|
||||
`N.fit.<mat>` child rewritten, made or removed as it is now empty or not, anchors kept by name and moved, and one
|
||||
the row no longer names removed. N keeps its identity, its other children, its later material slots and its
|
||||
modifiers. A frozen plate or one sharing its mesh is refused, as `shell` refuses. A plate is no kit part:
|
||||
`joints` and `report` never list it, and a roll of its host carries it by Blender's parenting. The action
|
||||
evaluates nothing.
|
||||
|
||||
It refuses before anything is written, object count and names unchanged: a table `check` or `build` refuses (the
|
||||
path in the message); a material `bpy.data.materials` lacks, named with its path (`mat`, `clad.mat`,
|
||||
`clad.bolt_mat`); a host not found, or scaled, mirrored or sheared; a `frame` that is not a JSON 4x4 of finite
|
||||
numbers or not rigid; N, a child's or an anchor's name taken by an object that is not this plate's (N without
|
||||
`kit_plate`, or an object that is not N's child); a name made twice in one call; a made name over 63 bytes; a
|
||||
host that is one of the call's plates or stands under one; a report over 16000 characters.
|
||||
|
||||
The report: `{plates: [{name, rebuilt, corners, facets, panels, bolts, anchors}], host, side}`, `anchors` the
|
||||
empties' names.
|
||||
|
||||
## Hoses between sockets
|
||||
|
||||
`brokkr_kitbash.hose` routes a bundle of hoses from one socket to another around everything in the scene:
|
||||
|
|
@ -1060,7 +1466,10 @@ body whose rest frame it turns with), and `touch`: for each member (`barrel`, `r
|
|||
bell crank's `rocker arm`), zones `(part, pin, radius, depth)`. Every member meets every part. A zone changes what
|
||||
the member's samples keep from one part, and only within `radius` of the axis of `pin`, measured across the hinge
|
||||
axis; the pin is one the member rides (the ram `a` and its eye, the rocker its pivot and `p`, the coupler `p` and
|
||||
`c`, the arm the pivot and `d`). Inside the zone a sample may come as near the part as `-depth`; beyond it the
|
||||
`c`, the arm the pivot and `d`), and the part is one of a body that pin joins: `a` the parent; the rocker's pivot
|
||||
the parent and the rocker; `p` the rocker and the coupler; `c` the coupler and the child; a direct ram's `b` the
|
||||
child; `d` the rocker (`JOINS`). A zone naming a part of any other body is refused by the record, whatever its
|
||||
radius and depth. Inside the zone a sample may come as near the part as `-depth`; beyond it the
|
||||
pair is checked like any other. Nothing is exempt by a name, by a length cut from a member's end, or by the
|
||||
member's own body: the barrel runs from its back end, the rod to the eye, a bar from pin to pin. Every body of the
|
||||
kind owns at least one part, or the gate refuses the record.
|
||||
|
|
@ -1080,7 +1489,9 @@ to pin: a bar's length between its pins, and for the barrel and the rod the base
|
|||
the centre the eye turns about, added. A `Mechanism` refuses a zone past that from its pins alone. Its depth is
|
||||
also no more than the member's eye on that pin (`Ram.eye`: `e_a` at the base, `e_b` at the rod's eye, `link_r` on
|
||||
a bar), which `from_record` and the gate refuse, so a world's answer is held to it as well. The record holds no
|
||||
plate widths, so the radius has no tighter bound than the length.
|
||||
plate widths, so the radius has no tighter bound than the length, and two zones of half a member's length about
|
||||
its two pins cover it whole. What the record does hold is which body a part turns with: a member is let near only
|
||||
what is pinned where it is pinned.
|
||||
|
||||
Between two samples of which either is in a zone the gate does not rely on the spacing. A distance changes by no
|
||||
more than the way between two points, so along a segment it is at least (g(a) + g(b) - length) / 2. Where that
|
||||
|
|
@ -1091,7 +1502,12 @@ samples' readings stand, so a burial is read to spacing / 128. This asks of the
|
|||
than the true distance.
|
||||
|
||||
What it gives up: inside a zone the gate holds only the member's axis `depth` from the part, not its surface a
|
||||
gap from it, so a link may graze the plate it scissors with anywhere within the stated radius. The members are
|
||||
gap from it, so a link may graze the plate it scissors with anywhere within the stated radius. Among the parts of
|
||||
the bodies a pin joins the gate still cannot tell a member's own plate from another: a zone over the whole member
|
||||
lets its axis `depth` into any of them. A part of a third body is never zoned, so a plate stacked on a pin from a
|
||||
body the pin does not join is refused where it stands; it is stated as a part of a body the pin joins. A four-bar's
|
||||
eye rides `d`, which joins the rocker alone, though it stands on `p`: the ram is let near the coupler's plates
|
||||
there by no zone. The members are
|
||||
round bars; a plate's flat sides are not modelled, which is why stacked plates need a zone at all. The proof
|
||||
between samples costs oracle calls: a depth stated with no slack over the burial (a bar's own plates at `link_r`)
|
||||
is halved to the floor along the whole zone. And it is along the axis at each checked angle; between two angles
|
||||
|
|
@ -1112,20 +1528,20 @@ about R, and `d` about R for a bell crank, the eye standing at `a`'s place along
|
|||
least arm; a miss returns the tally by gate and the nearest miss. Clearance takes `world(m) -> (parts, touch,
|
||||
distance)`: a linkage's brackets and links are the candidate's own, so each candidate that reaches the gate is met
|
||||
with the parts its own pins place. What `world` returns is read as a record's: anything but the three, a part on
|
||||
no body of the kind, a zone that is not a part, a pin the member rides, a radius and a depth, or a zone wider or
|
||||
deeper than its member is refused.
|
||||
no body of the kind, a zone that is not a part, a pin the member rides, a radius and a depth, a zone of a body
|
||||
its pin does not join, or a zone wider or deeper than its member is refused.
|
||||
`swept` gives the ram's swept surface in any body's frame, for a recess.
|
||||
|
||||
### The record
|
||||
|
||||
`record` and `from_record` carry a mechanism as JSON: `schema` (`brokkr.ram`), `version` (1), `kind`, `hinge`,
|
||||
`pins`, `offsets`, `ram`, `parts`, `touch` (member -> zones, each `{part, pin, radius, depth}`), and `compliance`.
|
||||
It holds what is authored; barrel, closed length and link lengths are derived by the reader. `compliance` is
|
||||
reserved for a load-path ram's settle (stiffness, damping, travel); version 1 writes it null and solves none. A
|
||||
record of another schema or version (the integer 1: 1.0 and true are not it), with a key version 1 does not know or
|
||||
without one it does (at the top, in `ram`, `hinge`, `pins` or a zone), with a compliance block, or with a value
|
||||
that is not its field's (a finite number, the bore over 0, three numbers for a point), or with a zone wider or
|
||||
deeper than its member is refused whole, as a
|
||||
`record` and `from_record` carry a mechanism as JSON: `schema` (`brokkr.ram`), `version` (2), `kind`, `hinge`,
|
||||
`pins`, `offsets`, `ram`, `parts` and `touch` (member -> zones, each `{part, pin, radius, depth}`).
|
||||
It holds what is authored; barrel, closed length and link lengths are derived by the reader. It holds nothing of
|
||||
how a load-path cylinder settles: that is a slide joint's, in the joint's own record. A
|
||||
record of another schema or version (the integer 2: 2.0 and true are not it), with a key version 2 does not know or
|
||||
without one it does (at the top, in `ram`, `hinge`, `pins` or a zone), or with a value
|
||||
that is not its field's (a finite number, the bore over 0, three numbers for a point), or with a zone of a body
|
||||
its pin does not join, or wider or deeper than its member, is refused whole, as a
|
||||
`RamError` that names the field: a reader never reads past what it cannot solve. A `Ram` built by hand refuses the
|
||||
same numbers.
|
||||
|
||||
|
|
@ -1136,11 +1552,88 @@ Bore 0.042, range 0..-125. The kinematic rows are tests/test_ram.py's. The clear
|
|||
test generates (thigh with its front plate, shin with caps and armour, the bracket that carries R, the horn that
|
||||
carries `c`, twin link plates stacked 5 mm apart at x 0.31..0.345 and 0.35..0.385, pins through the knee's width,
|
||||
collars at the eye and a base clevis whose foot runs 0.01 into the thigh; 12 parts) and the package's signed BVH
|
||||
oracle, `ram.Signed(shells, cap)`: the nearest face for the depth, the crossing parity of three rays, by majority,
|
||||
for the side. One ray that runs through an edge or a vertex miscounts and signs a sample inside a plate it stands
|
||||
clear of. `tests/fixtures/ram_rays.json` holds the ray count: the rocker plates as the joint library builds them
|
||||
and 24 points between the plates, each on the first ray short of an edge or a vertex. One ray signs all 24
|
||||
inside; three sign none. Three rays are not a proof: of 146 such points one ray missigned, two rays missigned 16.
|
||||
oracle, `ram.Signed(shells, cap)`: the nearest face for the depth, the generalized winding number for the side
|
||||
(Jacobson, Kavan and Sorkine-Hornung 2013). `ram.winding` sums the signed solid angle of every triangle of the part
|
||||
about the point, over 4 pi: about a closed mesh the whole number of times the surface wraps the point, 0 outside, 1
|
||||
inside, 2 where two solids overlap. A point is inside the part at 0.5 or more. The joint library's plates are one
|
||||
mesh of four bars, a side's two overlapping about the pivot (`tests/fixtures/ram_plates.json`, with 29 points
|
||||
inside them, 13 inside two bars): each reads inside, as does the overlap of two boxes welded at a corner and a
|
||||
staircase prism a line crosses six times.
|
||||
|
||||
`Signed` checks what the winding number needs before it answers, and refuses a part by its reason when the oracle is
|
||||
made (`ram.solids`, a `RamError` at gate `signed`). Nothing is repaired or guessed. The checks read the mesh as the
|
||||
winding number does, by where its faces are and not by how its vertices are numbered.
|
||||
|
||||
Open. Vertices no farther apart than `WELD` (3e-4) of the part's extent along every axis are one vertex
|
||||
(`ram.weld`), and a chain of such is one, so a seam of coincident vertices is no hole. The tolerance is the same
|
||||
wherever the part stands: a pair 0.99 of it apart is joined and a pair 1.01 apart is not. A part's faces fall into
|
||||
solids, the faces joined across an edge, and every solid is closed: each edge one face runs is run the other way by
|
||||
another. A solid with an edge that is not (a boundary edge, or two faces wound against each other) is refused with
|
||||
the count of such edges.
|
||||
|
||||
Each face is read `NUDGE` (1e-6) of the extent before its centroid, along its normal. Before a face of a whole solid
|
||||
the number is 0, or more where another solid covers it. A face is turned where the number there is under -0.5: it
|
||||
stands before a region that winds -1. Two things put a face there, and they are refused under two names.
|
||||
|
||||
Inside out. A solid with a turned face whose signed volume is negative (the sum of `a . (b x c) / 6` over its
|
||||
triangles, summed exactly) is wound inside out, and is refused with the solid, its volume and its turned faces. The
|
||||
bound is zero: a cube of side 0.2 turned over beside a 6 m bar and a turned plate 1e-5 thick are refused as a whole
|
||||
part turned over is. A hollow mass, its cavity an inward shell, holds a negative volume there too, but the cavity is
|
||||
before those faces and winds 0, and it passes; so does a sliver of two sheets back to back. A solid whose every face
|
||||
the weld closes up to a point or a line is a seam's leftover with no volume to read.
|
||||
|
||||
Crossing. Turned faces where no solid's volume is negative stand where the part's surfaces cut through one another:
|
||||
cutters taken out of one solid and never joined, a bevel folded over a corner, a lathe's profile crossing itself, or
|
||||
a turned piece welded into a whole one, which the one solid's volume hides. That region is measured, each turned
|
||||
face's area by how far out along its normal the number stays under -0.5, and a part whose region holds `THIN`
|
||||
(1.1e-4) of its extent cubed or more is refused as crossing itself: the count of turned faces, the first, its solid,
|
||||
the number, the share, and where the region lies (the turned faces' centre by area, in the frame the mesh was given
|
||||
in, and how far the farthest stands from it). The message never calls such a part inside out: its winding is right
|
||||
and its cut is not. A member cannot be seated against it honestly, so it stays refused until its builder is fixed.
|
||||
|
||||
Mirrored. A shell may be `(vertices, faces, matrix)`: the object's own mesh and the 4 by 4 that carries it to the
|
||||
body's rest frame. `ram.placed` carries the vertices and turns each face back where the matrix mirrors, so a part
|
||||
mirrored by a negative scale reads as its own mesh does. A caller that carries a mirrored mesh itself and keeps the
|
||||
winding hands over a part wound inside out.
|
||||
|
||||
The bounds stand on real meshes, and the unit suite holds them there (`tests.test_ram.Corpus`). Every part the kits
|
||||
build passes at the corners of its params (316 here; 3,224 over the kits of ten other trees). Of the 1,832 mesh objects the
|
||||
mech experiments make (r3, mcr3, seraph, spectre, walker, chimera, paladin, kestrel), 42 are refused and 1,790
|
||||
pass, the 115 mirrored ones the same in their own frame and placed. 21 are open: marks, recesses and plates with a
|
||||
hole. 17 are wound inside out: lathe and ball bodies, the least a solid of -1.4e-3 of the extent cubed (paladin
|
||||
Waist.torso). 4 cross themselves with every solid's volume positive: walker's two guns, a box whose bore and cross
|
||||
slots were cut and never joined (242 pairs of faces cross), and seraph's two Torso.LowerIn plates, folded at one
|
||||
corner by a bevel over a boolean. `tests/fixtures/ram_meshes.npz` holds those 21, three of the open, the parts
|
||||
nearest each bound and ten passing parts of each mech drawn at random: 89 that pass, so a change that refuses
|
||||
passing parts is seen.
|
||||
|
||||
| bound | nearest below | nearest above |
|
||||
| --- | --- | --- |
|
||||
| `WELD` 3e-4 | a plate's seam closes at 3.7e-5 (seraph Torso.SideBlockR; thirteen more from 7.8e-8 up) | a real hole closes at 2.2e-3 (seraph PauldronR.Outer) |
|
||||
| `THIN` 1.1e-4 | 6.7e-5 held and let be (chimera CannonBody.gunmetal, 178 turned faces at a bevel's crossings) | 1.88e-4 held and refused as crossing (seraph Torso.LowerInL) |
|
||||
| `NUDGE` 1e-6 | a turned cube's faces are held to 1e-8 and four are lost at 1e-9 | plates 1e-5 apart read as one at 1e-4 |
|
||||
|
||||
What it gives up. A part exported open is capped before it is given. Two sheets nearer than `WELD` are one seam to
|
||||
the open check, and a hole that narrow is not seen. A crossing whose region holds under `THIN` is let be: 198 of the
|
||||
1,790 passing mech parts have one, the crossing of a bevel or of a lathe's profile, and there the part reads outside
|
||||
in what its author took for inside (the phalanges' 10 of 82 faces, 3e-6 to 3e-5 held). `THIN` is on crossings alone:
|
||||
a turned piece welded into a whole solid is one solid of positive volume, so it is read as a crossing and one under
|
||||
`THIN` passes (a turned plate 1e-4 thick welded to a cube along an edge). What a region holds is measured along its
|
||||
faces' normals, not counted: by 60,000 sampled points the region is 2.4e-4 of the extent cubed in Torso.LowerInL,
|
||||
2.7e-4 in walker's gun (2.2e-3 held) and 1.2e-5 in CannonBody. A solid turned over inside a whole one is a cavity to
|
||||
the winding number and reads so, whatever its author meant. The four crossing parts cannot carry a ram's seat until
|
||||
their builders join the gun's cutters and unfold the plate's corner.
|
||||
|
||||
With every solid closed the number is whole, so `ram.inside` reads the same at any bound over 0 and up to 1; 0.5 is
|
||||
pinned in the unit suite on a test-only open cube, where the number is 0.527 under the hole and 0.473 over it.
|
||||
|
||||
Outside, the distance is to the nearest face of all. Inside, the depth is to the nearest exposed face: one whose
|
||||
centroid, set `NUDGE` of the part's extent off the face along its normal, is not inside the part. A face buried in
|
||||
another of the part's solids is left out, so a pin sunk 0.056 into a slab with a thin sheet buried along it reads
|
||||
0.056 and is refused by a zone of depth 0.01. A face that crosses another solid is kept or left whole by where its
|
||||
centroid is, not split: left out, the depth by it reads greater than it is, which the gate takes as a refusal;
|
||||
kept, a point by its buried stretch reads shallower than the union's surface is (a boss through a wall: 0.500 for
|
||||
0.502 and 0.539 for 0.583 in the live readings).
|
||||
|
||||
| drive | reading |
|
||||
| --- | --- |
|
||||
|
|
@ -1155,8 +1648,15 @@ Cost on Starfire, Python 3.13, 100 repetitions paired and interleaved: one candi
|
|||
49 steps took 0.79 ms median on the bell crank; its clearance against the analytic parts (50 pairs) took 42 ms
|
||||
(5th to 95th percentile 38 to 57) over 97,875 points, of which 23,520 are the samples and the rest the halving in
|
||||
zones (the own plates, stated with no slack, to the floor); the samples alone took 11 ms. A search without a world ran 1.6 to 1.8 ms a candidate over 3,456, so `limit`
|
||||
(20,000) is 30 to 40 s. On the meshes the bell crank's 60 pairs at 49 steps took 1.95 to 2.12 s capped (two runs), in a
|
||||
Python loop of BVH queries with three rays a sample, and the 13,824-candidate search with its 22 worlds 43 s (one run).
|
||||
(20,000) is 30 to 40 s. On the meshes the bell crank's 60 pairs at 49 steps took 0.80 to 1.00 s capped (two runs), the
|
||||
winding number as the plain sum over a part's 124 to 408 triangles in numpy (single precision over double offsets,
|
||||
blocks of 32,768 pairs) and the depth a Python loop of BVH queries, and the 13,824-candidate search with its 22
|
||||
worlds 34.5 and 38.5 s (two runs) on a quiet machine. With the angles in double precision the search took 47.7 to
|
||||
47.9 s (three runs). The live result reports the search's seconds as a reading and no check holds it: beside other
|
||||
agents' Blenders at full load the same search took 61 to 94 s. With the refusals and
|
||||
the exposed faces found as each of its 22 worlds is made it took 66.8 s, run after 59.3 s for the oracle before
|
||||
them under that load (one pair). With the vertices welded and every face read before its centroid it took 45 to 81 s
|
||||
under such load (five runs), and reading a 336-face part takes 27 to 37 ms.
|
||||
|
||||
## The actions
|
||||
|
||||
|
|
@ -1168,12 +1668,13 @@ Python loop of BVH queries with three rays a sample, and the 13,824-candidate se
|
|||
| `brokkr_kitbash.report` | `object_name` (default: every kit part) | Each part as the scene has it: kit, part, params, faces, shells, each socket's world frame, `connection`, `closure` and `frozen`; a frozen part adds `evaluated: {faces}`, and `dirty` (with `frozen` false) when a modifier of it is shown again. `faces` is the live mesh's count. Changes nothing and evaluates no modifier. |
|
||||
| `brokkr_kitbash.attach` | `object_name` (the child), `socket`, `parent_name`, `parent_socket`, `roll` (degrees, -360 to 360, default 0) | Seats the child's socket on the parent's and parents it there; the two parts are of one kit or of two whose socket types agree. Reports the child. |
|
||||
| `brokkr_kitbash.detach` | `object_name` | Clears the part's connection and the closure it states; it stays where it stands. Refuses a part that has neither. |
|
||||
| `brokkr_kitbash.roll` | `object_name`, `roll` (degrees, -360 to 360) | Turns an attached part to that roll where it hangs. Refuses a part that is not attached. Reports the part and `closures` as `set_params` does. |
|
||||
| `brokkr_kitbash.roll` | `object_name`, `roll` (degrees, -360 to 360) | Turns an attached part to that roll where it hangs, and every follower of it with it ("Followers"; the report's `followers` lists each as `{part, value}`). Refuses a part that is not attached, and a follower, naming its driver. Reports the part and `closures` as `set_params` does. |
|
||||
| `brokkr_kitbash.aim` | `object_name`, `axis` (`+x`, `-x`, `+y`, `-y`, `+z` or `-z`, the part's own), `direction_x`, `direction_y`, `direction_z` (world, any length) | Solves the roll that turns the axis as far toward the direction as the pin lets it, and turns the part to it. Refuses an axis or direction along the pin. Reports the part, `aimed: {roll, dot}` and `closures`. |
|
||||
| `brokkr_kitbash.reach` | `object_name`, `socket` (one of the part's), `height` (metres, -1000 to 1000), `direction_x`, `direction_y`, `direction_z` (world; default 0, 0, 1) | Solves the roll that brings the socket's origin to `height` along the direction, the nearer of the two, and turns the part to it. Refuses a height out of reach, naming the range. Reports the part, `reached: {roll, residual}` and `closures`. |
|
||||
| `brokkr_kitbash.joint` | `object_name`, `record` (a JSON object of any of `limits`: `[lo, hi]` or null; `mechanism`: a label or null; `compliance`: `{hertz, damping_ratio}` or null) | States the joint record of an attached part's connection; a key left out keeps what is stated and null clears it. Refuses a rigid connection naming its socket type, limits that do not hold the value the joint has, revolute limits over a turn or past 360, prismatic limits past 10 m, and compliance on a revolute joint or without limits. Reports the part and `closures` as `roll` does |
|
||||
| `brokkr_kitbash.slide` | `object_name`, `slide` (metres, -10 to 10) | Slides an attached part along its parent socket's normal on a prismatic connection, where it hangs. Refuses a revolute or rigid connection naming its socket type, and a slide outside the joint's limits. Reports the part and `closures` as `roll` does |
|
||||
| `brokkr_kitbash.joints` | `object_name` (the root, a kit part) | Reports the joints of the tree attached under the root as `brokkr.joints` version 1: a row per revolute or prismatic connection, parents first, with `id`, `parent`, `part`, `socket`, `kind`, `axis`, `origin`, `value`, `limits`, `min`, `max`, `mechanism` and `compliance`, in the root's frame ("Joint records"). Changes nothing |
|
||||
| `brokkr_kitbash.joint` | `object_name`, `record` (a JSON object of any of `limits`: `[lo, hi]` or null; `mechanism`: a label or null; `compliance`: `{hertz, damping_ratio}` or null) | States the joint record of an attached part's connection; a key left out keeps what is stated and null clears it. A follower keeps its derived value, and a driver's followers are derived again. Refuses a rigid connection naming its socket type, limits that do not hold the value the joint has, revolute limits over a turn or past 360, prismatic limits past 10 m, and compliance on a revolute joint or without limits. Reports the part and `closures` as `roll` does |
|
||||
| `brokkr_kitbash.slide` | `object_name`, `slide` (metres, -10 to 10) | Slides an attached part along its parent socket's normal on a prismatic connection, where it hangs, and every follower of it with it. Refuses a revolute or rigid connection naming its socket type, a slide outside the joint's limits, and a follower. Reports the part and `closures` as `roll` does |
|
||||
| `brokkr_kitbash.joints` | `object_name` (the root, a kit part), `after` (default empty: an id, the `next` of the report before) | Reports the joints of the tree attached under the root as `brokkr.joints` version 2: a row per revolute or prismatic connection, parents first and the root's own first when it states one, with `id`, `parent`, `part`, `socket`, `kind`, `axis`, `origin`, `value`, `limits`, `min`, `max`, `held`, `mechanism`, `compliance` and `driven`, in the root's frame, and `unlimited`, `manyDrivers` (the loops with more than one driver) and `next` beside them ("Joint records"). With `after`, the rows after that id. Changes nothing and evaluates no modifier. |
|
||||
| `brokkr_kitbash.follow` | `object_name` (the follower; for a loop, the part that states the closure), `record` (JSON: `{driver, kind: "ratio", k, offset}`, `{driver, kind: "loop"}` or null) | States that the part's joint follows the driver's, by a ratio or by keeping its closure closed with its parent's joint, and moves it there at once; null clears the statement, and a loop partner's with it ("Followers"). Refuses a rigid connection, a driver that is the follower, below it or itself a follower, a follower that already follows or drives another, a ratio whose driver states no limits, and a loop without a closure that holds, with both ends or neither moving with the driver, whose ends depend on another driver or on a joint posed by hand, that is not planar or that stands at a dead centre. Reports the part, `followers` and `closures`. |
|
||||
| `brokkr_kitbash.close` | `object_name` (the closing part), `socket`, `other_name`, `other_socket` | States that the closing part's socket meets the other part's, closing a loop. Accepted only when they already meet; moves nothing. Reports the closing part. |
|
||||
| `brokkr_kitbash.boolean` | `object_name` (any mesh), `cutter`, `operation` (`DIFFERENCE`, `UNION` or `INTERSECT`; default `DIFFERENCE`) | Adds the cutter to the collection of the target's one live Exact Boolean for the operation, above the Bevel. Refuses a cutter that is the target, is not a mesh, or already cuts it, and a scaled target. Reports the part (or `object` for a mesh that is not one), `booleans: [{cutter, operation}]` (difference, union, intersect; each in the order added; `booleansOmitted` counts rows a receipt had no room for) and `evaluated`. |
|
||||
| `brokkr_kitbash.cut` | `object_name` (any mesh), `cutter_name`, `part` (`box`, `cyl`, `slot`, `slab`), `params`, `origin_x/y/z`, `direction_x/y/z`, `up_x/y/z` (default 0, 0, 1), `roll` (degrees, default 0), `axis_x/y/z` (default 0, 0, 0: the surface normal) | Places a `cutters` part where the ray meets the target, parented to it, and adds it to the target's difference Boolean. Refuses a ray that misses or has no direction, a name an object has, an `up` along the cutter's axis, an `axis` into the surface and a scaled target. Reports `object`, the `cutter` with its floor sockets, and `booleans` (with `booleansOmitted`, as `boolean`). |
|
||||
|
|
@ -1183,6 +1684,7 @@ Python loop of BVH queries with three rays a sample, and the 13,824-candidate se
|
|||
| `brokkr_kitbash.ribs` | `object_name` (the cage), `ribs_name`, `planes` (a JSON array of 1 to 64 `{origin, normal}`, up to 16000 characters), `standoff`, `depth`, `thickness`, `step`, `holes`, `posts`, `post_r`, `bridge`, `clearance`, `longerons` (a JSON array of 0 to 16 `{origin, axis, toward}`, up to 8000 characters), `longeron`, `longeron_w`, `longeron_h`, `longeron_t` | Derives ribs, lightening holes, posts and longerons from the cage as it is cut, as one mesh object under it. Refuses before it writes anything, naming the plane or longeron. Reports `object`, `ribs`, `thickness`, `sections: [{plane, chains, pieces, length, open}]`, `posts`, `holes`, `longerons: [{index, stations}]` (trimmed to a receipt, with `longeronsOmitted`), `faces`, `volume` and `nonManifoldEdges`. |
|
||||
| `brokkr_kitbash.shell` | `object_name`, `sheet` (a JSON object `{rings, closed, mirror, creases, rim, flip}`, up to 32000 characters), `thickness`, `offset`, `levels`, `bevel`, `count_folds` | Makes a faceted, hollow armor shell from a loft of rings with crease runs, or rebuilds a shell's cage in place under its cutters and ribs. Refuses before it writes anything, naming the field and index. Reports `object`, `rebuilt`, `rings`, `points`, `cageFaces`, `creases`, `folded` (with `count_folds`, the number of the evaluated wall's inner faces that fold; else null), `corners`, `subdividedFaces`, `facing`, `thickness`, `offset`, `levels` and `children`. |
|
||||
| `brokkr_kitbash.hose` | `object_name`, `start`, `end`, `count`, `radius`, `spread`, `clearance`, `bend`, `step`, `sag`, `clamps` (a JSON array of up to 8 `{socket}`), `joint` (empty, or a JSON object `{socket, standoff}`) | Routes a bundle of hoses between two sockets around every other mesh, over clamps and through a pin's axis across its roll range; on a hose's name, rebuilds it in place. Reports `length`, `lengthChange`, `clearance`, `radii`, `sag`, `voxels`, `seed`, `rolls`, `worstRoll`, `faces`, `nonManifoldEdges`. |
|
||||
| `brokkr_kitbash.plates` | `table` (a `brokkr.plates.v0` document, JSON), `host`, `frame` (empty, or a JSON 4x4 of rows), `side`, `prefix` | Writes hard plates: each a mesh on its host with `<plate>.fit.<material>` children for panels, bolts and fittings and an empty per anchor; a plate it made is rebuilt in place. Reports `plates` (`name`, `rebuilt`, `corners`, `facets`, `panels`, `bolts`, `anchors`), `host`, `side`. |
|
||||
|
||||
`params` is `name=value; name=value`; a param left out takes the part's default (`place_part`) or keeps its stored
|
||||
value (`set_params`). A value outside its bounds is refused with the bounds in the message.
|
||||
|
|
@ -1226,6 +1728,31 @@ The tank's port is 0.4 of its radius across (0.12 m here), so the tee and the no
|
|||
`pipe_r` and `throat_r`. `set_params` on the tank carries the tee and the nozzle out with its port. The receipts
|
||||
file holds each report in `hostResult`. `tools/turntable_recipe.py` renders the saved `.blend`.
|
||||
|
||||
## The fittings kit
|
||||
|
||||
`kits/fittings.v0.json`: nine parts that stand on a hard plate's face, placed by `brokkr_kitbash.plate`'s fit rows
|
||||
(Hard plates, Anchors and fits). Each stands on +z from z = 0 in its own frame: the origin is the fit's place, z the
|
||||
face's normal, y the face's up. One material a part and no sockets. The defaults are the mech tracks' sizes.
|
||||
|
||||
| part | params | what it is |
|
||||
| --- | --- | --- |
|
||||
| `bolt` | `r` | a hex head (r to its corners, 0.7 r tall) on a washer 1.55 r; the bolt of a `bolts` row |
|
||||
| `slot` | `w`, `h` | the rim of a w by h slot: four bars 0.032 wide, 0.028 tall |
|
||||
| `pit` | `w`, `h`, `depth`, `count`, `pitch` | the dark box under an opening, `count` of them `pitch` apart along y, centred. Under a slot: depth 0.012. Under vents: depth 0.01, the vents' count, pitch 2.7 h |
|
||||
| `vents` | `w`, `h`, `count` | `count` louvre lips tilted 28 degrees, 2.7 h apart along y, centred |
|
||||
| `access_port` | `r` | a turned ring of radius r around a sunk cover with a raised boss, 28 segments |
|
||||
| `port_bolts` | `r` | the port's eight hex heads on a circle 0.91 r, standing from the ring's shoulder at z 0.035 |
|
||||
| `handle` | `length`, `lift`, `r` | a bar along y on two posts, bent over at `lift`, a washer and a hex foot under each post. `roll` 90 lays it along the face's a |
|
||||
| `eye` | `size` | a lifting eye: a pad with two bolts, a neck, and a ring standing in the plane of y and z |
|
||||
| `louvres` | `w`, `h`, `n`, `depth`, `frame`, `slant` | a framed bank of n slats tilted `slant` degrees about x; `frame` is under w and h |
|
||||
|
||||
Each part's points are the tracks' own (`surface.py`'s bolt row, grab handle and lifting eye, `hardplate.py`'s
|
||||
slot, vents and port, `hardpoint.py`'s louvres) within 2e-8 m, float32 against float64, with two differences the
|
||||
kit format sets: the handle's bar is a square section of side 2 r, mitred at its bends, where the tracks swept an
|
||||
octagon; and the eye's pad is a plain box where the tracks' was a rounded outline with a chamfered rim. A handle
|
||||
whose bar is thick against its bend (`r` over about a quarter of `min(0.4 lift, 0.2 length)`) may fold on the
|
||||
inside of a turn, and is refused.
|
||||
|
||||
## The mechanical kit
|
||||
|
||||
`kits/mechanical.v0.json`: thirteen parts, each along +z, with socket types `flange` (equal), `mount` (fits),
|
||||
|
|
@ -1312,4 +1839,5 @@ frame `cut` gives a cutter. `MateTests` covers the mate arithmetic and what may
|
|||
re-parameterised, a beam seated on a bracket), `tests/live/kitbash_assembly.py` (attach, detach,
|
||||
`set_params` on assemblies, a braced leg closed by `close`, boolean, and freeze and thaw with what a frozen part costs), `tests/live/kitbash_shell.py`
|
||||
(`cut` and `cut_many` on a cage that is not a kit part, a part on a cutter's floor, the three Boolean modifiers, an object in no
|
||||
collection) and `tests/live/kitbash_pose.py` (roll, aim and reach).
|
||||
collection), `tests/live/kitbash_pose.py` (roll, aim, reach and joint records) and `tests/live/kitbash_follows.py`
|
||||
(followers: a four-bar, a ram closing on its rocker, ratios, a torque link, the one-driver refusals, and a joints report in pages).
|
||||
|
|
|
|||
|
|
@ -274,6 +274,170 @@ fitted; a run's depth with no mirror partner, no second view and no mirror plane
|
|||
The acceptance reads nine tenths of a trace: it passes a short doubled stretch and a tip that stands off, and
|
||||
reports both as `worst_px`. `m_per_px` is a sensitivity to one pixel, not an error bound.
|
||||
|
||||
## block_plate: a plate's first cage from its traces
|
||||
|
||||
`fit_shell` refines a cage somebody blocked. `brokkr_reference.block_plate` makes the first one. A plate is a
|
||||
closed outline of named corners in order; side i runs from corner i to corner i + 1 and is one hard crease of the
|
||||
plate's crown. A trace is one side drawn in one view, `{camera, box, frame, from, to, side, line}`: `from` and `to`
|
||||
are two consecutive corners and the line is drawn from the one to the other. That is the only correspondence
|
||||
there is: a trace's two ends are its two corners. Every other point of the crown is placed by `fit_shell`'s
|
||||
residual, the pixel distance from the side as built to the trace. Nothing matches a point of one trace to a
|
||||
point of another.
|
||||
|
||||
`frame_object` is the plate's frame. A trace's `frame` is the part's pose in that view where it differs (a limb
|
||||
swung, a hull pitched); `side` -1 is a view of the plate's reflection across the frame's x = 0, which is the
|
||||
other half of a mirrored plate or the same plate on the partner limb. `plate` is `{corners, mirror, seam}`. On a
|
||||
mirrored plate `seam` names the corners on x = 0, two or more next to each other: they are held there, the sides
|
||||
between them lie on it, and one view decides them.
|
||||
|
||||
Where a corner's depth comes from, in this order:
|
||||
|
||||
- **the views**, where two or more see it and one pixel moves the point their sight lines meet at less than
|
||||
`share` x the plate's extent, the prior's own scale. Past that the views alone hold the corner looser than the
|
||||
plane would and are not used as its start. That factor of 1 is the prior's own unit, not a derived value; the
|
||||
tests pin it between a plate that blocks and one that is refused. The line is metres a pixel, so it moves
|
||||
with lens and range: a 1.2 m plate 17.6 m off at 663 px has three corners started at 0.72 of the scale with
|
||||
its views 19 degrees apart, 0.83 at 16.5, between 1.22 and 1.23 at 11 and 2.73 at 5. With no plane given it blocks down to
|
||||
16.5 degrees (73 mm from the truth) and is refused at 11, where it would have stood 104 mm off: the line
|
||||
switches blocking and refusal, it is no cliff in accuracy. At 5 degrees its corners landed 0.25 to 1.5 m off;
|
||||
through a lens three times as long it starts at 0.65 at 7 degrees and blocks.
|
||||
- **the mirror plane**, for a seam corner whose sight line crosses x = 0 at 24 degrees or more.
|
||||
- **a plane**, for the rest: `plane` (`x,y,z; nx,ny,nz`, a point and the normal, in the frame), or with none given
|
||||
the plane through the corners the views and the seam decide, three or more. A corner one view sees is lifted
|
||||
onto it, and refused when the plane stands more than 66 degrees off square-on to that view: the lift stretches
|
||||
past 2.5 times there. A seam corner whose one view runs along x = 0 is such a corner: it is lifted onto the
|
||||
plane, held on x = 0, and refused by the same 66 degrees.
|
||||
|
||||
That is where a corner starts. What the report says decided it is read after the solve, from the point's own
|
||||
prior share, whatever kind of point it is.
|
||||
|
||||
The crown is then solved by the same solver as `fit_shell`, with a different prior: each crown point's distance
|
||||
to the plane costs a pixel per `share` x the corners' extent, and each side's second differences a pixel per 0.2
|
||||
x its chord. A distance to a plane does not resist a move in the plane, so the views decide wherever they see,
|
||||
and a view that sees nothing along its own sight line leaves that to the plane. A side starts as its two
|
||||
corners. After each solve a side with a trace not explained (the same nine tenths within `tol`) gains one point
|
||||
and the plate is solved again, to six points a side; past that it is refused as `fit_shell` refuses a trace.
|
||||
|
||||
The cage is the crown ring, a skirt 0.05 of the crown's extent out and 0.06 back of it, and one centre vertex
|
||||
0.017 proud (the extent is the distance between the crown's two furthest points, so a plate of any size has the
|
||||
same proportions): every crown side
|
||||
creased 1, the named corners pinned, the centre the declared pole unless the crown has four points. On a
|
||||
mirrored plate the seam's sides have no skirt and the seam's two ends are poles too. The skirt and centre are
|
||||
rebuilt from the solved crown and never solved. The sheet goes through `brokkr_kitbash`'s parser before it is
|
||||
returned, and `brokkr_kitbash.shell` builds it; `block_plate` writes nothing.
|
||||
|
||||
The report: `sheet`; `fit_traces`, the traces as `fit_shell` takes them (each side a run of authored vertices),
|
||||
and `left_out`, the traces `fit_shell` cannot state (one with its own `frame`, or a partner's side -1 on a plate
|
||||
that is not mirrored); per corner `decided_by`, `parallax_deg`, `m_per_px` and `prior_share`; per side its
|
||||
points, each trace's readings, `inner` (the same `decided_by`, `m_per_px` and `prior_share` for each point between
|
||||
its corners) and its own `decided_by`; `plane` with `from` `given` or `corners`; `rounds`, the solves it took.
|
||||
|
||||
`decided_by` is read from `prior_share` for every crown point: `plane` from 0.2 up, the prior (the plane, and
|
||||
for a side's inner points its fairness) holding the depth; under 0.2 `mirror` for a point on the seam and
|
||||
`views` for any other. A seam corner seen from 10 degrees off the mirror plane reads `plane` (0.57), not
|
||||
`mirror`. A side says `corners` when it has no point of its own, `plane` when any inner point does, else what
|
||||
its inner points say: a side can read as explained to 0.1 px and stand 53 mm off with its one inner point at
|
||||
0.41, and then it says `plane`.
|
||||
|
||||
Refused, naming the field: a corner no trace ends at, a side traced in no view, a trace whose corners are not
|
||||
consecutive, an unknown camera, a scaled frame, a seam that is not one stretch of the outline, no plane where
|
||||
fewer than three corners are decided, the 66 degrees, a mirrored plate's corner that starts or ends across x = 0
|
||||
from the others (name it in `seam`, or trace it where the views agree), a side not explained at six points, a
|
||||
sheet the cage's parser does not take, and a result that could pass the 16000 characters a receipt carries.
|
||||
|
||||
Measured against a known truth (`tests/test_reference.py` BlockTests, Python 3.13 on Starfire;
|
||||
`tests/fixtures/spectre_truth.json`), on one plate through one pair of views. SPECTRE's pass-3 roof, a hard
|
||||
mirrored cage of 11 vertices, was built by `brokkr_kitbash.shell` and rendered in Blender 5.3 through SPECTRE's
|
||||
two solved cameras at the sheet's pixel size. Its edges were traced off the renders: the ridge in the side
|
||||
view, the lip, outer edge and rear edge in the hero's mirrored half and the side view, 62 degrees apart. The
|
||||
side view's pixel is 27.6 mm across at the plate.
|
||||
|
||||
How the traces were taken. No hand drew them. A search follows a seed polyline, takes the strongest brightness
|
||||
step within a window across each edge, lays a straight stroke through the steps found on each segment, and ends
|
||||
each stroke where it crosses its neighbours. The seed is the truth's projection moved off the answer, in eight
|
||||
families: the whole seed by 0.5, 1 or 1.5 px in a drawn direction (a 2.5 px window), or each of its vertices by
|
||||
a normal draw of 1 or 2 px (3.5 px), 2 px (5 px), 3 px (6 px) or 4 px (8 px). Every corner is named. A take's
|
||||
worst point stands far from the truth's projection, 3 to 12 px at the families' medians: two strokes that run
|
||||
nearly along each other cross far from the corner. Forty fresh draws a family (the fixture holds twelve of
|
||||
each of six, 72 takes, which the test blocks; the 2 px, 5 px and the 4 px, 8 px families are in neither):
|
||||
|
||||
| seed | window | blocked of 40 | worst traced point, px: median, most | worst corner, mm: median, most | worst corner over worst point x 27.6 mm, at most |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| moved 0.5 px as one | 2.5 px | 40 | 3.4, 30.2 | 47, 913 | 1.11 |
|
||||
| moved 1 px as one | 2.5 px | 39 | 3.5, 30.4 | 67, 916 | 1.15 |
|
||||
| moved 1.5 px as one | 2.5 px | 39 | 3.6, 24.9 | 66, 370 | 1.19 |
|
||||
| each vertex 1 px | 3.5 px | 35 | 8.5, 28.2 | 171, 559 | 1.13 |
|
||||
| each vertex 2 px | 3.5 px | 35 | 9.1, 28.8 | 153, 745 | 1.14 |
|
||||
| each vertex 2 px | 5 px | 30 | 9.4, 41.5 | 170, 512 | 1.25 |
|
||||
| each vertex 3 px | 6 px | 17 | 10.2, 73.6 | 231, 2038 | 1.15 |
|
||||
| each vertex 4 px | 8 px | 8 | 12.0, 29.0 | 322, 417 | 1.33 |
|
||||
|
||||
The fixture's 72 takes read 1.18 at most (62 block; nine are refused at a side not explained at six points,
|
||||
one at the cage's parser). These ratios are not the bound. A take's worst point is one far crossing, and it
|
||||
inflates what the corner is measured against: the worst a trace does for its worst point is to have no
|
||||
outlier, every point the same d px off the truth's projection. With no search, the truth's projection moved:
|
||||
|
||||
| every traced point d px off | worst corner over d x 27.6 mm, at most |
|
||||
| --- | --- |
|
||||
| each view moved as one, 12 directions by 12, at 1, 2, 3 px (all 144 block) | 1.505, 1.504, 1.502 (1.10 at the median) |
|
||||
| each stroke its own direction, searched | 1.58 |
|
||||
| each point its own direction, searched, at 1 and 3 px | 1.67, 1.66 |
|
||||
|
||||
The bound: worst corner <= 2.08 x d x pixel, d the furthest any traced point stands from the truth's
|
||||
projection and pixel the coarser view's. 2.08 is the geometric mean of the 1.505 and of 2.865, what the
|
||||
blocking reads on the same 144 without its end terms; it stands 1.25 over the worst a search found, which is
|
||||
not the worst there is, and 1.57 over the worst family of takes. The test holds the 144, the searched worst
|
||||
at 1 and 3 px and the 72 takes to it. It is a reading on one plate through one pair of views, 62 degrees
|
||||
apart, not a law, and it says a plate is as good as its worst traced point: one stroke end 30 px off puts a
|
||||
corner 0.9 m off, and nothing in the report says so, because that trace is explained. No bound is given in
|
||||
the traces' rms: against it the fixture's takes run 0.57 to 5.3. The same search seeded on the truth's
|
||||
projection itself, with a 2.5 px window, reads 39 mm; that is the window ending every stroke within 2.5 px of
|
||||
the answer, and it is not an accuracy.
|
||||
|
||||
The error is not a multiple of `m_per_px` either: a seam corner 98 mm off reports 0.0008 m a pixel, because
|
||||
`m_per_px` is depth along the sight line and most of this error lies across it. With only four corners named,
|
||||
the roof's ridge and outer edge are one side each and are built as smooth runs through their hard knees:
|
||||
explained within `tol`, 196 mm from the true edges (5.2 px is 144 mm there). Name a hard corner as a corner.
|
||||
|
||||
Fairness, 0.2 x a side's chord, is set by known truth at traced noise. Over ten cells at 1 and 2 px (the rendered
|
||||
roof with four corners named, its strokes those of the search seeded on the truth with the noise added, with
|
||||
and without closing strokes moved 3 px, and a bowed pentagon at 60 and 30 degrees and in one view), 168 draws:
|
||||
the mean of the cells' 90th percentiles and the worst draw, in mm, over the draws that blocked, and the draws
|
||||
refused, which no percentile counts:
|
||||
|
||||
| FAIR | 0.1 | 0.15 | 0.2 | 0.25 | 0.3 | 0.4 | 0.5 | 1 |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| mean 90th percentile | 194 | 184 | 178 | 178 | 179 | 186 | 193 | 196 |
|
||||
| worst draw | 301 | 275 | 273 | 272 | 312 | 382 | 494 | 577 |
|
||||
| refused of 168 | 19 | 20 | 23 | 24 | 24 | 25 | 26 | 27 |
|
||||
|
||||
A higher FAIR, which is weaker fairness, refuses more draws, so each column's percentiles are
|
||||
over a different set. On other seeds (Soul's probe, verdict cut-trace-block.s2, FAIR 0.1, 0.2, 0.3, 0.5) the
|
||||
mean 90th percentile read 216, 188, 216, 250, the worst draw 542, 855, 679, 807 and the refused 18, 21, 26,
|
||||
27; on a third (verdict cut-trace-block.s3, all eight) 196, 196, 195, 202, 199, 220, 234, 255, the worst draw
|
||||
652, 876, 690, 843, 871, 500, 673, 741 and the refused 10, 15, 20, 20, 22, 22, 23, 23. FAIR is flat from 0.1
|
||||
to 0.3 and worse above: 0.2 and 0.25 tie in the table, and 0.1 to 0.2 stand within 1 mm on the third set. 0.2
|
||||
is kept as a point on that plateau, not a resolved lowest. From
|
||||
exact traces weaker fairness is nearer the truth (a pentagon bowed 35% of its sides: 42 mm at 0.2, 16 at 0.5,
|
||||
12 with none).
|
||||
|
||||
Agreement with other fits, which is not accuracy. SPECTRE's second-pass roof from its hand traces: the ridge
|
||||
7.3 mm at most and the brow a median of 8.4 mm from the cage `fit_shell` had fitted to the same pixels; with
|
||||
1 px of noise on those traces the brow's median read 11 to 75 mm over six draws (Soul's probe, verdict cut-trace-block.s1). Paladin's 16 plates, each a polygon traced in
|
||||
one view with the plane its agent gave: every corner decided by the plane, the crown within 1 mm of the one
|
||||
the harness had lifted onto the same plane. Its two thigh shields traced as partners are refused, a side 19 px
|
||||
unexplained: the sheet draws two different polygons, not one plate and its reflection. RAPTOR's hull plate
|
||||
bearing the 27 (`tests/fixtures/raptor_plates.json`), marked by eye in the hero and the SIDE view: seven hull
|
||||
marks admit no hero camera under 25 px rms, so the sheet's two views do not draw one hull; through that camera
|
||||
the plate blocks with its sight lines 34 to 40 degrees apart and the prior holding 0.17 to 0.20 of each corner.
|
||||
|
||||
What it gives up. One outline loop a plate: a plate that wraps a corner is two plates, and creases inside the
|
||||
outline are not blocked. A bend smaller than `tol` is built straight, and a hard knee inside a side is rounded.
|
||||
Fairness holds a grown side flatter than its trace while the trace still reads as explained (the side's
|
||||
`decided_by` says when the prior holds it). The plane through the decided corners is a guess at a twisted
|
||||
plate, and where one view sees a corner the plane is all the depth it has. Every crown point carries a skirt
|
||||
vertex, so a point a side grows costs two.
|
||||
|
||||
## What it cannot do
|
||||
|
||||
It solves one pinhole camera for one view: no lens distortion, no two views solved together, one turned group and
|
||||
|
|
@ -281,6 +445,8 @@ no other pose. It does not find the points; marking them is the caller's. Points
|
|||
points on rigid features of one body, because the build's pose is not the drawing's. It does not say whether the
|
||||
subject is the right size: a build twice too large is the same picture from twice as far.
|
||||
|
||||
`block_plate` blocks one outline loop a plate and no crease inside it.
|
||||
|
||||
## From a script
|
||||
|
||||
```python
|
||||
|
|
@ -291,6 +457,7 @@ origin, direction = core.ray(cam, (u, v)) # a pixel's line of
|
|||
point = core.lift(cam, (u, v), plane_point, plane_normal) # a traced pixel on a plane
|
||||
run = core.crease_run(column) # the hard crease Blender builds from a cage column
|
||||
fit = core.fit_sheet(sheet, cage, frame, traces, cams) # the fitted sheet and its report; cage is brokkr_kitbash.core.sheet(sheet)
|
||||
out = core.block_plate(views, plate, traces, parse) # a plate's first sheet and what decided each corner; parse is brokkr_kitbash.core.sheet
|
||||
score = core.along(line, segments, height) # on, off, run against [u0, v0, u1, v1] segments
|
||||
params = core.blender(cam, 1000) # matrix_world, lens, shifts, resolution
|
||||
cam2 = core.camera_of(params, box) # and back
|
||||
|
|
@ -301,4 +468,6 @@ through the action and rendered again; `reference.result.json` is its last run)
|
|||
(`crease_run` against Blender's own subdivision, a box and a folded sheet scored by `flow_score`;
|
||||
`reference_flow.result.json` is its last run) and `tests/live/reference_fit.py` (a mirrored loft and a mirrored
|
||||
free cage, each blocked off its design, fitted through the action and rebuilt by `brokkr_kitbash.shell`;
|
||||
`reference_fit.result.json` is its last run).
|
||||
`reference_fit.result.json` is its last run) and `tests/live/reference_block.py` (a bowed plate and a mirrored plate
|
||||
blocked through the action from traces alone, built by `brokkr_kitbash.shell` and handed to `fit_shell`;
|
||||
`reference_block.result.json` is its last run).
|
||||
|
|
|
|||
1
surfaces/blender/tests/fixtures/paladin_plates.json
vendored
Normal file
1
surfaces/blender/tests/fixtures/paladin_plates.json
vendored
Normal file
File diff suppressed because one or more lines are too long
50
surfaces/blender/tests/fixtures/plates_bastion.json
vendored
Normal file
50
surfaces/blender/tests/fixtures/plates_bastion.json
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{"source": {"branch": "nibu/fable-bastion-2", "sha": "eeda8bf2defd411bebc2fd438d8934ba46e88614", "blender": "5.3.0"},
|
||||
"table": {"schema": "brokkr.plates.v0", "plates": [
|
||||
{"name": "Core.upper", "mat": "gunmetal", "bevel": 0.0, "mirror": true, "points": [[0.0, 5.3, 5.3], [2.2, 5.0, 5.3], [4.3, 3.6, 5.3], [4.5, 0.9, 5.2], [4.5, -1.4, 5.4], [4.3, -2.8, 5.6], [3.6, -4.4, 5.8], [2.2, -5.0, 5.9], [0.0, -5.0, 5.9], [0.0, 3.4, 6.8], [2.2, 3.4, 6.8], [4.0, 3.0, 6.6], [4.2, 0.9, 6.8], [4.2, -1.4, 6.8], [3.9, -2.8, 6.8], [3.2, -4.2, 6.8], [0.0, -4.6, 6.9], [2.6, 2.6, 7.3], [2.6, -2.6, 7.3], [0.0, 3.4, 7.0]]},
|
||||
{"name": "Core.belly", "mat": "gunmetal", "bevel": 0.03, "mirror": true, "points": [[2.3, 4.7, 5.3], [2.3, -4.9, 5.9], [1.7, 4.0, 3.6], [1.8, 2.2, 3.3], [1.8, -2.6, 3.35], [1.5, -4.6, 4.0], [1.2, 4.9, 3.7]]},
|
||||
{"name": "Core.cheek_tray", "mat": "gunmetal", "bevel": 0.0, "sides": "both", "faces": [{"at": [2.2479736988984707, 5.264865987629634, 5.0], "normal": [0.5429510753626048, 0.839764329894162, 0.0]}, {"at": [1.6941636020286137, 4.40830637113759, 5.0], "normal": [-0.5429510753626048, -0.839764329894162, 0.0]}, {"at": [0.0, 0.0, 4.9], "normal": [0.0, 0.0, -1.0]}, {"at": [0.0, 0.0, 5.3], "normal": [0.0, 0.0, 1.0]}, {"at": [2.5, 0.0, 0.0], "normal": [-1.0, 0.0, 0.0]}, {"at": [4.750163376895761, 0.8804114363827034, 4.6936620832203895], "normal": [1.0, 0.07, 0.38]}]},
|
||||
{"name": "Hull.Brow", "mat": "olive", "bevel": 0.04, "mirror": true, "points": [[0.0, 6.3, 5.58], [1.05, 6.25, 5.72], [2.0, 5.72, 5.76], [2.28, 4.95, 5.8], [0.0, 6.14, 6.12], [1.0, 6.1, 6.14], [1.92, 5.6, 6.16], [2.2, 4.95, 6.2], [0.0, 3.25, 7.0], [2.05, 3.25, 7.0], [0.0, 3.25, 6.2], [2.28, 3.25, 6.2]], "clad": {"mat": "olive_light", "facets": [{"n": [0, 0, 1], "cos": 0.6}, {"radial": [0, 0, 1], "min_r": 1.0, "cos": 0.25}], "floor": -0.35, "min_area": 0.9, "lifts": [0.045, 0.075], "inset": 0.11, "gap": 0.05, "split": 2.2, "seed": 2}},
|
||||
{"name": "Hull.Chin", "mat": "olive", "bevel": 0.04, "mirror": true, "points": [[0.0, 5.78, 5.2], [1.0, 5.78, 5.2], [2.1, 5.15, 5.2], [2.3, 4.3, 5.2], [0.0, 5.45, 3.95], [0.85, 5.45, 3.95], [1.75, 4.95, 3.98], [1.95, 4.3, 4.0], [2.3, 3.5, 5.2], [1.95, 3.5, 3.95]], "clad": {"mat": "olive_light", "facets": [{"n": [0, 0, 1], "cos": 0.6}, {"radial": [0, 0, 1], "min_r": 1.0, "cos": 0.25}], "floor": -0.35, "min_area": 0.9, "lifts": [0.045, 0.075], "inset": 0.11, "gap": 0.05, "split": 2.2, "seed": 7}},
|
||||
{"name": "Hull.Sill", "mat": "olive_light", "bevel": 0.02, "mirror": true, "points": [[0.0, 5.9, 5.2], [1.05, 5.9, 5.2], [2.2, 5.22, 5.2], [0.0, 5.84, 5.3], [1.02, 5.84, 5.3], [2.14, 5.18, 5.3], [0.0, 5.3, 5.2], [2.0, 4.9, 5.2], [0.0, 5.3, 5.3], [2.0, 4.9, 5.3]]},
|
||||
{"name": "Hull.Jaw", "mat": "olive_light", "bevel": 0.03, "mirror": true, "points": [[1.2, 5.3, 3.97], [1.2, 3.7, 3.97], [1.0, 5.12, 3.3], [1.0, 3.85, 3.3]]},
|
||||
{"name": "Hull.Cheek", "mat": "olive", "bevel": 0.04, "sides": "both", "faces": [{"through": [[2.4, 5.5, 5.25], [4.72, 4.0, 5.25], [2.38, 5.2, 6.2]], "out": [0.5, 1.0, 0.2]}, {"at": [4.93672112563192, 0.8934704787942345, 4.76455402774013], "normal": [1.0, 0.07, 0.38]}, {"at": [4.2, 0.9, 6.95], "normal": [0.3, 0.08, 1.0]}, {"at": [2.38, 5.2, 6.2], "normal": [0.12, 0.4, 1.0]}, {"at": [0.0, 0.0, 5.25], "normal": [0.0, 0.0, -1.0]}, {"at": [0.0, 0.9, 0.0], "normal": [0.0, -1.0, 0.0]}, {"at": [2.38, 0.0, 0.0], "normal": [-1.0, 0.0, 0.0]}, {"at": [2.057666384578959, 1.9719302852215022, 0.0], "normal": [-0.7219882051154242, -0.6919053632356148, -0.0]}], "clad": {"mat": "olive_light", "facets": [{"n": [0, 0, 1], "cos": 0.6}, {"radial": [0, 0, 1], "min_r": 1.0, "cos": 0.25}], "floor": -0.35, "min_area": 0.9, "lifts": [0.045, 0.075], "inset": 0.11, "gap": 0.05, "split": 2.2, "seed": [4, 3]}},
|
||||
{"name": "Hull.Skirt", "mat": "olive", "bevel": 0.035, "sides": "both", "points": [[4.622999999999999, 4.0, 5.3], [4.8016, 3.62, 4.9], [5.1695, 1.35, 4.35], [5.03, 0.9, 4.8], [4.384, 0.9, 6.5], [4.295, 3.8, 6.2], [4.324507602022145, 3.97910553214155, 5.186572888768415], [4.503107602022145, 3.59910553214155, 4.786572888768416], [4.8710076020221456, 1.3291055321415504, 4.236572888768415], [4.731507602022146, 0.8791055321415502, 4.686572888768415], [4.085507602022146, 0.8791055321415502, 6.3865728887684154], [3.9965076020221453, 3.77910553214155, 6.086572888768416]]},
|
||||
{"name": "Hull.CheekLip", "mat": "olive_light", "bevel": 0.02, "sides": "both", "faces": [{"at": [2.4, 5.5, 5.0], "normal": [0.5429510753626048, 0.839764329894162, 0.0]}, {"at": [2.313127827941983, 5.365637707216934, 5.0], "normal": [-0.5429510753626048, -0.839764329894162, 0.0]}, {"at": [0.0, 0.0, 4.84], "normal": [0.0, 0.0, -1.0]}, {"at": [0.0, 0.0, 4.99], "normal": [0.0, 0.0, 1.0]}, {"at": [2.45, 0.0, 0.0], "normal": [-1.0, 0.0, 0.0]}, {"at": [4.93672112563192, 0.8934704787942345, 4.76455402774013], "normal": [1.0, 0.07, 0.38]}]},
|
||||
{"name": "Hull.Quarter", "mat": "olive", "bevel": 0.04, "sides": "both", "faces": [{"at": [5.0, -1.4, 5.5], "normal": [1.0, -0.1, 0.4]}, {"at": [4.45, -3.7, 5.7], "normal": [0.904, -0.427, 0.4]}, {"at": [3.2, -4.9, 5.85], "normal": [0.351, -0.936, 0.35]}, {"at": [4.2, -2.6, 6.95], "normal": [0.28, -0.1, 1.0]}, {"at": [0.0, -1.35, 5.5], "normal": [0.0, -0.12, -1.0]}, {"at": [0.0, -1.4, 0.0], "normal": [0.0, 1.0, 0.0]}, {"at": [1.75, 0.0, 0.0], "normal": [-1.0, 0.0, 0.0]}, {"at": [2.139533523229853, -1.8827895004422703, 0.0], "normal": [-0.7507135169227553, 0.6606278948920247, -0.0]}], "clad": {"mat": "olive_light", "facets": [{"n": [0, 0, 1], "cos": 0.6}, {"radial": [0, 0, 1], "min_r": 1.0, "cos": 0.25}], "floor": -0.35, "min_area": 0.9, "lifts": [0.045, 0.075], "inset": 0.11, "gap": 0.05, "split": 2.2, "seed": [15, 14]}},
|
||||
{"name": "Hull.FlankRoof", "mat": "olive_light", "bevel": 0.03, "sides": "both", "faces": [{"at": [4.3, 0.0, 7.05], "normal": [0.3, 0.0, 1.0]}, {"at": [4.7, 0.0, 0.0], "normal": [1.0, 0.0, 0.25]}, {"at": [0.0, 0.0, 6.88], "normal": [0.0, 0.0, -1.0]}, {"at": [0.0, 0.85, 0.0], "normal": [0.0, 1.0, 0.0]}, {"at": [0.0, -1.3, 0.0], "normal": [0.0, -1.0, 0.0]}, {"at": [2.8, 0.0, 0.0], "normal": [-1.0, 0.0, 0.0]}], "clad": {"mat": "olive", "facets": [{"n": [0, 0, 1], "cos": 0.6}, {"radial": [0, 0, 1], "min_r": 1.0, "cos": 0.25}], "floor": -0.35, "min_area": 0.9, "lifts": [0.045, 0.075], "inset": 0.11, "gap": 0.05, "split": 2.2, "seed": [10, 9]}},
|
||||
{"name": "Hull.FlankSill", "mat": "olive", "bevel": 0.03, "sides": "both", "faces": [{"at": [4.98, 0.0, 0.0], "normal": [1.0, 0.0, 0.12]}, {"at": [3.9, 0.0, 0.0], "normal": [-1.0, 0.0, 0.0]}, {"at": [0.0, 0.0, 5.12], "normal": [0.0, 0.0, -1.0]}, {"at": [0.0, 0.0, 5.45], "normal": [0.0, 0.0, 1.0]}, {"at": [0.0, 0.85, 0.0], "normal": [0.0, 1.0, 0.0]}, {"at": [0.0, -1.3, 0.0], "normal": [0.0, -1.0, 0.0]}]},
|
||||
{"name": "Hull.Tail", "mat": "olive_light", "bevel": 0.03, "mirror": true, "points": [[1.72, -2.75, 7.5], [1.72, -5.0, 7.3], [1.72, -2.75, 7.15], [1.72, -5.0, 7.0]], "clad": {"mat": "olive", "facets": [{"n": [0, 0, 1], "cos": 0.6}, {"radial": [0, 0, 1], "min_r": 1.0, "cos": 0.25}], "floor": -0.35, "min_area": 0.9, "lifts": [0.045, 0.075], "inset": 0.11, "gap": 0.05, "split": 2.2, "seed": 19}},
|
||||
{"name": "Hull.BellySide", "mat": "olive_light", "bevel": 0.03, "sides": "both", "points": [[2.1, 2.2, 3.9], [2.1, -2.4, 3.95], [2.45, 2.0, 4.1], [2.45, -2.2, 4.15], [2.45, 2.0, 4.85], [2.45, -2.2, 4.9], [2.25, 2.2, 5.1], [2.25, -2.4, 5.15], [1.8, 2.2, 3.9], [1.8, -2.4, 5.15]], "clad": {"mat": "olive", "facets": [{"n": [0, 0, 1], "cos": 0.6}, {"radial": [0, 0, 1], "min_r": 1.0, "cos": 0.25}], "floor": -0.35, "min_area": 0.9, "lifts": [0.045, 0.075], "inset": 0.11, "gap": 0.05, "split": 2.2, "seed": [1, 0]}}
|
||||
]},
|
||||
"cases": [
|
||||
{"side": 1, "truth": {
|
||||
"Core.upper": {"solid":[[0.0,5.3000002,5.3000002],[2.2,5.0,5.3000002],[4.3000002,3.5999999,5.3000002],[4.5,0.9,5.1999998],[4.5,-1.4,5.4000001],[4.3000002,-2.8,5.5999999],[3.5999999,-4.4000001,5.8000002],[2.2,-5.0,5.9000001],[2.2,3.4000001,6.8000002],[4.0,3.0,6.5999999],[4.1999998,0.9,6.8000002],[4.1999998,-1.4,6.8000002],[3.9000001,-2.8,6.8000002],[3.2,-4.1999998,6.8000002],[0.0,-4.5999999,6.9000001],[2.5999999,2.5999999,7.3000002],[2.5999999,-2.5999999,7.3000002],[0.0,3.4000001,7.0],[-2.2,5.0,5.3000002],[-4.3000002,3.5999999,5.3000002],[-4.5,0.9,5.1999998],[-4.5,-1.4,5.4000001],[-4.3000002,-2.8,5.5999999],[-3.5999999,-4.4000001,5.8000002],[-2.2,-5.0,5.9000001],[-2.2,3.4000001,6.8000002],[-4.0,3.0,6.5999999],[-4.1999998,0.9,6.8000002],[-4.1999998,-1.4,6.8000002],[-3.9000001,-2.8,6.8000002],[-3.2,-4.1999998,6.8000002],[-2.5999999,2.5999999,7.3000002],[-2.5999999,-2.5999999,7.3000002]],"facets":54,"panels":[],"bolts":0},
|
||||
"Core.belly": {"solid":[[2.3,4.6999998,5.3000002],[2.3,-4.9000001,5.9000001],[1.7,4.0,3.5999999],[1.8,2.2,3.3],[1.8,-2.5999999,3.3499999],[1.5,-4.5999999,4.0],[1.2,4.9000001,3.7],[-2.3,4.6999998,5.3000002],[-2.3,-4.9000001,5.9000001],[-1.7,4.0,3.5999999],[-1.8,2.2,3.3],[-1.8,-2.5999999,3.3499999],[-1.5,-4.5999999,4.0],[-1.2,4.9000001,3.7]],"facets":18,"panels":[],"bolts":0},
|
||||
"Core.cheek_tray.R": {"solid":[[2.5,5.1019173,4.9000001],[4.4651914,3.8313196,4.9000001],[2.5,5.1019173,5.3000002],[4.3059859,3.9342542,5.3000002],[2.5,3.8872914,4.9000001],[4.5542455,2.5591156,4.9000001],[2.5,3.8872914,5.3000002],[4.39504,2.6620502,5.3000002]],"facets":6,"panels":[],"bolts":0},
|
||||
"Core.cheek_tray.L": {"solid":[[-2.5,5.1019173,4.9000001],[-4.4651914,3.8313196,4.9000001],[-2.5,5.1019173,5.3000002],[-4.3059859,3.9342542,5.3000002],[-2.5,3.8872914,4.9000001],[-4.5542455,2.5591156,4.9000001],[-2.5,3.8872914,5.3000002],[-4.39504,2.6620502,5.3000002]],"facets":6,"panels":[],"bolts":0},
|
||||
"Hull.Brow": {"solid":[[0.0,6.3000002,5.5799999],[1.05,6.25,5.7199998],[2.0,5.7199998,5.7600002],[2.28,4.9499998,5.8000002],[0.0,6.1399999,6.1199999],[1.0,6.0999999,6.1399999],[1.92,5.5999999,6.1599998],[2.2,4.9499998,6.1999998],[2.05,3.25,7.0],[2.28,3.25,6.1999998],[-1.05,6.25,5.7199998],[-2.0,5.7199998,5.7600002],[-2.28,4.9499998,5.8000002],[-1.0,6.0999999,6.1399999],[-1.92,5.5999999,6.1599998],[-2.2,4.9499998,6.1999998],[-2.05,3.25,7.0],[-2.28,3.25,6.1999998]],"facets":29,"panels":[[0.3885275,5.9889116,6.1526303],[-0.9221566,5.9889116,6.1526303],[-1.8945599,3.3495317,6.9490747],[0.3885272,3.3495317,6.9490747],[0.3885275,6.0105786,6.2244325],[-0.9221566,6.0105786,6.2244325],[-1.8945599,3.3711982,7.0208769],[0.3885272,3.3711982,7.0208769],[0.3685275,5.9972091,6.2493577],[-0.9080032,5.9972091,6.2493577],[-1.866298,3.3961234,7.0342464],[0.3685272,3.3961234,7.0342464],[1.8945597,3.3495317,6.9490747],[0.9221566,5.9889116,6.1526303],[0.6585274,5.9889116,6.1526303],[0.6585273,3.3495317,6.9490747],[1.8945597,3.3625317,6.992156],[0.9221566,6.0019116,6.1957116],[0.6585274,6.0019116,6.1957116],[0.6585273,3.3625317,6.992156],[1.866298,3.3874567,7.0055256],[0.9080032,5.9885426,6.2206364],[0.6785274,5.9885426,6.2206364],[0.6785272,3.3874567,7.0055256],[1.9754326,3.5847373,6.8687177],[1.811658,5.5343542,6.1817808],[1.1911595,5.8715816,6.168292],[1.9828436,3.60004,6.9103818],[1.8190689,5.5496569,6.2234454],[1.1985704,5.8868842,6.2099562],[1.9730231,3.6689181,6.9084315],[1.8035812,5.5455861,6.2492967],[1.2357996,5.8541627,6.2369537],[-1.811658,5.5343542,6.1817808],[-1.9754326,3.5847373,6.8687177],[-1.1911596,5.8715811,6.168292],[-1.8190689,5.5496569,6.2234454],[-1.9828436,3.60004,6.9103818],[-1.1985705,5.8868837,6.2099562],[-1.8035812,5.5455861,6.2492967],[-1.9730231,3.6689181,6.9084315],[-1.2357996,5.8541627,6.2369537]],"bolts":14},
|
||||
"Hull.Chin": {"solid":[[1.0,5.7800002,5.1999998],[2.0999999,5.1500001,5.1999998],[2.3,4.3000002,5.1999998],[0.85,5.4499998,3.95],[1.75,4.9499998,3.98],[1.95,4.3000002,4.0],[2.3,3.5,5.1999998],[1.95,3.5,3.95],[-1.0,5.7800002,5.1999998],[-2.0999999,5.1500001,5.1999998],[-2.3,4.3000002,5.1999998],[-0.85,5.4499998,3.95],[-1.75,4.9499998,3.98],[-1.95,4.3000002,4.0],[-2.3,3.5,5.1999998],[-1.95,3.5,3.95]],"facets":18,"panels":[[-0.3619034,5.6700001,5.1800003],[-0.9707303,5.6700001,5.1800003],[-2.0038681,5.0782938,5.1800003],[-2.1900001,4.2872334,5.1800003],[-2.1900001,3.6100001,5.1800003],[-0.3619035,3.6100001,5.1800003],[-0.3619034,5.6700001,5.2250004],[-0.9707303,5.6700001,5.2250004],[-2.0038681,5.0782938,5.2250004],[-2.1900001,4.2872334,5.2250004],[-2.1900001,3.6100001,5.2250004],[-0.3619035,3.6100001,5.2250004],[-0.3819034,5.6500001,5.2450004],[-0.9654085,5.6500001,5.2450004],[-1.9863894,5.0652566,5.2450004],[-2.1700001,4.2849121,5.2450004],[-2.1700001,3.6300001,5.2450004],[-0.3819035,3.6300001,5.2450004],[2.1900001,4.2872334,5.1800003],[2.0038681,5.0782938,5.1800003],[0.9707303,5.6700001,5.1800003],[-0.0919034,5.6700001,5.1800003],[-0.0919033,3.6100001,5.1800003],[2.1900001,3.6100001,5.1800003],[2.1900001,4.2872334,5.2550001],[2.0038681,5.0782938,5.2550001],[0.9707303,5.6700001,5.2550001],[-0.0919034,5.6700001,5.2550001],[-0.0919033,3.6100001,5.2550001],[2.1900001,3.6100001,5.2550001],[2.1700001,4.2849121,5.2750001],[1.9863894,5.0652566,5.2750001],[0.9654086,5.6500001,5.2750001],[-0.0719035,5.6500001,5.2750001],[-0.0719033,3.6300001,5.2750001],[2.1700001,3.6300001,5.2750001],[-0.8764993,5.7325845,5.0987487],[-0.0504766,5.7325845,5.0987487],[-0.0504766,5.4587402,4.061461],[-0.7520249,5.4587402,4.061461],[-0.8764993,5.7760935,5.0872622],[-0.0504766,5.7760935,5.0872622],[-0.0504766,5.5022492,4.0499744],[-0.7520249,5.5022492,4.0499744],[-0.8540447,5.7903261,5.06282],[-0.0704766,5.7903261,5.06282],[-0.0704766,5.5266919,4.0642071],[-0.7342112,5.5266919,4.0642071],[0.2195233,5.7325845,5.0987492],[0.8764993,5.7325845,5.0987492],[0.7520248,5.4587402,4.0614614],[0.2195233,5.4587402,4.0614614],[0.2195233,5.8051,5.0796051],[0.8764993,5.8051,5.0796051],[0.7520248,5.5312557,4.0423174],[0.2195233,5.5312557,4.0423174],[0.2395233,5.8193321,5.0551624],[0.8540447,5.8193321,5.0551624],[0.7342112,5.5556984,4.05655],[0.2395233,5.5556984,4.05655],[1.6727291,5.0044794,4.0888481],[0.9496512,5.4084468,4.064147],[1.0728847,5.6800089,5.100059],[1.9638414,5.1720209,5.0994902],[1.708429,5.0671163,4.068181],[0.9853511,5.4710841,4.0434804],[1.1085846,5.7426457,5.079392],[1.9995413,5.2346578,5.0788231],[1.705741,5.0969553,4.0813947],[1.0146099,5.4830751,4.057785],[1.1331977,5.7443995,5.0546436],[1.9859257,5.2582078,5.0540991],[-1.6727293,5.0044794,4.0888476],[-1.9638416,5.1720209,5.0994897],[-1.0728848,5.6800089,5.1000586],[-0.9496514,5.4084473,4.064147],[-1.6941493,5.0420618,4.0764475],[-1.9852614,5.2096033,5.0870895],[-1.0943048,5.7175913,5.0876584],[-0.9710713,5.4460292,4.0517464],[-1.6914613,5.0719008,4.0896611],[-1.9716458,5.2331533,5.0623655],[-1.1189178,5.7193451,5.0629101],[-1.0003301,5.4580207,4.0660515]],"bolts":28},
|
||||
"Hull.Sill": {"solid":[[1.05,5.9000001,5.1999998],[2.2,5.2199998,5.1999998],[1.02,5.8400002,5.3000002],[2.1400001,5.1799998,5.3000002],[2.0,4.9000001,5.1999998],[2.0,4.9000001,5.3000002],[-1.05,5.9000001,5.1999998],[-2.2,5.2199998,5.1999998],[-1.02,5.8400002,5.3000002],[-2.1400001,5.1799998,5.3000002],[-2.0,4.9000001,5.1999998],[-2.0,4.9000001,5.3000002]],"facets":12,"panels":[],"bolts":0},
|
||||
"Hull.Jaw": {"solid":[[1.2,5.3000002,3.97],[1.2,3.7,3.97],[1.0,5.1199999,3.3],[1.0,3.8499999,3.3],[-1.2,5.3000002,3.97],[-1.2,3.7,3.97],[-1.0,5.1199999,3.3],[-1.0,3.8499999,3.3]],"facets":6,"panels":[],"bolts":0},
|
||||
"Hull.Cheek.R": {"solid":[[4.0699725,4.0184684,6.4698162],[4.5260153,4.125421,5.25],[2.3800001,5.1999998,6.1999998],[2.3800001,5.5129309,5.25],[3.9938784,3.1328073,6.8332119],[4.0936742,0.9,6.9818964],[4.7517948,0.9,5.25],[2.3800001,2.2249999,7.3899999],[3.0849326,0.9,7.2845197],[2.3800001,1.6355822,7.4371529],[3.084933,0.9,5.25],[2.3800001,1.6355822,5.25]],"facets":8,"panels":[[4.0605597,2.097348,6.7920513],[4.1092281,1.0084592,6.8645611],[4.6863694,1.0084592,5.3457685],[4.6074672,2.1356313,5.3457685],[4.1025352,2.1002862,6.808002],[4.1512036,1.0113975,6.8805118],[4.7283449,1.0113975,5.3617191],[4.6494427,2.1385696,5.3617191],[4.1291742,2.0821021,6.7976732],[4.1760793,1.0326607,6.8675566],[4.7384973,1.0326607,5.3875098],[4.6624231,2.1194293,5.3875098],[4.0154209,3.1072907,6.7247982],[4.048501,2.3671649,6.7740841],[4.588614,2.4049726,5.345768],[4.4765992,4.0051847,5.345768],[4.0846686,3.9132679,6.3940973],[4.0853801,3.1121879,6.7513828],[4.1184602,2.372062,6.8006682],[4.6585732,2.4098697,5.3723526],[4.5465584,4.0100818,5.3723526],[4.1546278,3.918165,6.420682],[4.1113443,3.1090918,6.7400494],[4.1433125,2.3938506,6.7876778],[4.6687603,2.4306319,5.3981428],[4.5596213,3.9897637,5.3981428],[4.1793475,3.9005809,6.4152932],[2.4871092,4.9912777,6.2489614],[2.4871092,3.9125221,6.6804638],[3.9440475,3.8522353,6.5297465],[3.9538085,3.9658458,6.4831309],[2.4920921,5.0078874,6.2904863],[2.4920921,3.9291317,6.7219882],[3.9490304,3.868845,6.5712709],[3.9587915,3.9824557,6.5246553],[2.5141838,4.978662,6.3211989],[2.5141838,3.9542611,6.7309594],[3.9328942,3.895556,6.5841966],[3.9402881,3.9816122,6.5488873],[2.4871085,3.661833,6.7807398],[2.4871085,2.4007239,7.285183],[3.8869905,3.1881585,6.8022237],[3.9225841,3.6024342,6.6322427],[2.4954133,3.6895161,6.849947],[2.4954133,2.428407,7.3543901],[3.8952954,3.2158415,6.8714314],[3.9308889,3.6301172,6.7014499],[2.5175052,3.6775062,6.8737741],[2.5175049,2.4690814,7.3571434],[3.8784785,3.2346296,6.8876081],[3.9115732,3.6198206,6.7295604],[3.9776521,1.0081506,6.9871097],[3.9508991,1.6067107,6.9472508],[2.4796586,1.5705372,7.3915172],[2.4796588,1.6776093,7.3829517],[3.121223,1.0081505,7.2440386],[3.990545,1.0115887,7.030086],[3.9637921,1.6101487,6.9902272],[2.4925516,1.5739753,7.4344935],[2.4925516,1.6810473,7.4259276],[3.1341157,1.0115886,7.287015],[3.976222,1.0330583,7.053607],[3.9512725,1.5912702,7.0164351],[2.4791203,1.5550743,7.4609771],[2.4791203,1.7304838,7.4469442],[3.147486,1.0330582,7.302228],[3.9388695,1.8758466,6.9293289],[3.89083,2.9506743,6.8577552],[2.4796584,2.1568897,7.3446093],[2.4796584,1.839969,7.3699627],[3.9603574,1.8815767,7.0009561],[3.912318,2.9564044,6.9293823],[2.5011463,2.1626198,7.4162364],[2.5011463,1.8456992,7.4415898],[3.9460559,1.9025701,7.024509],[3.9003541,2.9250953,6.956418],[2.5260382,2.1520419,7.4305568],[2.5260382,1.8676562,7.4533076],[4.0081611,4.0742669,6.3467288],[4.3805432,4.1615996,5.3506866],[3.2888443,4.8674393,5.3506866],[3.1595957,4.6675353,6.2112494],[4.0474086,4.1349697,6.366724],[4.4197907,4.222302,5.3706822],[3.3280916,4.9281421,5.3706822],[3.1988432,4.7282381,6.2312446],[4.0485392,4.1642456,6.350646],[4.4057102,4.2480106,5.3952904],[3.352458,4.9289927,5.3952904],[3.2286329,4.7374768,6.2197423],[3.0621083,5.0140362,5.3506856],[2.4632707,5.4012156,5.3506856],[2.4632707,5.154366,6.1000748],[2.9381692,4.8223443,6.1758957],[3.0856566,5.050458,5.3626833],[2.486819,5.4376373,5.3626833],[2.486819,5.1907878,6.1120725],[2.9617176,4.8587661,6.1878929],[3.0764322,5.0730267,5.3872914],[2.514328,5.4364557,5.3872914],[2.514328,5.2016211,6.1002059],[2.9587035,4.8909397,6.1711535]],"bolts":34},
|
||||
"Hull.Cheek.L": {"solid":[[-4.0699725,4.0184684,6.4698162],[-4.5260153,4.125421,5.25],[-2.3800001,5.1999998,6.1999998],[-2.3800001,5.5129309,5.25],[-3.9938784,3.1328073,6.8332119],[-4.0936742,0.9,6.9818964],[-4.7517948,0.9,5.25],[-2.3800001,2.2249999,7.3899999],[-3.0849326,0.9,7.2845197],[-2.3800001,1.6355822,7.4371529],[-3.084933,0.9,5.25],[-2.3800001,1.6355822,5.25]],"facets":8,"panels":[[-4.0154204,3.1072907,6.7247982],[-4.0846686,3.9132679,6.3940978],[-4.4765992,4.0051847,5.3457685],[-4.5553617,2.8800015,5.3457685],[-4.0272317,2.8430324,6.7423954],[-4.0853796,3.1121879,6.7513828],[-4.1546278,3.918165,6.4206824],[-4.5465584,4.0100818,5.3723531],[-4.6253209,2.8848987,5.3723531],[-4.0971909,2.8479295,6.76898],[-4.1113443,3.1090918,6.7400494],[-4.1793475,3.9005809,6.4152937],[-4.5596213,3.9897637,5.3981438],[-4.6355081,2.9056606,5.3981438],[-4.1220431,2.8697181,6.7559896],[-4.5742154,2.6106603,5.3457689],[-4.6863694,1.0084593,5.3457689],[-4.1092281,1.0084593,6.8645616],[-4.0392909,2.5732152,6.7603631],[-4.6161909,2.6135986,5.3617196],[-4.7283449,1.0113976,5.3617196],[-4.1512036,1.0113976,6.8805122],[-4.0812664,2.5761535,6.7763138],[-4.6291714,2.5944583,5.3875103],[-4.7384973,1.0326608,5.3875103],[-4.1760798,1.0326608,6.8675566],[-4.1079054,2.5579693,6.7659855],[-3.9058976,3.4082141,6.7119331],[-3.886991,3.1881585,6.8022237],[-2.4871092,2.4007244,7.285183],[-2.4871092,3.4669223,6.8587041],[-3.9142027,3.4358971,6.7811403],[-3.8952961,3.2158415,6.8714314],[-2.495414,2.4284074,7.3543906],[-2.495414,3.4946053,6.9279113],[-3.894887,3.4256005,6.8092508],[-3.8784792,3.2346299,6.8876081],[-2.5175056,2.4690816,7.3571439],[-2.5175056,3.4825954,6.9517384],[-2.4871089,4.9912777,6.2489614],[-3.9538083,3.9658461,6.4831309],[-3.9273598,3.6580153,6.609437],[-2.4871089,3.7176116,6.7584281],[-2.4920919,5.0078878,6.2904859],[-3.9587913,3.9824557,6.5246553],[-3.9323428,3.6746249,6.6509614],[-2.4920919,3.7342215,6.7999525],[-2.5141835,4.9786625,6.3211989],[-3.9402878,3.9816124,6.5488873],[-3.9162068,3.7013359,6.6638875],[-2.5141835,3.7593505,6.8089242],[-2.4796581,2.0325902,7.3545527],[-2.4796581,2.1568892,7.3446088],[-3.89083,2.9506741,6.8577557],[-3.93027,2.0682566,6.9165163],[-2.4925508,2.0360284,7.3975286],[-2.4925508,2.1603274,7.3875852],[-3.9037228,2.9541123,6.900732],[-3.9431629,2.0716946,6.9594927],[-2.5174427,2.0579853,7.4092464],[-2.5174427,2.1497495,7.4019055],[-3.8917589,2.9228029,6.9277678],[-3.9288611,2.0926881,6.9830456],[-3.1212225,1.0081503,7.2440386],[-2.4796584,1.6776092,7.3829513],[-2.4796584,1.7631588,7.3761072],[-3.9422991,1.7991207,6.9344378],[-3.9776518,1.0081505,6.9871097],[-3.1427104,1.0138805,7.3156652],[-2.5011466,1.6833394,7.4545784],[-2.5011466,1.768889,7.4477344],[-3.9637873,1.8048508,7.0060649],[-3.9991398,1.0138806,7.0587363],[-3.1560807,1.0353501,7.3308787],[-2.5260382,1.6927865,7.4672966],[-2.5260382,1.7509302,7.4626455],[-3.9512677,1.7859722,7.0322728],[-3.9848168,1.0353502,7.0822577],[-2.4632707,5.4012156,5.3506866],[-3.020721,5.0407953,5.3506866],[-2.8977513,4.8506017,6.1694436],[-2.4632707,5.1543655,6.1000757],[-2.5025179,5.4619184,5.3706822],[-3.0599682,5.1014977,5.3706822],[-2.9369986,4.9113045,6.1894393],[-2.5025182,5.2150683,6.1200714],[-2.5300269,5.4607368,5.3952904],[-3.0507438,5.1240664,5.3952904],[-2.9339843,4.9434781,6.1726995],[-2.5300269,5.2259021,6.1082048],[-3.2474575,4.8941984,5.3506866],[-4.3805437,4.1615996,5.3506866],[-4.0081615,4.0742669,6.3467283],[-3.1191783,4.6957932,6.2047954],[-3.2710059,4.9306197,5.3626838],[-4.4040923,4.1980209,5.3626838],[-4.0317101,4.1106887,6.358726],[-3.1427269,4.7322149,6.2167931],[-3.295372,4.9314704,5.3872919],[-4.3900118,4.2237296,5.3872919],[-4.0328407,4.1399646,6.342648],[-3.1725166,4.7414536,6.2052908]],"bolts":34},
|
||||
"Hull.Skirt.R": {"solid":[[4.6230001,4.0,5.3000002],[4.8016,3.6199999,4.9000001],[5.1694999,1.35,4.3499999],[5.0300002,0.9,4.8000002],[4.3839998,0.9,6.5],[4.2950001,3.8,6.1999998],[4.3245077,3.9791055,5.186573],[4.5031075,3.5991056,4.7865729],[4.8710074,1.3291055,4.2365727],[4.7315078,0.8791055,4.686573],[4.0855074,0.8791055,6.3865728],[3.9965076,3.7791054,6.0865731]],"facets":8,"panels":[],"bolts":0},
|
||||
"Hull.Skirt.L": {"solid":[[-4.6230001,4.0,5.3000002],[-4.8016,3.6199999,4.9000001],[-5.1694999,1.35,4.3499999],[-5.0300002,0.9,4.8000002],[-4.3839998,0.9,6.5],[-4.2950001,3.8,6.1999998],[-4.3245077,3.9791055,5.186573],[-4.5031075,3.5991056,4.7865729],[-4.8710074,1.3291055,4.2365727],[-4.7315078,0.8791055,4.686573],[-4.0855074,0.8791055,6.3865728],[-3.9965076,3.7791054,6.0865731]],"facets":8,"panels":[],"bolts":0},
|
||||
"Hull.CheekLip.R": {"solid":[[2.45,5.4676719,4.8400002],[4.6892009,4.0199132,4.8400002],[2.45,5.4676719,4.9899998],[4.629499,4.0585136,4.9899998],[2.45,5.2771425,4.8400002],[4.7031698,3.8203516,4.8400002],[2.45,5.2771425,4.9899998],[4.6434679,3.858952,4.9899998]],"facets":6,"panels":[],"bolts":0},
|
||||
"Hull.CheekLip.L": {"solid":[[-2.45,5.4676719,4.8400002],[-4.6892009,4.0199132,4.8400002],[-2.45,5.4676719,4.9899998],[-4.629499,4.0585136,4.9899998],[-2.45,5.2771425,4.8400002],[-4.7031698,3.8203516,4.8400002],[-2.45,5.2771425,4.9899998],[-4.6434679,3.858952,4.9899998]],"facets":6,"panels":[],"bolts":0},
|
||||
"Hull.Quarter.R": {"solid":[[4.2910318,-2.9193861,6.8925695],[4.3936944,-1.4,7.0157642],[4.9976001,-1.4,5.506],[3.5958304,-4.3421259,6.9449539],[3.9363332,-4.6085348,5.8910241],[1.75,-4.8604336,7.409956],[1.75,-5.3931999,5.9851837],[2.5643883,-1.4,7.5279703],[1.75,-2.3254409,7.6634545],[2.5643883,-1.4,5.5060005],[1.75,-2.3254409,5.6170526]],"facets":9,"panels":[[2.6039631,-1.5075765,7.4852662],[1.8505968,-2.3636744,7.6105995],[1.8505968,-3.7839808,7.4685688],[3.7708514,-3.7307458,6.9362202],[4.181469,-2.8904121,6.9052806],[4.2749047,-1.5075765,7.0174022],[2.6160405,-1.5118898,7.5284004],[1.8626742,-2.3679876,7.6537333],[1.8626742,-3.7882941,7.5117025],[3.7829289,-3.7350593,6.9793544],[4.1935463,-2.8947253,6.9484148],[4.2869821,-1.5118899,7.0605364],[2.6295795,-1.5337148,7.543292],[1.8873084,-2.3772049,7.6667795],[1.8873082,-3.7697763,7.5275221],[3.7765129,-3.7174025,7.0037818],[4.1799693,-2.8917232,6.9733815],[4.2717276,-1.5337149,7.0834904],[1.8505965,-4.0526409,7.4417028],[1.8505965,-4.7160707,7.37536],[3.5181954,-4.2478104,6.9552579],[3.6377716,-4.0030956,6.9462481],[1.8707256,-4.0598297,7.5135922],[1.8707258,-4.7232594,7.4472499],[3.5383244,-4.2549992,7.0271478],[3.6579008,-4.0102844,7.0181379],[1.8953596,-4.0811133,7.5254316],[1.8953596,-4.6992774,7.4636159],[3.5305526,-4.2401166,7.0516772],[3.6317692,-4.0329757,7.0440507],[2.7647738,-4.5948009,7.0421376],[1.8471562,-4.8524671,7.273304],[1.8471562,-5.2996264,6.0774708],[2.8457143,-4.9412479,6.0344653],[2.7796867,-4.6345687,7.0570083],[1.862069,-4.8922348,7.2881742],[1.8620691,-5.3393941,6.0923409],[2.8606274,-4.9810157,6.049336],[2.7687323,-4.6642437,7.0491562],[1.8875668,-4.9116745,7.2711391],[1.8875669,-5.3432689,6.1169314],[2.8469315,-4.9989567,6.075614],[3.5113626,-4.385159,6.8540578],[3.0230417,-4.5222793,6.9770751],[3.0996346,-4.8501167,6.0235305],[3.7892847,-4.6026044,5.9938288],[3.5362175,-4.4514389,6.8788414],[3.0478966,-4.5885587,7.0018592],[3.1244895,-4.9163966,6.0483146],[3.8141394,-4.6688843,6.0186129],[3.5286927,-4.4801512,6.8701258],[3.0752041,-4.6074901,6.9843683],[3.1484115,-4.9208369,6.0729723],[3.7952363,-4.688694,6.0451155],[4.8567634,-1.7086165,5.6465893],[4.2893143,-2.930759,6.7566442],[4.0067,-4.2766261,5.9586406],[4.9274721,-1.7305669,5.6585679],[4.3600225,-2.9527094,6.7686234],[4.0774083,-4.2985768,5.9706192],[4.92415,-1.7936081,5.6878805],[4.3820004,-2.9616666,6.7477016],[4.1124616,-4.2452664,5.986618],[4.4087081,-1.5076799,6.8972273],[4.3302989,-2.6681259,6.8031359],[4.869947,-1.5076799,5.7441301],[4.4503107,-1.5118402,6.9138684],[4.371901,-2.672286,6.819777],[4.9115496,-1.5118402,5.7607713],[4.4748921,-1.5336035,6.9010568],[4.4008923,-2.6287878,6.8122573],[4.9101915,-1.5336035,5.8128085],[4.1558022,-3.2465746,6.7950749],[3.6602814,-4.2610569,6.831995],[3.9027374,-4.4507542,6.0815411],[4.2187653,-3.276315,6.8229346],[3.7232447,-4.2907972,6.8598547],[3.9657006,-4.4804945,6.1094007],[4.2140222,-3.3451762,6.8139858],[3.7548034,-4.285428,6.848104],[3.9794402,-4.4611835,6.1528049]],"bolts":27},
|
||||
"Hull.Quarter.L": {"solid":[[-4.2910318,-2.9193861,6.8925695],[-4.3936944,-1.4,7.0157642],[-4.9976001,-1.4,5.506],[-3.5958304,-4.3421259,6.9449539],[-3.9363332,-4.6085348,5.8910241],[-1.75,-4.8604336,7.409956],[-1.75,-5.3931999,5.9851837],[-2.5643883,-1.4,7.5279703],[-1.75,-2.3254409,7.6634545],[-2.5643883,-1.4,5.5060005],[-1.75,-2.3254409,5.6170526]],"facets":9,"panels":[[-1.8505965,-4.7160707,7.3753595],[-1.8505963,-4.0014849,7.4468179],[-3.6631114,-3.9512372,6.9443383],[-3.5181952,-4.2478104,6.9552579],[-1.8707256,-4.7232594,7.4472494],[-1.8707255,-4.0086741,7.5187078],[-3.6832407,-3.9584262,7.0162282],[-3.5383244,-4.2549992,7.0271473],[-1.8953596,-4.6992774,7.4636154],[-1.8953595,-4.0299578,7.5305471],[-3.6571088,-3.9811172,7.042141],[-3.5305526,-4.2401166,7.0516772],[-1.8505961,-3.7328248,7.4736838],[-1.8505962,-2.3636742,7.6105995],[-2.6039624,-1.5075763,7.4852662],[-4.2749043,-1.5075763,7.0174017],[-4.1814685,-2.8904119,6.9052796],[-3.7961907,-3.6788878,6.93431],[-1.8626735,-3.7371383,7.5168176],[-1.8626738,-2.3679876,7.6537333],[-2.61604,-1.5118898,7.5283999],[-4.2869816,-1.5118897,7.0605354],[-4.1935458,-2.8947253,6.9484134],[-3.8082683,-3.6832011,6.9774437],[-1.8873075,-3.7186203,7.5326371],[-1.8873078,-2.3772047,7.666779],[-2.6295791,-1.5337147,7.543292],[-4.2717271,-1.5337147,7.0834894],[-4.1799688,-2.8917229,6.9733806],[-3.8018522,-3.6655443,7.0018711],[-2.781431,-4.5901232,7.037941],[-3.5113628,-4.385159,6.8540564],[-3.7892847,-4.6026049,5.9938278],[-2.8620911,-4.9353704,6.0337601],[-2.8062859,-4.6564031,7.0627251],[-3.5362177,-4.4514389,6.8788404],[-3.8141396,-4.6688848,6.0186119],[-2.886946,-5.0016503,6.0585442],[-2.8335936,-4.6753345,7.0452337],[-3.528693,-4.4801512,6.8701243],[-3.7952366,-4.6886945,6.0451145],[-2.9108679,-5.0060902,6.0832024],[-1.847156,-5.2996264,6.0774708],[-1.847156,-4.8524671,7.273304],[-2.5231628,-4.6626449,7.103004],[-2.6081707,-5.0265012,6.0446959],[-1.8620689,-5.3393941,6.0923409],[-1.862069,-4.8922348,7.2881746],[-2.5380757,-4.7024126,7.1178746],[-2.6230836,-5.0662689,6.059566],[-1.8875667,-5.3432684,6.1169314],[-1.8875668,-4.9116745,7.2711396],[-2.5271213,-4.7320881,7.1100225],[-2.6093879,-5.0842099,6.0858445],[-4.006701,-4.2766266,5.9586406],[-4.2893152,-2.9307594,6.7566447],[-4.8567643,-1.7086169,5.6465893],[-4.0491261,-4.2897968,5.9658279],[-4.3317404,-2.9439294,6.7638316],[-4.8991895,-1.721787,5.6537766],[-4.0841789,-4.2364864,5.9818268],[-4.3537178,-2.9528866,6.7429104],[-4.8958673,-1.7848281,5.6830893],[-4.3302989,-2.6681259,6.8031359],[-4.4087081,-1.5076799,6.8972273],[-4.869947,-1.5076799,5.7441301],[-4.371901,-2.672286,6.819777],[-4.4503107,-1.5118402,6.9138684],[-4.9115496,-1.5118402,5.7607713],[-4.4008923,-2.6287878,6.8122573],[-4.4748921,-1.5336035,6.9010568],[-4.9101915,-1.5336035,5.8128085],[-3.6602814,-4.2610569,6.8319945],[-4.1558022,-3.2465746,6.7950749],[-3.9027376,-4.4507546,6.0815406],[-3.7232447,-4.2907972,6.8598542],[-4.2187657,-3.276315,6.8229346],[-3.9657006,-4.4804945,6.1094003],[-3.7548034,-4.2854285,6.8481035],[-4.2140226,-3.3451762,6.8139858],[-3.9794402,-4.461184,6.1528044]],"bolts":27},
|
||||
"Hull.FlankRoof.R": {"solid":[[2.8270271,0.85,7.4918909],[2.8270271,-1.3,7.4918909],[2.8,0.85,7.499999],[2.8,-1.3,7.499999],[2.9800003,0.85,6.8800001],[2.9800003,-1.3,6.8800001],[2.8,0.85,6.8800001],[2.8,-1.3,6.8800001]],"facets":6,"panels":[[2.9339185,0.7400001,6.9818645],[2.8343034,0.7400001,7.3803244],[2.8343034,-1.1899998,7.3803244],[2.9339185,-1.1899998,6.9818645],[3.0066793,0.7400001,7.0000548],[2.907064,0.7400001,7.3985143],[2.907064,-1.1899998,7.3985143],[3.0066793,-1.1899998,7.0000548],[3.0212314,0.7200001,7.0243082],[2.9313176,0.7200001,7.3839622],[2.9313176,-1.1699998,7.3839622],[3.0212314,-1.1699998,7.0243082]],"bolts":4},
|
||||
"Hull.FlankRoof.L": {"solid":[[-2.8270271,0.85,7.4918909],[-2.8270271,-1.3,7.4918909],[-2.8,0.85,7.499999],[-2.8,-1.3,7.499999],[-2.9800003,0.85,6.8800001],[-2.9800003,-1.3,6.8800001],[-2.8,0.85,6.8800001],[-2.8,-1.3,6.8800001]],"facets":6,"panels":[[-2.8343034,-1.1899998,7.3803244],[-2.8343034,0.7400001,7.3803244],[-2.9339185,0.7400001,6.9818645],[-2.9339185,-1.1899998,6.9818645],[-2.8779597,-1.1899998,7.3912382],[-2.8779597,0.7400001,7.3912382],[-2.9775751,0.7400001,6.9927788],[-2.9775751,-1.1899998,6.9927788],[-2.9022133,-1.1699998,7.3766861],[-2.9022133,0.7200001,7.3766861],[-2.9921272,0.7200001,7.0170321],[-2.9921272,-1.1699998,7.0170321]],"bolts":4},
|
||||
"Hull.FlankSill.R": {"solid":[[4.3656001,0.85,5.1199999],[4.3656001,-1.3,5.1199999],[4.3260002,0.85,5.4499998],[4.3260002,-1.3,5.4499998],[3.9000001,0.85,5.1199999],[3.9000001,-1.3,5.1199999],[3.9000001,0.85,5.4499998],[3.9000001,-1.3,5.4499998]],"facets":6,"panels":[],"bolts":0},
|
||||
"Hull.FlankSill.L": {"solid":[[-4.3656001,0.85,5.1199999],[-4.3656001,-1.3,5.1199999],[-4.3260002,0.85,5.4499998],[-4.3260002,-1.3,5.4499998],[-3.9000001,0.85,5.1199999],[-3.9000001,-1.3,5.1199999],[-3.9000001,0.85,5.4499998],[-3.9000001,-1.3,5.4499998]],"facets":6,"panels":[],"bolts":0},
|
||||
"Hull.Tail": {"solid":[[1.72,-2.75,7.5],[1.72,-5.0,7.3000002],[1.72,-2.75,7.1500001],[1.72,-5.0,7.0],[-1.72,-2.75,7.5],[-1.72,-5.0,7.3000002],[-1.72,-2.75,7.1500001],[-1.72,-5.0,7.0]],"facets":6,"panels":[[1.61,-4.8886614,7.2898178],[1.61,-2.8577971,7.4703388],[-0.0356075,-2.8577971,7.4703388],[-0.0356076,-4.8886614,7.2898178],[1.61,-4.8953018,7.3645234],[1.61,-2.8644376,7.5450439],[-0.0356075,-2.8644376,7.5450439],[-0.0356076,-4.8953018,7.3645234],[1.59,-4.877151,7.3862157],[1.59,-2.8861299,7.5631948],[-0.0156075,-2.8861299,7.5631948],[-0.0156076,-4.877151,7.3862157],[-0.3056076,-2.8577971,7.4703374],[-1.61,-2.8577971,7.4703374],[-1.61,-4.8886609,7.2898192],[-0.3056076,-4.8886609,7.2898192],[-0.3056076,-2.8617814,7.5151606],[-1.61,-2.8617814,7.5151606],[-1.61,-4.8926454,7.3346429],[-0.3056076,-4.8926454,7.3346429],[-0.3256076,-2.8834736,7.5333114],[-1.59,-2.8834736,7.5333114],[-1.59,-4.8744946,7.3563347],[-0.3256076,-4.8744946,7.3563347]],"bolts":8},
|
||||
"Hull.BellySide.R": {"solid":[[2.0999999,2.2,3.9000001],[2.0999999,-2.4000001,3.95],[2.45,2.0,4.0999999],[2.45,-2.2,4.1500001],[2.45,2.0,4.8499999],[2.45,-2.2,4.9000001],[2.25,2.2,5.0999999],[2.25,-2.4000001,5.1500001],[1.8,2.2,3.9000001],[1.8,-2.4000001,5.1500001]],"facets":15,"panels":[[2.4300001,-2.0900002,4.7886829],[2.4300001,-2.0900002,4.2586985],[2.4300001,-0.6636688,4.2417183],[2.4300001,-0.6573603,4.7716274],[2.5050001,-2.0900002,4.7886829],[2.5050001,-2.0900002,4.2586985],[2.5050001,-0.6636688,4.2417183],[2.5050001,-0.6573603,4.7716274],[2.5250001,-2.0700002,4.7684431],[2.5250001,-2.0700002,4.2784615],[2.5250001,-0.6834292,4.2619548],[2.5250001,-0.677597,4.7518668],[2.4300001,-0.3936881,4.2385039],[2.4300001,1.89,4.2113171],[2.4300001,1.89,4.7413015],[2.4300001,-0.3873795,4.7684135],[2.4750001,-0.3936881,4.2385039],[2.4750001,1.89,4.2113171],[2.4750001,1.89,4.7413015],[2.4750001,-0.3873795,4.7684135],[2.4950001,-0.3734515,4.2582645],[2.4950001,1.87,4.2315569],[2.4950001,1.87,4.7215385],[2.4950001,-0.367619,4.7481766],[2.2321301,1.8335732,5.0840106],[1.9212853,-2.2902241,5.1287899],[2.1400001,-2.2902241,5.1287899],[2.2321301,1.8343884,5.1590061],[1.9212853,-2.2894089,5.2037854],[2.1400001,-2.2894089,5.2037854],[2.2288792,1.7680224,5.179728],[1.9428494,-2.2691927,5.223567],[2.1204419,-2.2691927,5.223567]],"bolts":11},
|
||||
"Hull.BellySide.L": {"solid":[[-2.0999999,2.2,3.9000001],[-2.0999999,-2.4000001,3.95],[-2.45,2.0,4.0999999],[-2.45,-2.2,4.1500001],[-2.45,2.0,4.8499999],[-2.45,-2.2,4.9000001],[-2.25,2.2,5.0999999],[-2.25,-2.4000001,5.1500001],[-1.8,2.2,3.9000001],[-1.8,-2.4000001,5.1500001]],"facets":15,"panels":[[-2.4300001,-2.0900002,4.2586985],[-2.4300001,-2.0900002,4.7886829],[-2.4300001,0.1687398,4.7617931],[-2.4300001,0.1624316,4.2318835],[-2.5050001,-2.0900002,4.2586985],[-2.5050001,-2.0900002,4.7886829],[-2.5050001,0.1687398,4.7617931],[-2.5050001,0.1624316,4.2318835],[-2.5250001,-2.0700002,4.2784615],[-2.5250001,-2.0700002,4.7684431],[-2.5250001,0.1485032,4.7420325],[-2.5250001,0.1426711,4.2521205],[-2.4300001,0.4387209,4.7585793],[-2.4300001,1.89,4.7413015],[-2.4300001,1.89,4.2113171],[-2.4300001,0.4324124,4.2286692],[-2.4750001,0.4387209,4.7585793],[-2.4750001,1.89,4.7413015],[-2.4750001,1.89,4.2113171],[-2.4750001,0.4324124,4.2286692],[-2.4950001,0.4584814,4.7383423],[-2.4950001,1.87,4.7215385],[-2.4950001,1.87,4.2315569],[-2.4950001,0.4526491,4.2484298],[-2.2321301,1.8335732,5.0840106],[-2.1400001,-2.2902241,5.1287899],[-1.9212852,-2.2902241,5.1287899],[-2.2321301,1.8340623,5.1290078],[-2.1400001,-2.2897351,5.1737871],[-1.9212852,-2.2897351,5.1737871],[-2.2288792,1.7676963,5.1497297],[-2.1204419,-2.2695189,5.1935692],[-1.9428494,-2.2695189,5.1935692]],"bolts":11}
|
||||
}}
|
||||
],
|
||||
"repaired": {"how": {"script": "Blender 5.3 in the background at source.sha, with surfaces/blender/experiments/mechs on sys.path: import mechlib, massing, bastion_body, bastion_form. For a plate of bastion_form.PLATES built as key at side sx (1 for .R, -1 for .L): obj = massing.hard(key, pts, None, plate[\"mat\"], mirror=plate.get(\"mirror\", False), bevel=plate[\"bevel\"], sx=sx); g, bolts = mechlib.Geo(), mechlib.Geo(); clad(obj, g, keep=bastion_body.outward, seed=seed, bolts=bolts), seed the table's clad.seed for that side. solid is obj.data.vertices, facets len(obj.data.polygons), panels g.bm.verts, bolts len(bolts.bm.verts) // 12, coordinates rounded to 7 places.", "corner": "Hull.Quarter.R and .L: pts = massing.corners([bastion_body._face(f) for f in plate[\"faces\"]], tol=1e-5) where the branch calls it at its default, tol=1e-6 (the slack of its inside test, all(n.dot(p) <= d + tol ...)): the corner float32 lost is kept. clad is massing.clad.", "tie": "Hull.BellySide.R: pts = bastion_body._points(plate), and clad is massing.clad with two lines added after its line `k = max(range(len(pts)), key=lambda i: (pts[(i + 1) % len(pts)] - pts[i]).length)`: `tied = [i for i in range(len(pts)) if abs((pts[(i + 1) % len(pts)] - pts[i]).length - (pts[(k + 1) % len(pts)] - pts[k]).length) < 1e-5]` and `k = next((i for i in tied if i != k), k) if len(tied) == 2 else k`: the cut starts from the other of the split facet's two equally long edges."}, "truth": {
|
||||
"Hull.Quarter.R": {"solid":[[4.2910318,-2.9193861,6.8925695],[4.7526722,-3.0549133,5.7045879],[4.3936944,-1.4,7.0157642],[4.9976001,-1.4,5.506],[3.5958304,-4.3421259,6.9449539],[3.9363332,-4.6085348,5.8910241],[1.75,-4.8604336,7.409956],[1.75,-5.3931999,5.9851837],[2.5643883,-1.4,7.5279703],[1.75,-2.3254409,7.6634545],[2.5643883,-1.4,5.5060005],[1.75,-2.3254409,5.6170526]],"facets":8,"panels":[[2.6039631,-1.5075765,7.4852662],[1.8505968,-2.3636744,7.6105995],[1.8505968,-3.7839808,7.4685688],[3.7708514,-3.7307458,6.9362202],[4.181469,-2.8904121,6.9052806],[4.2749047,-1.5075765,7.0174022],[2.6160405,-1.5118898,7.5284004],[1.8626742,-2.3679876,7.6537333],[1.8626742,-3.7882941,7.5117025],[3.7829289,-3.7350593,6.9793544],[4.1935463,-2.8947253,6.9484148],[4.2869821,-1.5118899,7.0605364],[2.6295795,-1.5337148,7.543292],[1.8873084,-2.3772049,7.6667795],[1.8873082,-3.7697763,7.5275221],[3.7765129,-3.7174025,7.0037818],[4.1799693,-2.8917232,6.9733815],[4.2717276,-1.5337149,7.0834904],[1.8505965,-4.0526409,7.4417028],[1.8505965,-4.7160707,7.37536],[3.5181954,-4.2478104,6.9552579],[3.6377716,-4.0030956,6.9462481],[1.8707256,-4.0598297,7.5135922],[1.8707258,-4.7232594,7.4472499],[3.5383244,-4.2549992,7.0271478],[3.6579008,-4.0102844,7.0181379],[1.8953596,-4.0811133,7.5254316],[1.8953596,-4.6992774,7.4636159],[3.5305526,-4.2401166,7.0516772],[3.6317692,-4.0329757,7.0440507],[2.7647738,-4.5948009,7.0421376],[1.8471562,-4.8524671,7.273304],[1.8471562,-5.2996264,6.0774708],[2.8457143,-4.9412479,6.0344653],[2.7796867,-4.6345687,7.0570083],[1.862069,-4.8922348,7.2881742],[1.8620691,-5.3393941,6.0923409],[2.8606274,-4.9810157,6.049336],[2.7687323,-4.6642437,7.0491562],[1.8875668,-4.9116745,7.2711391],[1.8875669,-5.3432689,6.1169314],[2.8469315,-4.9989567,6.075614],[3.5113626,-4.385159,6.8540578],[3.0230417,-4.5222793,6.9770751],[3.0996346,-4.8501167,6.0235305],[3.7892847,-4.6026044,5.9938288],[3.5362175,-4.4514389,6.8788414],[3.0478966,-4.5885587,7.0018592],[3.1244895,-4.9163966,6.0483146],[3.8141394,-4.6688843,6.0186129],[3.5286927,-4.4801512,6.8701258],[3.0752041,-4.6074901,6.9843683],[3.1484115,-4.9208369,6.0729723],[3.7952363,-4.688694,6.0451155],[4.3817148,-1.9071758,6.8648353],[4.3201332,-2.8185694,6.7909379],[4.710516,-2.9331768,5.7863297],[4.8316121,-2.1149623,5.6881447],[4.4233174,-1.9113361,6.8814764],[4.3617358,-2.8227296,6.8075786],[4.7521186,-2.9373369,5.8029709],[4.8732147,-2.1191227,5.7047858],[4.4476438,-1.9368703,6.8683591],[4.3888788,-2.8065846,6.7978411],[4.7663054,-2.9173882,5.8265738],[4.8817496,-2.1373634,5.7329712],[4.9214897,-1.5076798,5.6152711],[4.4087076,-1.5076798,6.8972268],[4.400281,-1.6323925,6.887115],[4.8708658,-1.8497338,5.6563177],[4.9908276,-1.5146136,5.6430063],[4.478045,-1.5146136,6.924962],[4.4696183,-1.6393265,6.9148502],[4.9402032,-1.8566676,5.6840525],[4.9988408,-1.536377,5.6716146],[4.5026264,-1.5363771,6.9121504],[4.4966955,-1.6241521,6.9050336],[4.9545536,-1.8356153,5.7075229],[4.2655559,-3.0223532,6.786387],[3.6602807,-4.2610564,6.8319945],[3.9375505,-4.4779921,5.9737864],[4.6440229,-3.1334624,5.8124413],[4.3285189,-3.0520933,6.8142467],[3.723244,-4.2907968,6.8598547],[4.0005136,-4.5077324,6.001646],[4.706986,-3.1632028,5.840301],[4.34373,-3.0801873,6.8037205],[3.7548051,-4.28543,6.8480964],[4.0205779,-4.4933701,6.0254736],[4.7070746,-3.186857,5.868691]],"bolts":30},
|
||||
"Hull.Quarter.L": {"solid":[[-4.2910318,-2.9193861,6.8925695],[-4.7526722,-3.0549133,5.7045879],[-4.3936944,-1.4,7.0157642],[-4.9976001,-1.4,5.506],[-3.5958304,-4.3421259,6.9449539],[-3.9363332,-4.6085348,5.8910241],[-1.75,-4.8604336,7.409956],[-1.75,-5.3931999,5.9851837],[-2.5643883,-1.4,7.5279703],[-1.75,-2.3254409,7.6634545],[-2.5643883,-1.4,5.5060005],[-1.75,-2.3254409,5.6170526]],"facets":8,"panels":[[-1.8505965,-4.7160707,7.3753595],[-1.8505963,-4.0014849,7.4468179],[-3.6631114,-3.9512372,6.9443383],[-3.5181952,-4.2478104,6.9552579],[-1.8707256,-4.7232594,7.4472494],[-1.8707255,-4.0086741,7.5187078],[-3.6832407,-3.9584262,7.0162282],[-3.5383244,-4.2549992,7.0271473],[-1.8953596,-4.6992774,7.4636154],[-1.8953595,-4.0299578,7.5305471],[-3.6571088,-3.9811172,7.042141],[-3.5305526,-4.2401166,7.0516772],[-1.8505961,-3.7328248,7.4736838],[-1.8505962,-2.3636742,7.6105995],[-2.6039624,-1.5075763,7.4852662],[-4.2749043,-1.5075763,7.0174017],[-4.1814685,-2.8904119,6.9052796],[-3.7961907,-3.6788878,6.93431],[-1.8626735,-3.7371383,7.5168176],[-1.8626738,-2.3679876,7.6537333],[-2.61604,-1.5118898,7.5283999],[-4.2869816,-1.5118897,7.0605354],[-4.1935458,-2.8947253,6.9484134],[-3.8082683,-3.6832011,6.9774437],[-1.8873075,-3.7186203,7.5326371],[-1.8873078,-2.3772047,7.666779],[-2.6295791,-1.5337147,7.543292],[-4.2717271,-1.5337147,7.0834894],[-4.1799688,-2.8917229,6.9733806],[-3.8018522,-3.6655443,7.0018711],[-3.5113626,-4.385159,6.8540568],[-3.7892847,-4.6026049,5.9938283],[-2.8620911,-4.9353704,6.0337601],[-2.7814307,-4.5901232,7.0379415],[-3.5362175,-4.4514389,6.8788409],[-3.8141396,-4.6688843,6.0186124],[-2.8869457,-5.0016503,6.0585442],[-2.8062856,-4.6564031,7.0627251],[-3.5286927,-4.4801512,6.8701248],[-3.7952363,-4.6886945,6.0451145],[-2.9108679,-5.0060902,6.0832024],[-2.8335931,-4.6753345,7.0452342],[-2.6081707,-5.0265012,6.0446959],[-1.8471559,-5.2996264,6.0774708],[-1.8471559,-4.8524671,7.273304],[-2.5231626,-4.6626449,7.103004],[-2.6230836,-5.0662689,6.059566],[-1.8620688,-5.3393941,6.0923409],[-1.8620689,-4.8922348,7.2881746],[-2.5380757,-4.7024126,7.1178746],[-2.6093876,-5.0842099,6.0858445],[-1.8875666,-5.3432684,6.1169314],[-1.8875667,-4.9116745,7.2711396],[-2.5271213,-4.7320881,7.1100225],[-4.3919301,-1.7559885,6.8770943],[-4.4087081,-1.5076798,6.8972273],[-4.9214902,-1.5076798,5.615272],[-4.85321,-1.969032,5.6706338],[-4.4335327,-1.7601488,6.8937349],[-4.4503107,-1.5118401,6.9138684],[-4.9630928,-1.5118401,5.6319127],[-4.8948126,-1.9731923,5.6872749],[-4.4606104,-1.7449744,6.8839188],[-4.4748921,-1.5336035,6.9010572],[-4.9711065,-1.5336035,5.660521],[-4.909163,-1.95214,5.7107453],[-4.3201332,-2.8185692,6.7909379],[-4.373363,-2.0307715,6.8548145],[-4.8139558,-2.2342606,5.7024608],[-4.7105155,-2.9331768,5.7863297],[-4.3894706,-2.8255031,6.8186731],[-4.4427004,-2.0377054,6.8825493],[-4.8832932,-2.2411945,5.7301955],[-4.7798533,-2.9401107,5.814065],[-4.4166136,-2.8093579,6.8089352],[-4.4670272,-2.0632396,6.869432],[-4.8918281,-2.2594352,5.7583814],[-4.7940402,-2.920162,5.8376679],[-3.9375505,-4.4779921,5.9737859],[-3.6602805,-4.2610569,6.8319945],[-4.2655559,-3.0223532,6.7863865],[-4.6440229,-3.1334624,5.8124409],[-4.0005136,-4.5077324,6.0016456],[-3.7232437,-4.2907968,6.8598542],[-4.3285189,-3.0520935,6.8142462],[-4.706986,-3.1632028,5.8403006],[-4.0205779,-4.4933701,6.0254736],[-3.7548048,-4.28543,6.8480964],[-4.34373,-3.0801876,6.8037205],[-4.7070746,-3.1868572,5.8686905]],"bolts":30},
|
||||
"Hull.BellySide.R": {"solid":[[2.0999999,2.2,3.9000001],[2.0999999,-2.4000001,3.95],[2.45,2.0,4.0999999],[2.45,-2.2,4.1500001],[2.45,2.0,4.8499999],[2.45,-2.2,4.9000001],[2.25,2.2,5.0999999],[2.25,-2.4000001,5.1500001],[1.8,2.2,3.9000001],[1.8,-2.4000001,5.1500001]],"facets":15,"panels":[[2.4300001,0.4573603,4.2283726],[2.4300001,1.89,4.2113171],[2.4300001,1.89,4.7413015],[2.4300001,0.4636687,4.7582817],[2.5050001,0.4573603,4.2283726],[2.5050001,1.89,4.2113171],[2.5050001,1.89,4.7413015],[2.5050001,0.4636687,4.7582817],[2.5250001,0.4775969,4.2481332],[2.5250001,1.87,4.2315569],[2.5250001,1.87,4.7215385],[2.5250001,0.4834292,4.7380452],[2.4300001,-2.0900002,4.7886829],[2.4300001,-2.0900002,4.2586985],[2.4300001,0.1873795,4.2315865],[2.4300001,0.193688,4.7614961],[2.4750001,-2.0900002,4.7886829],[2.4750001,-2.0900002,4.2586985],[2.4750001,0.1873795,4.2315865],[2.4750001,0.193688,4.7614961],[2.4950001,-2.0700002,4.7684431],[2.4950001,-2.0700002,4.2784615],[2.4950001,0.167619,4.2518234],[2.4950001,0.1734514,4.7417355],[2.2321301,1.8335732,5.0840106],[1.9212853,-2.2902241,5.1287899],[2.1400001,-2.2902241,5.1287899],[2.2321301,1.8343884,5.1590061],[1.9212853,-2.2894089,5.2037854],[2.1400001,-2.2894089,5.2037854],[2.2288792,1.7680224,5.179728],[1.9428494,-2.2691927,5.223567],[2.1204419,-2.2691927,5.223567]],"bolts":11}
|
||||
}}}
|
||||
98
surfaces/blender/tests/fixtures/plates_paladin.json
vendored
Normal file
98
surfaces/blender/tests/fixtures/plates_paladin.json
vendored
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
{"source": {"branch": "nibu/fable-paladin-3", "sha": "c35e57ee5aa9c52e589623fcc8abb19b909f09d4", "blender": "5.3.0"},
|
||||
"table": {"schema": "brokkr.plates.v0", "plates": [
|
||||
{"name": "Thigh.core", "mat": "gunmetal", "bevel": 0.02, "sections": [[0.4, 0.9, -0.3, 0.5, 0.12], [0.05, 1.2, -0.34, 0.64, 0.18], [-1.45, 1.2, -0.34, 0.64, 0.18], [-1.8, 0.95, -0.3, 0.5, 0.14]]},
|
||||
{"name": "Thigh.Shield", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.02, 0.9, -0.5], "normal": [0.06, 1.0, 0.05], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": [[-0.42, 0.98], [0.42, 0.98], [0.66, 0.5], [0.66, -0.52], [0.42, -1.0], [-0.42, -1.0], [-0.66, -0.52], [-0.66, 0.5]], "thick": 0.26, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.05, 0.05], "inset": 0.075, "gap": 0.045, "split": 99.0, "seed": 948708}, "fits": [{"kind": "mark", "id": "tri", "at": [0.0, -0.05], "height": 0.5}]},
|
||||
{"name": "Thigh.Block", "mat": "olive_light", "bevel": 0.022, "slab": {"at": [0.02, 1.0, 0.12], "normal": [0.06, 1.0, 0.05], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.56, "h": 0.44, "clip": 0.08}, "thick": 0.16, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Thigh.Lame", "mat": "olive_light", "bevel": 0.022, "slab": {"at": [0.02, 0.985, -1.17], "normal": [0.06, 1.0, 0.02], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": [[-0.52, 0.2], [0.52, 0.2], [0.58, 0.0], [0.4, -0.26], [-0.4, -0.26], [-0.58, 0.0]], "thick": 0.14, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Thigh.Outer", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.86, 0.0, -0.45], "normal": [1.0, 0.08, 0.04], "up": [0.0, 0.0, 1.0], "right": [0.0, 1.0, 0.0], "outline": [[-0.5, 1.0], [0.36, 1.05], [0.68, 0.5], [0.68, -0.6], [0.3, -1.02], [-0.5, -0.86], [-0.74, -0.2], [-0.74, 0.5]], "thick": 0.24, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.04, 0.07], "inset": 0.075, "gap": 0.045, "split": 0.8, "seed": 976538}},
|
||||
{"name": "Thigh.OuterStep", "mat": "olive_light", "bevel": 0.022, "slab": {"at": [0.95, -0.02, -0.25], "normal": [1.0, 0.08, 0.04], "up": [0.0, 0.0, 1.0], "right": [0.0, 1.0, 0.0], "outline": {"w": 0.8, "h": 0.9, "clip": 0.2}, "thick": 0.13, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Thigh.Inner", "mat": "khaki", "bevel": 0.022, "slab": {"at": [-0.82, 0.05, -0.75], "normal": [-1.0, 0.1, 0.0], "up": [0.0, 0.0, 1.0], "right": [0.0, 1.0, 0.0], "outline": [[-0.55, 0.55], [0.5, 0.55], [0.62, 0.15], [0.5, -0.7], [-0.45, -0.7], [-0.62, -0.15]], "thick": 0.2, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.04, 0.07], "inset": 0.075, "gap": 0.045, "split": 0.8, "seed": 947561}},
|
||||
{"name": "Thigh.Rear", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.0, -0.98, -0.25], "normal": [0.0, -1.0, 0.05], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": [[-0.46, 0.72], [0.46, 0.72], [0.64, 0.3], [0.64, -0.4], [0.42, -0.72], [-0.42, -0.72], [-0.64, -0.4], [-0.64, 0.3]], "thick": 0.22, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.05, 0.05], "inset": 0.075, "gap": 0.045, "split": 99.0, "seed": 398253}},
|
||||
{"name": "Thigh.RearStep", "mat": "olive_light", "bevel": 0.022, "slab": {"at": [0.0, -1.06, -0.3], "normal": [0.0, -1.0, 0.05], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.7, "h": 0.5, "clip": 0.1}, "thick": 0.12, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Thigh.CornerOut", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.7, 0.7, -0.45], "normal": [0.72, 0.7, 0.04], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.3, "h": 1.5, "clip": 0.08}, "thick": 0.2, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Thigh.CornerIn", "mat": "khaki", "bevel": 0.022, "slab": {"at": [-0.67, 0.7, -0.6], "normal": [-0.72, 0.7, 0.03], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.26, "h": 1.1, "clip": 0.07}, "thick": 0.18, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Thigh.Cap", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.0, 0.12, 0.66], "normal": [0.0, 0.3, 1.0], "up": [0.0, 1.0, 0.0], "right": [1.0, 0.0, 0.0], "outline": [[-0.5, -0.5], [0.5, -0.5], [0.6, 0.1], [0.36, 0.44], [-0.36, 0.44], [-0.6, 0.1]], "thick": 0.18, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.05, 0.05], "inset": 0.075, "gap": 0.045, "split": 99.0, "seed": 387260}},
|
||||
{"name": "Shin.core", "mat": "gunmetal", "bevel": 0.02, "sections": [[-0.3, 0.9, -0.3, 0.5, 0.12], [-0.65, 1.14, -0.34, 0.6, 0.18], [-1.9, 1.06, -0.34, 0.56, 0.18], [-2.5, 0.8, -0.3, 0.4, 0.12]]},
|
||||
{"name": "Shin.Knee", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.0, 1.0, 0.02], "normal": [0.0, 1.0, 0.22], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": [[-0.4, 0.56], [0.4, 0.56], [0.62, 0.22], [0.62, -0.3], [0.42, -0.56], [-0.42, -0.56], [-0.62, -0.3], [-0.62, 0.22]], "thick": 0.28, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.05, 0.05], "inset": 0.075, "gap": 0.045, "split": 99.0, "seed": 995246}},
|
||||
{"name": "Shin.KneeSide", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.7, 0.72, 0.0], "normal": [0.75, 0.66, 0.1], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.34, "h": 0.9, "clip": 0.1}, "thick": 0.2, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Shin.KneeSideIn", "mat": "khaki", "bevel": 0.022, "slab": {"at": [-0.7, 0.72, 0.0], "normal": [-0.75, 0.66, 0.1], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.34, "h": 0.9, "clip": 0.1}, "thick": 0.2, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Shin.Greave", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.0, 0.88, -1.3], "normal": [0.0, 1.0, -0.07], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": [[-0.5, 0.72], [0.5, 0.72], [0.66, 0.4], [0.6, -0.5], [0.36, -0.95], [-0.36, -0.95], [-0.6, -0.5], [-0.66, 0.4]], "thick": 0.28, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.04, 0.07], "inset": 0.075, "gap": 0.045, "split": 0.8, "seed": 564123}},
|
||||
{"name": "Shin.GreaveStep", "mat": "olive_light", "bevel": 0.022, "slab": {"at": [0.0, 0.97, -1.2], "normal": [0.0, 1.0, -0.07], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.62, "h": 0.84, "clip": 0.12}, "thick": 0.15, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Shin.Outer", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.82, -0.2, -1.05], "normal": [1.0, 0.04, 0.0], "up": [0.0, 0.0, 1.0], "right": [0.0, 1.0, 0.0], "outline": [[-0.75, 0.62], [0.34, 0.74], [0.74, 0.36], [0.7, -0.55], [0.28, -0.96], [-0.6, -0.82], [-0.95, -0.1]], "thick": 0.26, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.04, 0.07], "inset": 0.075, "gap": 0.045, "split": 0.8, "seed": 733553}},
|
||||
{"name": "Shin.OuterStep", "mat": "olive_light", "bevel": 0.022, "slab": {"at": [0.92, -0.2, -1.0], "normal": [1.0, 0.04, 0.0], "up": [0.0, 0.0, 1.0], "right": [0.0, 1.0, 0.0], "outline": [[-0.42, 0.42], [0.2, 0.46], [0.46, 0.2], [0.44, -0.3], [0.16, -0.5], [-0.36, -0.44], [-0.56, -0.05]], "thick": 0.13, "taper": 0.04, "back": 1.0}, "fits": [{"kind": "mark", "id": "tri", "at": [-0.03, -0.02], "height": 0.4}]},
|
||||
{"name": "Shin.Inner", "mat": "khaki", "bevel": 0.022, "slab": {"at": [-0.78, -0.12, -1.1], "normal": [-1.0, 0.04, 0.0], "up": [0.0, 0.0, 1.0], "right": [0.0, 1.0, 0.0], "outline": [[-0.7, 0.55], [0.3, 0.66], [0.66, 0.3], [0.62, -0.5], [0.25, -0.86], [-0.55, -0.74], [-0.85, -0.1]], "thick": 0.22, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.05, 0.05], "inset": 0.075, "gap": 0.045, "split": 99.0, "seed": 299054}},
|
||||
{"name": "Shin.Calf", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.0, -1.12, -0.95], "normal": [0.0, -1.0, 0.1], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": [[-0.5, 0.62], [0.5, 0.62], [0.68, 0.1], [0.5, -0.62], [-0.5, -0.62], [-0.68, 0.1]], "thick": 0.22, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.05, 0.05], "inset": 0.075, "gap": 0.045, "split": 99.0, "seed": 800359}},
|
||||
{"name": "Shin.CalfStep", "mat": "olive_light", "bevel": 0.022, "slab": {"at": [0.0, -1.2, -1.05], "normal": [0.0, -1.0, 0.1], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.72, "h": 0.46, "clip": 0.1}, "thick": 0.12, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Shin.Ankle", "mat": "olive_light", "bevel": 0.022, "slab": {"at": [0.0, 0.66, -2.42], "normal": [0.0, 1.0, -0.2], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.8, "h": 0.52, "clip": 0.12}, "thick": 0.2, "taper": 0.04, "back": 1.0}, "clad": {"mat": "khaki", "min_area": 0.2, "lifts": [0.04, 0.07], "inset": 0.075, "gap": 0.045, "split": 0.8, "seed": 22775}},
|
||||
{"name": "Shin.AnkleSide", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.6, 0.1, -2.35], "normal": [1.0, 0.1, -0.1], "up": [0.0, 0.0, 1.0], "right": [0.0, 1.0, 0.0], "outline": {"w": 0.7, "h": 0.5, "clip": 0.12}, "thick": 0.16, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Pelvis.core", "mat": "gunmetal", "bevel": 0.02, "points": [[0.62, 0.62, 0.5], [0.62, -0.6, 0.5], [0.72, 0.7, -0.3], [0.72, -0.62, -0.3], [0.45, 0.7, 0.62], [0.45, -0.66, 0.62], [0.4, 0.55, -0.8], [0.4, -0.45, -0.8]], "mirror": true},
|
||||
{"name": "Pelvis.Crown", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.0, 1.0, 0.42], "normal": [0.0, 1.0, 0.16], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": [[-0.32, 0.3], [0.32, 0.3], [0.48, 0.04], [0.3, -0.3], [-0.3, -0.3], [-0.48, 0.04]], "thick": 0.3, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.05, 0.05], "inset": 0.075, "gap": 0.045, "split": 99.0, "seed": 345924}},
|
||||
{"name": "Pelvis.Cod", "mat": "khaki", "bevel": 0.022, "slab": {"at": [0.0, 1.06, -0.62], "normal": [0.0, 1.0, -0.1], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": [[-0.36, 0.7], [0.36, 0.7], [0.44, 0.3], [0.3, -0.78], [-0.3, -0.78], [-0.44, 0.3]], "thick": 0.34, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.04, 0.07], "inset": 0.075, "gap": 0.045, "split": 0.8, "seed": 876596}},
|
||||
{"name": "Pelvis.CodStep", "mat": "olive_light", "bevel": 0.022, "slab": {"at": [0.0, 1.17, -0.3], "normal": [0.0, 1.0, -0.1], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.5, "h": 0.42, "clip": 0.1}, "thick": 0.14, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Pelvis.CodLame", "mat": "olive_light", "bevel": 0.022, "slab": {"at": [0.0, 1.15, -1.02], "normal": [0.0, 1.0, -0.1], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.42, "h": 0.4, "clip": 0.08}, "thick": 0.13, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Pelvis.Wing", "mat": "khaki", "bevel": 0.022, "sides": "both", "slab": {"at": [0.92, 0.84, 0.5], "normal": [0.3, 1.0, 0.2], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": [[-0.46, -0.02], [0.44, 0.36], [0.54, 0.1], [0.44, -0.26], [-0.46, -0.36]], "thick": 0.22, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.04, 0.07], "inset": 0.075, "gap": 0.045, "split": 0.8, "seed": [876672, 589838]}},
|
||||
{"name": "Pelvis.HipGuard", "mat": "olive_light", "bevel": 0.022, "sides": "both", "slab": {"at": [0.62, 0.92, -0.05], "normal": [0.2, 1.0, -0.05], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.34, "h": 0.5, "clip": 0.08}, "thick": 0.16, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Pelvis.Seat", "mat": "khaki", "bevel": 0.022, "sides": "both", "slab": {"at": [0.56, -0.86, 0.02], "normal": [0.22, -1.0, 0.1], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": [[-0.5, 0.66], [0.5, 0.72], [0.6, -0.2], [0.2, -0.86], [-0.5, -0.6]], "thick": 0.24, "taper": 0.04, "back": 1.0}, "clad": {"mat": "olive_light", "min_area": 0.2, "lifts": [0.05, 0.05], "inset": 0.075, "gap": 0.045, "split": 99.0, "seed": [1004746, 453014]}},
|
||||
{"name": "Pelvis.SeatStep", "mat": "olive_light", "bevel": 0.022, "sides": "both", "slab": {"at": [0.6, -0.95, 0.1], "normal": [0.22, -1.0, 0.1], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.56, "h": 0.6, "clip": 0.12}, "thick": 0.12, "taper": 0.04, "back": 1.0}},
|
||||
{"name": "Pelvis.Tail", "mat": "olive_light", "bevel": 0.022, "slab": {"at": [0.0, -0.92, -0.2], "normal": [0.0, -1.0, -0.05], "up": [0.0, 0.0, 1.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.36, "h": 1.3, "clip": 0.1}, "thick": 0.22, "taper": 0.04, "back": 1.0}, "clad": {"mat": "khaki", "min_area": 0.2, "lifts": [0.04, 0.07], "inset": 0.075, "gap": 0.045, "split": 0.8, "seed": 995407}},
|
||||
{"name": "Pelvis.Roof", "mat": "khaki", "bevel": 0.022, "sides": "both", "slab": {"at": [0.62, 0.0, 0.7], "normal": [0.25, 0.0, 1.0], "up": [0.0, 1.0, 0.0], "right": [1.0, 0.0, 0.0], "outline": {"w": 0.6, "h": 1.1, "clip": 0.14}, "thick": 0.14, "taper": 0.04, "back": 1.0}}
|
||||
]},
|
||||
"cases": [
|
||||
{"side": 1, "truth": {
|
||||
"Thigh.core": {"solid":[[-0.33,-0.3,0.4],[0.33,-0.3,0.4],[0.45,-0.18,0.4],[0.45,0.38,0.4],[0.33,0.5,0.4],[-0.33,0.5,0.4],[-0.45,0.38,0.4],[-0.45,-0.18,0.4],[-0.42,-0.34,0.05],[0.42,-0.34,0.05],[0.6,-0.16,0.05],[0.6,0.46,0.05],[0.42,0.64,0.05],[-0.42,0.64,0.05],[-0.6,0.46,0.05],[-0.6,-0.16,0.05],[-0.42,-0.34,-1.45],[0.42,-0.34,-1.45],[0.6,-0.16,-1.45],[0.6,0.46,-1.45],[0.42,0.64,-1.45],[-0.42,0.64,-1.45],[-0.6,0.46,-1.45],[-0.6,-0.16,-1.45],[-0.335,-0.3,-1.8],[0.335,-0.3,-1.8],[0.475,-0.16,-1.8],[0.475,0.36,-1.8],[0.335,0.5,-1.8],[-0.335,0.5,-1.8],[-0.475,0.36,-1.8],[-0.475,-0.16,-1.8]],"facets":26,"panels":[],"bolts":0},
|
||||
"Thigh.Shield": {"solid":[[-0.6003516,0.9127237,-0.0100526],[-0.5973628,0.9625379,-1.0099225],[-0.371703,0.9714425,-1.4588065],[0.4174352,0.9240942,-1.4588065],[0.6404113,0.8882715,-1.0099225],[0.6374224,0.8384573,-0.0100526],[0.4117627,0.8295527,0.4388314],[-0.3773755,0.8769009,0.4388314],[-0.6427007,0.874771,-0.0026155],[-0.6396555,0.9255249,-1.0213474],[-0.3986532,0.9350349,-1.5007508],[0.4398389,0.8847254,-1.5007508],[0.677975,0.8464671,-1.0213474],[0.6749298,0.7957132,-0.0026155],[0.4339275,0.7862031,0.4767878],[-0.4045646,0.8365127,0.4767878],[-0.6558607,0.6554389,-0.0135821],[-0.6528155,0.7061929,-1.0323141],[-0.4118131,0.7157029,-1.5117174],[0.426679,0.6653934,-1.5117174],[0.6648151,0.627135,-1.0323141],[0.6617699,0.5763811,-0.0135821],[0.4207676,0.566871,0.4658212],[-0.4177245,0.6171806,0.4658212]],"facets":18,"panels":[[0.5642967,0.8719431,-0.9932363],[0.3697456,0.9031991,-1.3848965],[-0.3268539,0.9449951,-1.3848965],[-0.5237467,0.9372256,-0.9932363],[-0.5266297,0.8891734,-0.0287326],[-0.3320786,0.8579174,0.3629277],[0.3645209,0.8161214,0.3629277],[0.5614136,0.8238909,-0.0287325],[0.5672876,0.9217913,-0.9907439],[0.3727365,0.9530473,-1.3824042],[-0.323863,0.9948433,-1.3824042],[-0.5207558,0.9870738,-0.9907439],[-0.5236388,0.9390216,-0.0262402],[-0.3290877,0.9077656,0.3654201],[0.3675118,0.8659696,0.3654201],[0.5644045,0.8737391,-0.0262401],[0.5485058,0.9426935,-0.9850315],[0.3615346,0.9727318,-1.3614321],[-0.3103879,1.0130471,-1.3614321],[-0.4996094,1.0055803,-0.9850315],[-0.5024643,0.957998,-0.0299587],[-0.3154931,0.9279597,0.346442],[0.3564294,0.8876444,0.346442],[0.5456509,0.8951111,-0.0299587]],"bolts":8},
|
||||
"Thigh.Block": {"solid":[[-0.2199377,1.0082324,0.243278],[-0.2192007,1.0205159,-0.003278],[-0.1625648,1.0199426,-0.0597762],[0.2036396,0.9979704,-0.0597762],[0.2599377,0.9917676,-0.003278],[0.2592007,0.9794841,0.243278],[0.2025648,0.9800573,0.2997762],[-0.1636396,1.0020295,0.2997762],[-0.262308,0.9699251,0.257832],[-0.2614721,0.9838576,-0.0218199],[-0.1813769,0.9830468,-0.1017204],[0.2179051,0.9590899,-0.1017204],[0.2975226,0.9503179,-0.0218199],[0.2966867,0.9363854,0.257832],[0.2165914,0.9371961,0.3377326],[-0.1826905,0.9611531,0.3377326],[-0.2694862,0.8502895,0.2518502],[-0.2686502,0.8642219,-0.0278017],[-0.188555,0.8634112,-0.1077022],[0.2107269,0.8394543,-0.1077022],[0.2903445,0.8306822,-0.0278017],[0.2895085,0.8167497,0.2518502],[0.2094133,0.8175604,0.3317508],[-0.1898686,0.8415174,0.3317508]],"facets":18,"panels":[],"bolts":0},
|
||||
"Thigh.Lame": {"solid":[[-0.5152019,1.0169734,-1.1630588],[-0.3580984,1.0120851,-1.3899561],[0.3986245,0.9666817,-1.3899561],[0.5551853,0.9527501,-1.1630588],[0.5091674,0.9524506,-1.0100318],[-0.46955,1.0111736,-1.0100318],[-0.561354,0.9798173,-1.1707984],[-0.3813663,0.9742171,-1.4307466],[0.4171976,0.9263031,-1.4307466],[0.5965636,0.9103422,-1.1707984],[0.5364322,0.909951,-0.9708382],[-0.5017008,0.972239,-0.9708382],[-0.5673421,0.8800166,-1.1727943],[-0.3873544,0.8744164,-1.4327425],[0.4112095,0.8265026,-1.4327425],[0.5905755,0.8105416,-1.1727943],[0.5304441,0.8101503,-0.9728342],[-0.5076889,0.8724384,-0.9728342]],"facets":14,"panels":[],"bolts":0},
|
||||
"Thigh.Outer": {"solid":[[0.8963261,-0.6993303,0.0405074],[0.9234846,-0.6971576,-0.6427998],[0.9302595,-0.4659773,-1.2745335],[0.8760005,0.2877677,-1.4255476],[0.8321795,0.6398191,-1.0341262],[0.7895345,0.6364074,0.0388219],[0.7930059,0.3335055,0.55784],[0.859628,-0.475686,0.5106725],[0.8593135,-0.7424191,0.0480094],[0.8871133,-0.7401951,-0.6514348],[0.8941858,-0.4988625,-1.3109107],[0.8367438,0.299098,-1.4707837],[0.7897608,0.6765533,-1.0511172],[0.7460753,0.6730585,0.0480094],[0.749751,0.3523302,0.5975726],[0.8203176,-0.504772,0.5476124],[0.6601087,-0.7583555,0.0400412],[0.6879086,-0.7561315,-0.659403],[0.694981,-0.5147989,-1.3188789],[0.6375391,0.2831616,-1.4787519],[0.590556,0.6606169,-1.0590854],[0.5468705,0.6571221,0.0400412],[0.5505463,0.3363939,0.5896044],[0.6211129,-0.5207084,0.5396442]],"facets":18,"panels":[[0.9001193,-0.6237868,-0.7074043],[0.8970585,-0.6240321,-0.6303937],[0.9032756,-0.4118871,-1.2101107],[0.8549845,0.2589536,-1.3445147],[0.8170925,0.5633724,-1.0060527],[0.8052226,0.5624229,-0.7074043],[0.969841,-0.6182091,-0.7046154],[0.9667802,-0.6184544,-0.6276049],[0.9729972,-0.4063094,-1.2073218],[0.9247062,0.2645313,-1.3417259],[0.8868142,0.5689502,-1.0032638],[0.8749442,0.5680006,-0.7046154],[0.9921507,-0.6364881,-0.7238027],[0.9850156,-0.6285996,-0.5612047],[0.9910342,-0.3898667,-1.1891332],[0.9443345,0.2588662,-1.3191079],[0.9080236,0.5505831,-0.9947683],[0.8972539,0.5497215,-0.7238027],[0.8711027,-0.6261086,0.0226564],[0.8923752,-0.6244068,-0.5125591],[0.7974783,0.5618034,-0.5125591],[0.7763985,0.560117,0.0178105],[0.7794868,0.2906393,0.4795566],[0.8387128,-0.4287195,0.4376253],[0.9109437,-0.6229213,0.02425],[0.9322161,-0.6212195,-0.5109655],[0.8373193,0.5649906,-0.5109655],[0.8162394,0.5633042,0.0194041],[0.8193278,0.2938266,0.4811502],[0.8785537,-0.4255322,0.439219],[0.92945,-0.601377,0.020499],[0.9497474,-0.5997531,-0.4901845],[0.8580404,0.5465844,-0.4901845],[0.8379691,0.5449787,0.0148104],[0.8409553,0.2844143,0.4612839],[0.898209,-0.4109892,0.420749]],"bolts":12},
|
||||
"Thigh.OuterStep": {"solid":[[0.9694378,-0.3795951,-0.0167539],[0.9879788,-0.3781119,-0.4832461],[0.9809105,-0.2015447,-0.6596745],[0.951655,0.1641499,-0.6596745],[0.9305622,0.3395951,-0.4832461],[0.9120212,0.3381118,-0.0167539],[0.9190895,0.1615447,0.1596745],[0.948345,-0.2041499,0.1596745],[0.9321286,-0.4227076,-0.0017921],[0.9519857,-0.4211191,-0.5013952],[0.9439794,-0.2211206,-0.7012363],[0.9120813,0.1776055,-0.7012363],[0.8881895,0.3763331,-0.5013952],[0.8683324,0.3747445,-0.0017921],[0.8763387,0.1747461,0.1980491],[0.9082368,-0.22398,0.1980491],[0.8424864,-0.429879,-0.0053778],[0.8623435,-0.4282905,-0.5049809],[0.8543373,-0.228292,-0.704822],[0.8224391,0.1704341,-0.704822],[0.7985473,0.3691617,-0.5049809],[0.7786903,0.3675731,-0.0053778],[0.7866965,0.1675747,0.1944634],[0.8185946,-0.2311514,0.1944634]],"facets":18,"panels":[],"bolts":0},
|
||||
"Thigh.Inner": {"solid":[[-0.8776518,-0.5265174,-0.8959235],[-0.861841,-0.3684096,-1.41],[-0.7737058,0.5129414,-1.41],[-0.7623708,0.6262924,-0.603093],[-0.7732095,0.5179051,-0.24],[-0.871125,-0.4612505,-0.24],[-0.8418908,-0.5709032,-0.9],[-0.8249752,-0.4017468,-1.45],[-0.7304466,0.5435384,-1.45],[-0.7185062,0.6629429,-0.6],[-0.7304466,0.5435384,-0.2],[-0.8349255,-0.5012506,-0.2],[-0.6826848,-0.5868238,-0.9],[-0.6657692,-0.4176674,-1.45],[-0.5712407,0.5276178,-1.45],[-0.5593002,0.6470223,-0.6],[-0.5712407,0.5276178,-0.2],[-0.6757196,-0.5171711,-0.2]],"facets":14,"panels":[[-0.850175,-0.4527469,-0.88828],[-0.8444706,-0.3957034,-0.315],[-0.8004089,0.0449137,-0.3149999],[-0.8004089,0.0449137,-1.3349999],[-0.8364358,-0.3153551,-1.3349999],[-0.9198276,-0.4457816,-0.88828],[-0.9141232,-0.3887382,-0.315],[-0.8700615,0.051879,-0.3149999],[-0.8700615,0.051879,-1.3349999],[-0.9060884,-0.3083898,-1.3349999],[-0.9377081,-0.4235888,-0.8862417],[-0.932223,-0.3687381,-0.335],[-0.8919523,0.0339683,-0.3349999],[-0.8919523,0.0339683,-1.3149999],[-0.9245213,-0.2917212,-1.3149999],[-0.7810057,0.238946,-0.315],[-0.7588613,0.4603896,-0.315],[-0.7500883,0.5481198,-0.6088924],[-0.7602883,0.4461192,-1.335],[-0.7810056,0.238946,-1.335],[-0.8208072,0.2429261,-0.315],[-0.7986628,0.4643697,-0.315],[-0.7898898,0.5521,-0.6088925],[-0.8000898,0.4500993,-1.335],[-0.8208071,0.2429261,-1.335],[-0.8387178,0.2648169,-0.335],[-0.8200442,0.451553,-0.335],[-0.8118221,0.5337747,-0.610439],[-0.8217194,0.4348008,-1.3150001],[-0.8387178,0.2648169,-1.3150001]],"bolts":10},
|
||||
"Thigh.Rear": {"solid":[[-0.6,-0.9654287,0.0414257],[-0.6,-0.9993547,-0.6370928],[-0.3989588,-1.0139576,-0.9291516],[0.3989588,-1.0139576,-0.9291516],[0.6,-0.9993547,-0.6370928],[0.6,-0.9654287,0.0414257],[0.4336241,-0.9460424,0.4291516],[-0.4336241,-0.9460424,0.4291516],[-0.64,-0.9250687,0.0476282],[-0.64,-0.960025,-0.6514985],[-0.42,-0.976005,-0.9710993],[0.42,-0.976005,-0.9710993],[0.64,-0.960025,-0.6514985],[0.64,-0.9250687,0.0476282],[0.46,-0.9040949,0.4671042],[-0.46,-0.9040949,0.4671042],[-0.64,-0.7452933,0.0386394],[-0.64,-0.7802496,-0.6604872],[-0.42,-0.7962296,-0.980088],[0.42,-0.7962296,-0.980088],[0.64,-0.7802496,-0.6604872],[0.64,-0.7452933,0.0386394],[0.46,-0.7243195,0.4581155],[-0.46,-0.7243195,0.4581155]],"facets":18,"panels":[[0.525,-0.9462224,0.0250518],[0.3841694,-0.9298127,0.3532465],[-0.3841694,-0.9298127,0.3532465],[-0.525,-0.9462224,0.0250518],[-0.525,-0.9782164,-0.6148264],[-0.3595065,-0.9902372,-0.8552439],[0.3595065,-0.9902372,-0.8552439],[0.525,-0.9782164,-0.6148264],[0.525,-0.99616,0.0275487],[0.3841694,-0.9797503,0.3557433],[-0.3841694,-0.9797503,0.3557433],[-0.525,-0.99616,0.0275487],[-0.525,-1.028154,-0.6123295],[-0.3595065,-1.0401748,-0.8527471],[0.3595065,-1.0401748,-0.8527471],[0.525,-1.028154,-0.6123295],[0.505,-1.0163401,0.0244474],[0.3709815,-1.0007241,0.3367671],[-0.3709815,-1.0007241,0.3367671],[-0.505,-1.0163401,0.0244474],[-0.505,-1.0478188,-0.6051267],[-0.3489859,-1.0591512,-0.8317733],[0.3489859,-1.0591512,-0.8317733],[0.505,-1.0478188,-0.6051267]],"bolts":8},
|
||||
"Thigh.RearStep": {"solid":[[-0.31,-1.0533367,-0.166735],[-0.31,-1.0666631,-0.433265],[-0.2334315,-1.0704868,-0.509738],[0.2334315,-1.0704868,-0.509738],[0.31,-1.0666631,-0.433265],[0.31,-1.0533367,-0.166735],[0.2334315,-1.0495131,-0.090262],[-0.2334315,-1.0495131,-0.090262],[-0.35,-1.0125592,-0.1521847],[-0.35,-1.0275404,-0.4518104],[-0.25,-1.0325342,-0.5516856],[0.25,-1.0325342,-0.5516856],[0.35,-1.0275404,-0.4518104],[0.35,-1.0125592,-0.1521847],[0.25,-1.0075654,-0.0523094],[-0.25,-1.0075654,-0.0523094],[-0.35,-0.932659,-0.1561797],[-0.35,-0.9476403,-0.4558054],[-0.25,-0.9526341,-0.5556806],[0.25,-0.9526341,-0.5556806],[0.35,-0.9476403,-0.4558054],[0.35,-0.932659,-0.1561797],[0.25,-0.9276652,-0.0563044],[-0.25,-0.9276652,-0.0563044]],"facets":18,"panels":[],"bolts":0},
|
||||
"Thigh.CornerOut": {"solid":[[0.6046741,0.7607402,0.2029137],[0.6419686,0.7969987,-1.1029136],[0.6830156,0.7580089,-1.1594374],[0.7575075,0.6813887,-1.1594374],[0.7953259,0.6392598,-1.1029136],[0.7580314,0.6030012,0.2029137],[0.7169843,0.6419911,0.2594374],[0.6424925,0.7186113,0.2594374],[0.5476611,0.7610992,0.217877],[0.5859013,0.7982771,-1.1210611],[0.6439505,0.7431371,-1.2009977],[0.7415414,0.6427579,-1.2009977],[0.7950248,0.5831786,-1.1210611],[0.7567846,0.5460007,0.217877],[0.6987353,0.6011407,0.2978136],[0.6011444,0.70152,0.2978136],[0.4330328,0.6496551,0.2115088],[0.471273,0.686833,-1.1274294],[0.5293223,0.631693,-1.207366],[0.6269132,0.5313138,-1.207366],[0.6803964,0.4717345,-1.1274294],[0.6421562,0.4345566,0.2115088],[0.584107,0.4896966,0.2914454],[0.4865161,0.5900759,0.2914454]],"facets":18,"panels":[],"bolts":0},
|
||||
"Thigh.CornerIn": {"solid":[[-0.7228147,0.6258237,-0.1367753],[-0.7426594,0.6451172,-1.0632248],[-0.7111945,0.6794759,-1.1097726],[-0.6506443,0.7417562,-1.1097726],[-0.6171853,0.7741762,-1.0632248],[-0.5973406,0.7548828,-0.1367753],[-0.6288055,0.7205241,-0.0902275],[-0.6893557,0.6582438,-0.0902275],[-0.7216761,0.5689284,-0.1214086],[-0.7422302,0.5889115,-1.0809804],[-0.6949335,0.6405582,-1.1509492],[-0.6112841,0.7265977,-1.1509492],[-0.5609899,0.7753302,-1.0809804],[-0.5404358,0.755347,-0.1214086],[-0.5877325,0.7037003,-0.0514398],[-0.6713819,0.6176609,-0.0514398],[-0.6213416,0.4713809,-0.1255892],[-0.6418957,0.4913641,-1.085161],[-0.594599,0.5430108,-1.1551298],[-0.5109496,0.6290503,-1.1551298],[-0.4606554,0.6777828,-1.085161],[-0.4401013,0.6577996,-0.1255892],[-0.487398,0.6061529,-0.0556204],[-0.5710474,0.5201135,-0.0556204]],"facets":18,"panels":[],"bolts":0},
|
||||
"Thigh.Cap": {"solid":[[-0.4661148,-0.3206001,0.7921801],[0.4661148,-0.3206001,0.7921801],[0.5578418,0.2065509,0.6340348],[0.3392738,0.5031305,0.5450609],[-0.3392738,0.5031305,0.5450609],[-0.5578418,0.2065509,0.6340348],[-0.4999999,-0.370407,0.765361],[0.4999999,-0.370407,0.765361],[0.6,0.2042887,0.5929522],[0.36,0.5299496,0.4952539],[-0.36,0.5299496,0.4952539],[-0.6,0.2042887,0.5929522],[-0.4999999,-0.4106357,0.6312653],[0.4999999,-0.4106357,0.6312653],[0.6,0.16406,0.4588565],[0.36,0.4897209,0.3611582],[-0.36,0.4897209,0.3611582],[-0.6,0.16406,0.4588565]],"facets":14,"panels":[[0.3004121,0.4255465,0.5474553],[-0.3004121,0.4255465,0.5474553],[-0.4787954,0.1834945,0.620071],[-0.4025803,-0.25451,0.7514725],[0.4025803,-0.25451,0.7514725],[0.4787954,0.1834945,0.620071],[0.3004121,0.4399139,0.5953466],[-0.3004121,0.4399139,0.5953466],[-0.4787954,0.1978619,0.6679623],[-0.4025803,-0.2401427,0.7993639],[0.4025803,-0.2401427,0.7993639],[0.4787954,0.1978619,0.6679623],[0.2900489,0.4265044,0.6202502],[-0.2900489,0.4265044,0.6202502],[-0.4577163,0.198993,0.6885036],[-0.3856378,-0.2152392,0.8127734],[0.3856378,-0.2152392,0.8127734],[0.4577163,0.198993,0.6885036]],"bolts":6},
|
||||
"Shin.core": {"solid":[[-0.33,-0.3,-0.3],[0.33,-0.3,-0.3],[0.45,-0.18,-0.3],[0.45,0.38,-0.3],[0.33,0.5,-0.3],[-0.33,0.5,-0.3],[-0.45,0.38,-0.3],[-0.45,-0.18,-0.3],[-0.39,-0.34,-0.65],[0.39,-0.34,-0.65],[0.57,-0.16,-0.65],[0.57,0.42,-0.65],[0.39,0.6,-0.65],[-0.39,0.6,-0.65],[-0.57,0.42,-0.65],[-0.57,-0.16,-0.65],[-0.35,-0.34,-1.9],[0.35,-0.34,-1.9],[0.53,-0.16,-1.9],[0.53,0.38,-1.9],[0.35,0.56,-1.9],[-0.35,0.56,-1.9],[-0.53,0.38,-1.9],[-0.53,-0.16,-1.9],[-0.28,-0.3,-2.5],[0.28,-0.3,-2.5],[0.4,-0.18,-2.5],[0.4,0.28,-2.5],[0.28,0.4,-2.5],[-0.28,0.4,-2.5],[-0.4,0.28,-2.5],[-0.4,-0.18,-2.5]],"facets":26,"panels":[],"bolts":0},
|
||||
"Shin.Knee": {"solid":[[-0.58,0.9552685,0.2233251],[-0.58,1.0615354,-0.2597062],[-0.4003039,1.1117281,-0.4878551],[0.4003039,1.1117281,-0.4878551],[0.58,1.0615354,-0.2597062],[0.58,0.9552685,0.2233251],[0.3782389,0.8882719,0.5278551],[-0.3782389,0.8882719,0.5278551],[-0.62,0.9136646,0.2262673],[-0.62,1.0253928,-0.2815878],[-0.42,1.0812569,-0.5355154],[0.42,1.0812569,-0.5355154],[0.62,1.0253928,-0.2815878],[0.62,0.9136646,0.2262673],[0.4,0.8406116,0.5583265],[-0.4,0.8406116,0.5583265],[-0.62,0.67927,0.1747005],[-0.62,0.790998,-0.3331546],[-0.42,0.8468621,-0.5870823],[0.42,0.8468621,-0.5870823],[0.62,0.790998,-0.3331546],[0.62,0.67927,0.1747005],[0.4,0.606217,0.5067596],[-0.4,0.606217,0.5067596]],"facets":18,"panels":[[0.3633738,1.0760806,-0.418904],[-0.3633738,1.0760806,-0.418904],[-0.505,1.0365214,-0.2390901],[-0.505,0.9404944,0.1973966],[-0.3374369,0.8848536,0.4503096],[0.3374369,0.8848536,0.4503096],[0.505,0.9404944,0.1973966],[0.505,1.0365214,-0.2390901],[0.3633738,1.1249127,-0.408161],[-0.3633738,1.1249127,-0.408161],[-0.505,1.0853537,-0.228347],[-0.505,0.9893267,0.2081397],[-0.3374369,0.9336858,0.4610527],[0.3374369,0.9336858,0.4610527],[0.505,0.9893267,0.2081397],[0.505,1.0853537,-0.228347],[0.3535258,1.1401484,-0.3843308],[-0.3535258,1.1401484,-0.3843308],[-0.485,1.103425,-0.2174062],[-0.485,1.0101286,0.2066686],[-0.3265564,0.957516,0.445817],[0.3265564,0.957516,0.445817],[0.485,1.0101286,0.2066686],[0.485,1.103425,-0.2174062]],"bolts":8},
|
||||
"Shin.KneeSide": {"solid":[[0.589188,0.7956541,0.3317735],[0.6390487,0.8395315,-0.3317735],[0.695357,0.7870885,-0.4079614],[0.7659536,0.706865,-0.4079614],[0.810812,0.644346,-0.3317735],[0.7609513,0.6004685,0.3317735],[0.704643,0.6529116,0.4079614],[0.6340464,0.733135,0.4079614],[0.5316448,0.7982987,0.3442758],[0.5839832,0.8443565,-0.3522436],[0.6575229,0.7758648,-0.4517464],[0.7500108,0.6707649,-0.4517464],[0.8085967,0.5891139,-0.3522436],[0.7562584,0.5430561,0.3442758],[0.6827186,0.6115477,0.4437786],[0.5902307,0.7166476,0.4437786],[0.4121279,0.6931238,0.3283402],[0.4644662,0.7391816,-0.3681792],[0.5380059,0.6706899,-0.467682],[0.6304939,0.56559,-0.467682],[0.6890798,0.483939,-0.3681792],[0.6367414,0.4378812,0.3283402],[0.5632017,0.5063728,0.427843],[0.4707137,0.6114727,0.427843]],"facets":18,"panels":[],"bolts":0},
|
||||
"Shin.KneeSideIn": {"solid":[[-0.7609513,0.6004685,0.3317735],[-0.810812,0.644346,-0.3317735],[-0.7659536,0.706865,-0.4079614],[-0.695357,0.7870885,-0.4079614],[-0.6390487,0.8395315,-0.3317735],[-0.589188,0.7956541,0.3317735],[-0.6340464,0.733135,0.4079614],[-0.704643,0.6529116,0.4079614],[-0.7562584,0.5430561,0.3442758],[-0.8085967,0.5891139,-0.3522436],[-0.7500108,0.6707649,-0.4517464],[-0.6575229,0.7758648,-0.4517464],[-0.5839832,0.8443565,-0.3522436],[-0.5316448,0.7982987,0.3442758],[-0.5902307,0.7166476,0.4437786],[-0.6827186,0.6115477,0.4437786],[-0.6367414,0.4378812,0.3283402],[-0.6890798,0.483939,-0.3681792],[-0.6304939,0.56559,-0.467682],[-0.5380059,0.6706899,-0.467682],[-0.4644662,0.7391816,-0.3681792],[-0.4121279,0.6931238,0.3283402],[-0.4707137,0.6114727,0.427843],[-0.5632017,0.5063728,0.427843]],"facets":18,"panels":[],"bolts":0},
|
||||
"Shin.Greave": {"solid":[[-0.6193662,0.9073608,-0.9091315],[-0.5606605,0.8458702,-1.7875686],[-0.336,0.8164555,-2.2077785],[0.336,0.8164555,-2.2077785],[0.5606605,0.8458702,-1.7875686],[0.6193662,0.9073608,-0.9091315],[0.4752786,0.9274838,-0.6216599],[-0.4752786,0.9274838,-0.6216599],[-0.66,0.8680293,-0.8981832],[-0.6,0.8051831,-1.7959863],[-0.36,0.77376,-2.2448878],[0.36,0.77376,-2.2448878],[0.6,0.8051831,-1.7959863],[0.66,0.8680293,-0.8981832],[0.5,0.8903747,-0.5789643],[-0.5,0.8903747,-0.5789643],[-0.66,0.6286151,-0.8814242],[-0.6,0.565769,-1.7792274],[-0.36,0.5343457,-2.2281287],[0.36,0.5343457,-2.2281287],[0.6,0.565769,-1.7792274],[0.66,0.6286151,-0.8814242],[0.5,0.6509604,-0.5622053],[-0.5,0.6509604,-0.5622053]],"facets":18,"panels":[[-0.1732338,0.8017416,-2.1315651],[-0.291,0.8017416,-2.1315651],[-0.4868988,0.8273906,-1.7651516],[-0.5431778,0.8863394,-0.9230259],[-0.4289261,0.9022955,-0.6950803],[-0.1732337,0.9022955,-0.6950803],[-0.1732338,0.8416439,-2.1343582],[-0.291,0.8416439,-2.1343582],[-0.4868988,0.8672929,-1.7679448],[-0.5431778,0.9262417,-0.9258191],[-0.4289261,0.9421979,-0.6978735],[-0.1732337,0.9421979,-0.6978735],[-0.1932338,0.8629917,-2.1158037],[-0.279,0.8629917,-2.1158037],[-0.467229,0.8876365,-1.7637359],[-0.5228609,0.9459075,-0.9312932],[-0.4165654,0.9607525,-0.7192212],[-0.1932337,0.9607525,-0.7192212],[0.4868988,0.8273906,-1.7651516],[0.291,0.8017416,-2.1315651],[0.0217662,0.8017416,-2.1315651],[0.0217663,0.9022955,-0.6950803],[0.4289261,0.9022955,-0.6950803],[0.5431778,0.8863394,-0.9230259],[0.4868988,0.8972197,-1.7700397],[0.291,0.8715707,-2.1364532],[0.0217662,0.8715707,-2.1364532],[0.0217663,0.9721246,-0.6999683],[0.4289261,0.9721247,-0.6999683],[0.5431778,0.9561685,-0.927914],[0.467229,0.9175633,-1.7658308],[0.279,0.8929185,-2.1178985],[0.0417663,0.8929185,-2.1178985],[0.0417663,0.9906793,-0.721316],[0.4165654,0.9906793,-0.721316],[0.5228609,0.9758343,-0.9333881]],"bolts":12},
|
||||
"Shin.GreaveStep": {"solid":[[-0.27,0.9897918,-0.9172604],[-0.27,0.9502082,-1.4827397],[-0.1734315,0.9434649,-1.5790725],[0.1734315,0.9434649,-1.5790725],[0.27,0.9502082,-1.4827397],[0.27,0.9897918,-0.9172604],[0.1734315,0.9965351,-0.8209276],[-0.1734315,0.9965351,-0.8209276],[-0.31,0.9510465,-0.8979391],[-0.31,0.9091489,-1.4964746],[-0.19,0.9007695,-1.6161816],[0.19,0.9007695,-1.6161816],[0.31,0.9091489,-1.4964746],[0.31,0.9510465,-0.8979391],[0.19,0.9594259,-0.7782321],[-0.19,0.9594259,-0.7782321],[-0.31,0.8413149,-0.890258],[-0.31,0.7994174,-1.4887935],[-0.19,0.7910379,-1.6085005],[0.19,0.7910379,-1.6085005],[0.31,0.7994174,-1.4887935],[0.31,0.8413149,-0.890258],[0.19,0.8496944,-0.7705509],[-0.19,0.8496944,-0.7705509]],"facets":18,"panels":[],"bolts":0},
|
||||
"Shin.Outer": {"solid":[[0.8562673,-1.1066836,-1.1461235],[0.8429071,-0.7726778,-1.8337708],[0.809351,0.0662256,-1.9673394],[0.7935917,0.4602057,-1.5824323],[0.7920528,0.4986797,-0.7064488],[0.8069738,0.1256552,-0.3517922],[0.8487253,-0.9181325,-0.4667965],[0.8180016,-1.1508397,-1.15],[0.8040128,-0.8011193,-1.8699999],[0.7688409,0.0781775,-2.01],[0.7520543,0.497842,-1.5999999],[0.7504556,0.53781,-0.6899999],[0.7664428,0.1381296,-0.3099999],[0.810008,-0.9509994,-0.4299999],[0.5981774,-1.1596327,-1.15],[0.5841886,-0.8099123,-1.8699999],[0.5490167,0.0693846,-2.01],[0.5322301,0.489049,-1.5999999],[0.5306314,0.529017,-0.6899999],[0.5466186,0.1293367,-0.3099999],[0.5901837,-0.9597924,-0.4299999]],"facets":16,"panels":[[0.7751235,0.4215133,-0.7372904],[0.7880453,0.0984686,-0.4301527],[0.8063356,-0.3587885,-0.4805332],[0.8003194,-0.2083839,-1.8478006],[0.7903833,0.0400187,-1.8873508],[0.7765504,0.3858406,-1.5494928],[0.8150916,0.423112,-0.7372904],[0.8280134,0.1000673,-0.4301527],[0.8463036,-0.3571897,-0.4805332],[0.8402874,-0.2067852,-1.8478006],[0.8303514,0.0416175,-1.8873509],[0.8165184,0.3874393,-1.549493],[0.8358902,0.4035468,-0.7455149],[0.8482788,0.0938301,-0.4510488],[0.8654056,-0.3343395,-0.4982244],[0.8595436,-0.1877901,-1.8304462],[0.8506064,0.0356415,-1.8660206],[0.8372872,0.3686212,-1.5407091],[0.8140826,-0.5524625,-0.5018721],[0.8263962,-0.8603038,-0.53579],[0.8330916,-1.027688,-1.1388552],[0.82091,-0.7231468,-1.765841],[0.8083001,-0.4078998,-1.8160341],[0.8840266,-0.5496647,-0.5018721],[0.8963403,-0.857506,-0.53579],[0.9030357,-1.0248903,-1.1388552],[0.890854,-0.7203491,-1.7658411],[0.8782442,-0.405102,-1.8160342],[0.9047178,-0.5665425,-0.5239406],[0.9156989,-0.8410726,-0.5541883],[0.9221686,-1.0028123,-1.136917],[0.9103012,-0.7061283,-1.7477266],[0.8991374,-0.4270333,-1.7921635]],"bolts":11},
|
||||
"Shin.OuterStep": {"solid":[[0.9406667,-0.7166683,-1.0460328],[0.933356,-0.5339003,-1.4027153],[0.9140334,-0.0508353,-1.4584981],[0.9039803,0.2004944,-1.2788334],[0.9032401,0.218997,-0.8159006],[0.9126254,-0.0156337,-0.5810822],[0.9355723,-0.5893077,-0.6181231],[0.9024141,-0.7611513,-1.05],[0.8944205,-0.5613111,-1.4400001],[0.8736371,-0.0417266,-1.5],[0.8624461,0.2380497,-1.3],[0.8616467,0.2580338,-0.8],[0.8720384,-0.0017585,-0.54],[0.8968186,-0.6212631,-0.58],[0.812486,-0.7647484,-1.05],[0.8044924,-0.5649082,-1.4400001],[0.783709,-0.0453237,-1.5],[0.772518,0.2344526,-1.3],[0.7717186,0.2544366,-0.8],[0.7821103,-0.0053556,-0.54],[0.8068905,-0.6248603,-0.58]],"facets":16,"panels":[],"bolts":0},
|
||||
"Shin.Inner": {"solid":[[-0.8122908,-0.9272723,-1.1955323],[-0.8008983,-0.6424584,-1.8036211],[-0.7705547,0.1161316,-1.9175006],[-0.7567852,0.4603711,-1.582297],[-0.7552532,0.4986687,-0.815732],[-0.7685975,0.1650628,-0.4818593],[-0.806675,-0.7868745,-0.5866562],[-0.7740048,-0.9709196,-1.2],[-0.7620144,-0.6711593,-1.84],[-0.73004,0.1282015,-1.96],[-0.7152518,0.4979059,-1.6],[-0.713653,0.537874,-0.8],[-0.7280415,0.1781616,-0.44],[-0.7680096,-0.8210394,-0.55],[-0.5941486,-0.9781139,-1.2],[-0.5821582,-0.6783535,-1.84],[-0.5501838,0.1210073,-1.96],[-0.5353956,0.4907117,-1.6],[-0.5337968,0.5306797,-0.8],[-0.5481853,0.1709673,-0.44],[-0.5881534,-0.8282337,-0.55]],"facets":16,"panels":[[-0.7397362,0.3861963,-1.549104],[-0.7515959,0.0897034,-1.8378143],[-0.7788817,-0.5924411,-1.7354107],[-0.7891533,-0.8492304,-1.1871556],[-0.7842486,-0.7266124,-0.6553865],[-0.7497159,0.1367056,-0.5603455],[-0.7383296,0.421362,-0.8452296],[-0.7896963,0.3881947,-1.5491039],[-0.801556,0.0917018,-1.8378142],[-0.8288417,-0.5904427,-1.7354107],[-0.8391134,-0.847232,-1.1871556],[-0.8342086,-0.724614,-0.6553865],[-0.7996759,0.138704,-0.5603455],[-0.7882897,0.4233604,-0.8452296],[-0.810463,0.3694274,-1.5402523],[-0.8218134,0.0856668,-1.8165646],[-0.8482838,-0.5760922,-1.7172213],[-0.8582564,-0.8254083,-1.1849217],[-0.8535413,-0.7075315,-0.6737146],[-0.8199539,0.1321546,-0.5812752],[-0.8090897,0.4037578,-0.8530955]],"bolts":7},
|
||||
"Shin.Calf": {"solid":[[-0.6383086,-1.1102328,-0.8523283],[-0.468769,-1.1777122,-1.5271215],[0.468769,-1.1777122,-1.5271215],[0.6383086,-1.1102328,-0.8523283],[0.4715175,-1.0622878,-0.3728784],[-0.4715175,-1.0622878,-0.3728784],[-0.68,-1.0702481,-0.8544765],[-0.5,-1.1418909,-1.5709033],[0.5,-1.1418909,-1.5709033],[0.68,-1.0702481,-0.8544765],[0.5,-1.0185062,-0.3370571],[-0.5,-1.0185062,-0.3370571],[-0.68,-0.8911414,-0.8723871],[-0.5,-0.9627842,-1.5888139],[0.5,-0.9627842,-1.5888139],[0.68,-0.8911414,-0.8723871],[0.5,-0.8393995,-0.3549677],[-0.5,-0.8393995,-0.3549677]],"facets":14,"panels":[[-0.4102107,-1.1503487,-1.4544837],[0.4102107,-1.1503487,-1.4544837],[0.5601374,-1.0906755,-0.8577533],[0.4181128,-1.0498497,-0.4494962],[-0.4181128,-1.0498497,-0.4494962],[-0.5601374,-1.0906755,-0.8577534],[-0.4102107,-1.2001004,-1.4495087],[0.4102107,-1.2001004,-1.4495087],[0.5601374,-1.1404274,-0.8527782],[0.4181128,-1.0996016,-0.444521],[-0.4181128,-1.0996016,-0.444521],[-0.5601374,-1.1404274,-0.8527782],[-0.3945952,-1.2180111,-1.4276178],[0.3945952,-1.2180111,-1.4276178],[0.5392917,-1.1604197,-0.8517041],[0.4038715,-1.1214925,-0.4624317],[-0.4038715,-1.1214925,-0.4624317],[-0.5392917,-1.1604197,-0.8517041]],"bolts":6},
|
||||
"Shin.CalfStep": {"solid":[[-0.32,-1.1887132,-0.9371314],[-0.32,-1.2112869,-1.1628685],[-0.2434314,-1.2189058,-1.2390571],[0.2434314,-1.2189058,-1.2390571],[0.32,-1.2112869,-1.1628685],[0.32,-1.1887132,-0.9371314],[0.2434314,-1.1810943,-0.8609428],[-0.2434314,-1.1810943,-0.8609428],[-0.36,-1.1472631,-0.9246253],[-0.36,-1.1731341,-1.1833349],[-0.26,-1.1830844,-1.2828387],[0.26,-1.1830844,-1.2828387],[0.36,-1.1731341,-1.1833349],[0.36,-1.1472631,-0.9246253],[0.26,-1.1373128,-0.8251215],[-0.26,-1.1373128,-0.8251215],[-0.36,-1.0676601,-0.9325855],[-0.36,-1.0935311,-1.1912953],[-0.26,-1.1034814,-1.290799],[0.26,-1.1034814,-1.290799],[0.36,-1.0935311,-1.1912953],[0.36,-1.0676601,-0.9325855],[0.26,-1.0577098,-0.8330818],[-0.26,-1.0577098,-0.8330818]],"facets":18,"panels":[],"bolts":0},
|
||||
"Shin.Ankle": {"solid":[[-0.36,0.6842069,-2.2989655],[-0.36,0.6357931,-2.5410347],[-0.2634315,0.6168545,-2.6357279],[0.2634315,0.6168545,-2.6357279],[0.36,0.6357931,-2.5410347],[0.36,0.6842069,-2.2989655],[0.2634315,0.7031456,-2.2042723],[-0.2634315,0.7031456,-2.2042723],[-0.4000001,0.6482331,-2.274874],[-0.4000001,0.5933205,-2.5494368],[-0.28,0.5697865,-2.6671064],[0.28,0.5697865,-2.6671064],[0.4000001,0.5933205,-2.5494368],[0.4000001,0.6482331,-2.274874],[0.28,0.671767,-2.1572044],[-0.28,0.671767,-2.1572044],[-0.4000001,0.4913402,-2.2434955],[-0.4000001,0.4364276,-2.5180583],[-0.28,0.4128937,-2.6357279],[0.28,0.4128937,-2.6357279],[0.4000001,0.4364276,-2.5180583],[0.4000001,0.4913402,-2.2434955],[0.28,0.5148741,-2.1258259],[-0.28,0.5148741,-2.1258259]],"facets":18,"panels":[[-0.285,0.6222742,-2.5066495],[-0.285,0.6585029,-2.3255057],[-0.2323655,0.6688253,-2.2738934],[0.2323655,0.6688253,-2.2738934],[0.2850001,0.6585029,-2.3255057],[0.285,0.6222742,-2.5066495],[0.2323654,0.6119516,-2.5582621],[-0.2323654,0.6119516,-2.5582621],[-0.285,0.6909148,-2.5203776],[-0.285,0.7271435,-2.3392339],[-0.2323655,0.737466,-2.2876215],[0.2323655,0.737466,-2.2876215],[0.2850001,0.7271435,-2.3392339],[0.285,0.6909148,-2.5203776],[0.2323654,0.6805923,-2.5719903],[-0.2323654,0.6805923,-2.5719903],[-0.265,0.7121511,-2.5161765],[-0.265,0.7451305,-2.3512797],[-0.2240812,0.7531553,-2.3111556],[0.2240812,0.7531553,-2.3111556],[0.265,0.7451305,-2.3512797],[0.265,0.7121511,-2.5161765],[0.2240812,0.7041262,-2.5563009],[-0.2240812,0.7041262,-2.5563009]],"bolts":8},
|
||||
"Shin.AnkleSide": {"solid":[[0.6420218,-0.207344,-2.2371259],[0.6196706,-0.2095791,-2.4628739],[0.6005474,-0.1144412,-2.5589681],[0.5580729,0.3103032,-2.5589681],[0.5579782,0.407344,-2.4628739],[0.5803295,0.4095791,-2.2371259],[0.5994527,0.3144412,-2.1410317],[0.6419272,-0.1103032,-2.1410317],[0.6080284,-0.2509428,-2.2166781],[0.5824124,-0.2535044,-2.4754004],[0.5586491,-0.1352822,-2.5948107],[0.5128774,0.3224349,-2.5948107],[0.5127598,0.4430216,-2.4754004],[0.5383759,0.4455832,-2.2166781],[0.5621391,0.327361,-2.0972679],[0.6079108,-0.130356,-2.0972679],[0.4892107,-0.2628246,-2.2047963],[0.4635947,-0.2653862,-2.4635186],[0.4398314,-0.147164,-2.5829289],[0.3940597,0.3105531,-2.5829289],[0.3939421,0.4311398,-2.4635186],[0.4195582,0.4337015,-2.2047963],[0.4433214,0.3154793,-2.085386],[0.4890931,-0.1422378,-2.085386]],"facets":18,"panels":[],"bolts":0},
|
||||
"Pelvis.core": {"solid":[[0.62,0.62,0.5],[0.62,-0.6,0.5],[0.72,0.7,-0.3],[0.72,-0.62,-0.3],[0.45,0.7,0.62],[0.45,-0.66,0.62],[0.4,0.55,-0.8],[0.4,-0.45,-0.8],[-0.62,0.62,0.5],[-0.62,-0.6,0.5],[-0.72,0.7,-0.3],[-0.72,-0.62,-0.3],[-0.45,0.7,0.62],[-0.45,-0.66,0.62],[-0.4,0.55,-0.8],[-0.4,-0.45,-0.8]],"facets":16,"panels":[],"bolts":0},
|
||||
"Pelvis.Crown": {"solid":[[-0.4339507,0.993916,0.4580249],[-0.2759168,1.0410775,0.1632654],[0.2759168,1.0410775,0.1632654],[0.4339507,0.993916,0.4580249],[0.2976482,0.9589224,0.6767346],[-0.2976482,0.9589224,0.6767346],[-0.48,0.9541827,0.453178],[-0.3,1.0078995,0.1174481],[0.3,1.0078995,0.1174481],[0.48,0.9541827,0.453178],[0.32,0.9131052,0.7099125],[-0.32,0.9131052,0.7099125],[-0.48,0.6974481,0.4121005],[-0.3,0.7511649,0.0763706],[0.3,0.7511649,0.0763706],[0.48,0.6974481,0.4121005],[0.32,0.6563706,0.668835],[-0.32,0.6563706,0.668835]],"facets":14,"panels":[[0.2307606,1.0094794,0.2341636],[-0.2307606,1.0094794,0.2341636],[-0.3476081,0.9746091,0.4521036],[-0.2557386,0.951023,0.5995167],[0.2557386,0.951023,0.5995167],[0.3476081,0.9746091,0.4521036],[0.2307606,1.0588515,0.2420631],[-0.2307606,1.0588515,0.2420631],[-0.3476081,1.0239811,0.4600031],[-0.2557386,1.0003949,0.6074162],[0.2557386,1.0003949,0.6074162],[0.3476081,1.0239811,0.4600031],[0.218719,1.0754405,0.2649717],[-0.218719,1.0754405,0.2649717],[-0.3245834,1.0438477,0.4624265],[-0.2445627,1.0233036,0.5908272],[0.2445627,1.0233036,0.5908272],[0.3245834,1.0438477,0.4624265]],"bolts":6},
|
||||
"Pelvis.Cod": {"solid":[[-0.3994854,1.089713,-0.3228698],[-0.2648505,0.9863672,-1.3563275],[0.2648505,0.9863672,-1.3563275],[0.3994854,1.089713,-0.3228698],[0.3272079,1.1256723,0.0367246],[-0.3272079,1.1256723,0.0367246],[-0.44,1.0500495,-0.3175087],[-0.3,0.9425856,-1.3921489],[0.3,0.9425856,-1.3921489],[0.44,1.0500495,-0.3175087],[0.36,1.089851,0.0805062],[-0.36,1.089851,0.0805062],[-0.44,0.7515384,-0.2876576],[-0.3,0.6440744,-1.3622978],[0.3,0.6440744,-1.3622978],[0.44,0.7515384,-0.2876576],[0.36,0.7913399,0.1103573],[-0.36,0.7913399,0.1103573]],"facets":14,"panels":[[0.3235205,1.0695533,-0.323469],[0.2698343,1.0283437,-0.7355647],[-0.2790578,1.0354236,-0.6647651],[-0.3235206,1.0695533,-0.323469],[-0.2657226,1.0983088,-0.0359131],[0.2657225,1.0983088,-0.0359132],[0.3235206,1.1093547,-0.3274492],[0.2698343,1.0681452,-0.7395448],[-0.2790578,1.0752251,-0.6687453],[-0.3235206,1.1093547,-0.3274492],[-0.2657226,1.1381103,-0.0398933],[0.2657225,1.1381103,-0.0398933],[0.3032633,1.1291864,-0.3301297],[0.2525714,1.0902753,-0.719241],[-0.2612047,1.0969024,-0.6529709],[-0.3032633,1.1291864,-0.3301297],[-0.2493265,1.156021,-0.0617841],[0.2493265,1.156021,-0.0617842],[0.2447663,1.0091016,-0.927987],[0.1989452,0.9739293,-1.2797097],[-0.1989452,0.9739293,-1.2797097],[-0.2531329,1.0155238,-0.8637649],[0.2447663,1.0787542,-0.9349523],[0.1989452,1.043582,-1.2866749],[-0.1989452,1.043582,-1.2866749],[-0.2531329,1.0851763,-0.8707301],[0.2223611,1.0969372,-0.9541196],[0.1813705,1.0654727,-1.2687643],[-0.1813705,1.0654727,-1.2687643],[-0.2299619,1.1027715,-0.8957762]],"bolts":10},
|
||||
"Pelvis.CodStep": {"solid":[[-0.21,1.1792967,-0.2070322],[-0.21,1.1607032,-0.3929678],[-0.1334315,1.1530843,-0.4691563],[0.1334315,1.1530843,-0.4691563],[0.21,1.1607032,-0.3929678],[0.21,1.1792967,-0.2070322],[0.1334315,1.1869156,-0.1308437],[-0.1334315,1.1869156,-0.1308437],[-0.25,1.1411439,-0.1865658],[-0.25,1.119253,-0.4054739],[-0.15,1.1093026,-0.5049777],[0.15,1.1093026,-0.5049777],[0.25,1.119253,-0.4054739],[0.25,1.1411439,-0.1865658],[0.15,1.1510943,-0.087062],[-0.15,1.1510943,-0.087062],[-0.25,1.0416402,-0.1766154],[-0.25,1.0197493,-0.3955236],[-0.15,1.0097989,-0.4950273],[0.15,1.0097989,-0.4950273],[0.25,1.0197493,-0.3955236],[0.25,1.0416402,-0.1766154],[0.15,1.0515906,-0.0771117],[-0.15,1.0515906,-0.0771117]],"facets":18,"panels":[],"bolts":0},
|
||||
"Pelvis.CodLame": {"solid":[[-0.17,1.1602918,-0.9170818],[-0.17,1.1397082,-1.1229181],[-0.1134315,1.1340793,-1.1792059],[0.1134315,1.1340793,-1.1792059],[0.17,1.1397082,-1.1229181],[0.17,1.1602918,-0.9170818],[0.1134315,1.1659206,-0.860794],[-0.1134315,1.1659206,-0.860794],[-0.21,1.122139,-0.8966154],[-0.21,1.098258,-1.1354243],[-0.13,1.0902977,-1.2150273],[0.13,1.0902977,-1.2150273],[0.21,1.098258,-1.1354243],[0.21,1.122139,-0.8966154],[0.13,1.1300993,-0.8170124],[-0.13,1.1300993,-0.8170124],[-0.21,1.0325856,-0.8876601],[-0.21,1.0087047,-1.1264689],[-0.13,1.0007443,-1.206072],[0.13,1.0007443,-1.206072],[0.21,1.0087047,-1.1264689],[0.21,1.0325856,-0.8876601],[0.13,1.0405459,-0.8080571],[-0.13,1.0405459,-0.8080571]],"facets":18,"panels":[],"bolts":0},
|
||||
"Pelvis.Wing.R": {"solid":[[0.5347595,1.0175078,0.1903216],[1.323531,0.7627897,0.2807549],[1.3916267,0.679267,0.5962243],[1.3032885,0.6646943,0.8015956],[0.5202285,0.9690713,0.4543006],[0.4875739,0.9994265,0.1389033],[1.3442112,0.7227925,0.2371175],[1.4205314,0.6291823,0.5906884],[1.3106923,0.6110626,0.8460452],[0.4691925,0.9381554,0.4728314],[0.436775,0.8300968,0.1050373],[1.2934123,0.5534627,0.2032515],[1.3697325,0.4598526,0.5568224],[1.2598934,0.4417329,0.8121792],[0.4183936,0.7688256,0.4389654]],"facets":12,"panels":[[1.3106201,0.6838076,0.5887305],[1.2579452,0.7484159,0.3447013],[0.5964219,0.9620417,0.2688571],[0.5891105,0.9376703,0.4016816],[1.2625957,0.6758852,0.7003791],[1.3303752,0.7496581,0.6019005],[1.2777003,0.8142664,0.3578714],[0.616177,1.0278922,0.2820272],[0.6088656,1.0035207,0.4148517],[1.2823509,0.7417357,0.7135491],[1.3159229,0.7747005,0.6046685],[1.2673602,0.834265,0.3796901],[0.6397699,1.0369328,0.3077363],[0.6343836,1.0189787,0.4055862],[1.2786489,0.7685515,0.6913244]],"bolts":5},
|
||||
"Pelvis.Wing.L": {"solid":[[-0.5347595,1.0175078,0.1903216],[-1.323531,0.7627897,0.2807549],[-1.3916267,0.679267,0.5962243],[-1.3032885,0.6646943,0.8015956],[-0.5202285,0.9690713,0.4543006],[-0.4875739,0.9994265,0.1389033],[-1.3442112,0.7227925,0.2371175],[-1.4205314,0.6291823,0.5906884],[-1.3106923,0.6110626,0.8460452],[-0.4691925,0.9381554,0.4728314],[-0.436775,0.8300968,0.1050373],[-1.2934123,0.5534627,0.2032515],[-1.3697325,0.4598526,0.5568224],[-1.2598934,0.4417329,0.8121792],[-0.4183936,0.7688256,0.4389654]],"facets":12,"panels":[[-1.2625957,0.6758852,0.700379],[-0.5891104,0.9376704,0.4016816],[-0.5964218,0.9620418,0.2688571],[-1.2579452,0.7484159,0.3447012],[-1.3106201,0.6838076,0.5887305],[-1.2823508,0.7417357,0.7135491],[-0.6088656,1.0035208,0.4148517],[-0.616177,1.0278922,0.2820272],[-1.2777003,0.8142664,0.3578713],[-1.3303752,0.7496581,0.6019005],[-1.2786489,0.7685515,0.6913244],[-0.6343836,1.0189787,0.4055862],[-0.6397698,1.0369328,0.3077363],[-1.2673602,0.834265,0.37969],[-1.315923,0.7747005,0.6046684]],"bolts":5},
|
||||
"Pelvis.HipGuard.R": {"solid":[[0.4939981,0.9528628,0.1032474],[0.491051,0.9381275,-0.2032474],[0.5459777,0.9243171,-0.2597481],[0.6899887,0.8955149,-0.2597481],[0.746002,0.8871372,-0.2032474],[0.7489491,0.9018726,0.1032474],[0.6940223,0.915683,0.1597481],[0.5500113,0.9444851,0.1597481],[0.4470987,0.9223269,0.1217549],[0.4438334,0.9060003,-0.2178373],[0.5215116,0.8864695,-0.2977413],[0.6980162,0.8511686,-0.2977413],[0.7772309,0.8393208,-0.2178373],[0.7804962,0.8556474,0.1217549],[0.702818,0.8751782,0.2016589],[0.5263134,0.9104791,0.2016589],[0.423593,0.8047984,0.1276313],[0.4203277,0.7884718,-0.2119608],[0.4980058,0.768941,-0.2918648],[0.6745104,0.7336401,-0.2918648],[0.7537252,0.7217923,-0.2119608],[0.7569904,0.7381189,0.1276313],[0.6793123,0.7576497,0.2075353],[0.5028077,0.7929506,0.2075353]],"facets":18,"panels":[],"bolts":0},
|
||||
"Pelvis.HipGuard.L": {"solid":[[-0.4939981,0.9528628,0.1032474],[-0.491051,0.9381275,-0.2032474],[-0.5459777,0.9243171,-0.2597481],[-0.6899887,0.8955149,-0.2597481],[-0.746002,0.8871372,-0.2032474],[-0.7489491,0.9018726,0.1032474],[-0.6940223,0.915683,0.1597481],[-0.5500113,0.9444851,0.1597481],[-0.4470987,0.9223269,0.1217549],[-0.4438334,0.9060003,-0.2178373],[-0.5215116,0.8864695,-0.2977413],[-0.6980162,0.8511686,-0.2977413],[-0.7772309,0.8393208,-0.2178373],[-0.7804962,0.8556474,0.1217549],[-0.702818,0.8751782,0.2016589],[-0.5263134,0.9104791,0.2016589],[-0.423593,0.8047984,0.1276313],[-0.4203277,0.7884718,-0.2119608],[-0.4980058,0.768941,-0.2918648],[-0.6745104,0.7336401,-0.2918648],[-0.7537252,0.7217923,-0.2119608],[-0.7569904,0.7381189,0.1276313],[-0.6793123,0.7576497,0.2075353],[-0.5028077,0.7929506,0.2075353]],"facets":18,"panels":[],"bolts":0},
|
||||
"Pelvis.Seat.R": {"solid":[[0.1226936,-1.0131552,-0.5494777],[0.7555954,-0.897684,-0.7871495],[1.1097059,-0.7580597,-0.1699502],[0.9993517,-0.6958846,0.6945797],[0.0977462,-0.8997577,0.6393812],[0.075655,-0.9855092,-0.5810469],[0.7647362,-0.8597882,-0.8398157],[1.14161,-0.7111885,-0.182941],[1.0247313,-0.6453375,0.7327026],[0.0493399,-0.8658952,0.6729866],[0.0328861,-0.7911053,-0.6004874],[0.7219673,-0.6653842,-0.8592561],[1.0988411,-0.5167845,-0.2023814],[0.9819624,-0.4509336,0.7132621],[0.006571,-0.6714912,0.6535462]],"facets":12,"panels":[[1.0295707,-0.7536014,-0.1548266],[0.9314498,-0.6983188,0.6138653],[0.1681929,-0.8709082,0.5671368],[0.190576,-0.9726495,-0.4995194],[0.7181413,-0.8763967,-0.6976346],[1.0402629,-0.8022023,-0.1499665],[0.9421421,-0.7469198,0.6187254],[0.1788851,-0.9195092,0.5719969],[0.2012682,-1.0212505,-0.4946593],[0.7288335,-0.9249977,-0.6927745],[1.0243109,-0.825638,-0.1434711],[0.9294523,-0.7721934,0.5996639],[0.2030882,-0.9364405,0.5551941],[0.2247875,-1.0350735,-0.4788747],[0.7242631,-0.9439455,-0.6664414]],"bolts":5},
|
||||
"Pelvis.Seat.L": {"solid":[[-0.1226936,-1.0131552,-0.5494777],[-0.7555954,-0.897684,-0.7871495],[-1.1097059,-0.7580597,-0.1699502],[-0.9993517,-0.6958846,0.6945797],[-0.0977462,-0.8997577,0.6393812],[-0.075655,-0.9855092,-0.5810469],[-0.7647362,-0.8597882,-0.8398157],[-1.14161,-0.7111885,-0.182941],[-1.0247313,-0.6453375,0.7327026],[-0.0493399,-0.8658952,0.6729866],[-0.0328861,-0.7911053,-0.6004874],[-0.7219673,-0.6653842,-0.8592561],[-1.0988411,-0.5167845,-0.2023814],[-0.9819624,-0.4509336,0.7132621],[-0.006571,-0.6714912,0.6535462]],"facets":12,"panels":[[-1.0295707,-0.7536014,-0.1548266],[-0.7181413,-0.8763967,-0.6976346],[-0.190576,-0.9726496,-0.4995195],[-0.1681929,-0.8709082,0.5671368],[-0.9314499,-0.6983188,0.6138653],[-1.0402629,-0.8022023,-0.1499665],[-0.7288336,-0.9249976,-0.6927745],[-0.2012682,-1.0212506,-0.4946594],[-0.1788851,-0.9195092,0.5719969],[-0.9421421,-0.7469198,0.6187254],[-1.0243108,-0.825638,-0.1434711],[-0.7242632,-0.9439455,-0.6664413],[-0.2247876,-1.0350735,-0.4788747],[-0.2030883,-0.9364405,0.5551941],[-0.9294524,-0.7721934,0.5996639]],"bolts":5},
|
||||
"Pelvis.SeatStep.R": {"solid":[[0.3621921,-0.9860519,0.2626576],[0.3690186,-1.0170816,-0.0626576],[0.4653486,-1.0055002,-0.1587689],[0.7455117,-0.9438643,-0.1587689],[0.837808,-0.913948,-0.0626576],[0.8309814,-0.8829183,0.2626576],[0.7346514,-0.8944998,0.3587689],[0.4544884,-0.9561356,0.3587689],[0.3142265,-0.9541928,0.2752596],[0.3217451,-0.9883682,-0.0830357],[0.4414486,-0.9739767,-0.2024675],[0.7539749,-0.9052209,-0.2024675],[0.8686661,-0.8680456,-0.0830357],[0.8611474,-0.8338702,0.2752596],[0.7414439,-0.8482618,0.3946913],[0.4289176,-0.9170176,0.3946913],[0.2971189,-0.8764312,0.2674834],[0.3046375,-0.9106066,-0.0908119],[0.4243411,-0.8962151,-0.2102437],[0.7368673,-0.8274593,-0.2102437],[0.8515585,-0.790284,-0.0908119],[0.8440399,-0.7561086,0.2674834],[0.7243363,-0.7705002,0.3869152],[0.4118101,-0.839256,0.3869152]],"facets":18,"panels":[],"bolts":0},
|
||||
"Pelvis.SeatStep.L": {"solid":[[-0.3621921,-0.9860519,0.2626576],[-0.3690186,-1.0170816,-0.0626576],[-0.4653486,-1.0055002,-0.1587689],[-0.7455117,-0.9438643,-0.1587689],[-0.837808,-0.913948,-0.0626576],[-0.8309814,-0.8829183,0.2626576],[-0.7346514,-0.8944998,0.3587689],[-0.4544884,-0.9561356,0.3587689],[-0.3142265,-0.9541928,0.2752596],[-0.3217451,-0.9883682,-0.0830357],[-0.4414486,-0.9739767,-0.2024675],[-0.7539749,-0.9052209,-0.2024675],[-0.8686661,-0.8680456,-0.0830357],[-0.8611474,-0.8338702,0.2752596],[-0.7414439,-0.8482618,0.3946913],[-0.4289176,-0.9170176,0.3946913],[-0.2971189,-0.8764312,0.2674834],[-0.3046375,-0.9106066,-0.0908119],[-0.4243411,-0.8962151,-0.2102437],[-0.7368673,-0.8274593,-0.2102437],[-0.8515585,-0.790284,-0.0908119],[-0.8440399,-0.7561086,0.2674834],[-0.7243363,-0.7705002,0.3869152],[-0.4118101,-0.839256,0.3869152]],"facets":18,"panels":[],"bolts":0},
|
||||
"Pelvis.Tail": {"solid":[[-0.14,-0.9466383,0.3327659],[-0.14,-0.8933617,-0.7327659],[-0.0634315,-0.889538,-0.8092389],[0.0634315,-0.889538,-0.8092389],[0.14,-0.8933617,-0.7327659],[0.14,-0.9466383,0.3327659],[0.0634315,-0.950462,0.4092389],[-0.0634315,-0.950462,0.4092389],[-0.18,-0.9075156,0.3513113],[-0.18,-0.8525842,-0.7473162],[-0.08,-0.8475905,-0.8471915],[0.08,-0.8475905,-0.8471915],[0.18,-0.8525842,-0.7473162],[0.18,-0.9075156,0.3513113],[0.08,-0.9125094,0.4511865],[-0.08,-0.9125094,0.4511865],[-0.18,-0.7277402,0.3603001],[-0.18,-0.6728088,-0.7383275],[-0.08,-0.6678151,-0.8382027],[0.08,-0.6678151,-0.8382027],[0.18,-0.6728088,-0.7383275],[0.18,-0.7277402,0.3603001],[0.08,-0.732734,0.4601753],[-0.08,-0.732734,0.4601753]],"facets":18,"panels":[[-0.0323655,-0.9267415,0.3353312],[-0.065,-0.9251118,0.3027374],[-0.065,-0.874938,-0.7007399],[-0.0323655,-0.8733082,-0.7333337],[0.0323655,-0.8733082,-0.7333337],[0.065,-0.874938,-0.7007399],[0.065,-0.9251118,0.3027374],[0.0323655,-0.9267415,0.3353312],[-0.0323655,-0.9666916,0.3333337],[-0.065,-0.9650619,0.3007399],[-0.065,-0.914888,-0.7027373],[-0.0323655,-0.9132584,-0.7353312],[0.0323655,-0.9132584,-0.7353312],[0.065,-0.914888,-0.7027373],[0.065,-0.9650619,0.3007399],[0.0323655,-0.9666916,0.3333337],[-0.0240812,-0.9856679,0.31236],[-0.045,-0.9846233,0.2914672],[-0.045,-0.9352768,-0.6954622],[-0.0240812,-0.9342322,-0.716355],[0.0240812,-0.9342322,-0.716355],[0.045,-0.9352768,-0.6954622],[0.045,-0.9846233,0.2914672],[0.0240812,-0.9856679,0.31236]],"bolts":8},
|
||||
"Pelvis.Roof.R": {"solid":[[0.3677629,0.3934315,0.7630593],[0.3677629,-0.3934315,0.7630593],[0.4808511,-0.51,0.7347872],[0.759149,-0.51,0.6652128],[0.8722371,-0.3934315,0.6369407],[0.8722371,0.3934315,0.6369407],[0.759149,0.51,0.6652128],[0.4808511,0.51,0.7347872],[0.3192558,0.41,0.733955],[0.3192558,-0.41,0.733955],[0.4550758,-0.55,0.7],[0.7655213,-0.55,0.6223885],[0.9013414,-0.41,0.5884336],[0.9013414,0.41,0.5884336],[0.7655213,0.55,0.6223885],[0.4550758,0.55,0.7],[0.2950023,0.41,0.6369407],[0.2950023,-0.41,0.6369407],[0.4308222,-0.55,0.6029857],[0.7412678,-0.55,0.5253743],[0.8770878,-0.41,0.4914193],[0.8770878,0.41,0.4914193],[0.7412678,0.55,0.5253743],[0.4308222,0.55,0.6029857]],"facets":18,"panels":[],"bolts":0},
|
||||
"Pelvis.Roof.L": {"solid":[[-0.3677629,0.3934315,0.7630593],[-0.3677629,-0.3934315,0.7630593],[-0.4808511,-0.51,0.7347872],[-0.759149,-0.51,0.6652128],[-0.8722371,-0.3934315,0.6369407],[-0.8722371,0.3934315,0.6369407],[-0.759149,0.51,0.6652128],[-0.4808511,0.51,0.7347872],[-0.3192558,0.41,0.733955],[-0.3192558,-0.41,0.733955],[-0.4550758,-0.55,0.7],[-0.7655213,-0.55,0.6223885],[-0.9013414,-0.41,0.5884336],[-0.9013414,0.41,0.5884336],[-0.7655213,0.55,0.6223885],[-0.4550758,0.55,0.7],[-0.2950023,0.41,0.6369407],[-0.2950023,-0.41,0.6369407],[-0.4308222,-0.55,0.6029857],[-0.7412678,-0.55,0.5253743],[-0.8770878,-0.41,0.4914193],[-0.8770878,0.41,0.4914193],[-0.7412678,0.55,0.5253743],[-0.4308222,0.55,0.6029857]],"facets":18,"panels":[],"bolts":0}
|
||||
}},
|
||||
{"side": -1, "truth": {
|
||||
"Thigh.core": {"solid":[[0.33,-0.3,0.4],[-0.33,-0.3,0.4],[-0.45,-0.18,0.4],[-0.45,0.38,0.4],[-0.33,0.5,0.4],[0.33,0.5,0.4],[0.45,0.38,0.4],[0.45,-0.18,0.4],[0.42,-0.34,0.05],[-0.42,-0.34,0.05],[-0.6,-0.16,0.05],[-0.6,0.46,0.05],[-0.42,0.64,0.05],[0.42,0.64,0.05],[0.6,0.46,0.05],[0.6,-0.16,0.05],[0.42,-0.34,-1.45],[-0.42,-0.34,-1.45],[-0.6,-0.16,-1.45],[-0.6,0.46,-1.45],[-0.42,0.64,-1.45],[0.42,0.64,-1.45],[0.6,0.46,-1.45],[0.6,-0.16,-1.45],[0.335,-0.3,-1.8],[-0.335,-0.3,-1.8],[-0.475,-0.16,-1.8],[-0.475,0.36,-1.8],[-0.335,0.5,-1.8],[0.335,0.5,-1.8],[0.475,0.36,-1.8],[0.475,-0.16,-1.8]],"facets":26,"panels":[],"bolts":0},
|
||||
"Thigh.Shield": {"solid":[[0.6003516,0.9127237,-0.0100526],[0.5973628,0.9625379,-1.0099225],[0.371703,0.9714425,-1.4588065],[-0.4174352,0.9240942,-1.4588065],[-0.6404113,0.8882715,-1.0099225],[-0.6374224,0.8384573,-0.0100526],[-0.4117627,0.8295527,0.4388314],[0.3773755,0.8769009,0.4388314],[0.6427007,0.874771,-0.0026155],[0.6396555,0.9255249,-1.0213474],[0.3986532,0.9350349,-1.5007508],[-0.4398389,0.8847254,-1.5007508],[-0.677975,0.8464671,-1.0213474],[-0.6749298,0.7957132,-0.0026155],[-0.4339275,0.7862031,0.4767878],[0.4045646,0.8365127,0.4767878],[0.6558607,0.6554389,-0.0135821],[0.6528155,0.7061929,-1.0323141],[0.4118131,0.7157029,-1.5117174],[-0.426679,0.6653934,-1.5117174],[-0.6648151,0.627135,-1.0323141],[-0.6617699,0.5763811,-0.0135821],[-0.4207676,0.566871,0.4658212],[0.4177245,0.6171806,0.4658212]],"facets":18,"panels":[[-0.3645209,0.8161214,0.3629277],[0.3320785,0.8579174,0.3629277],[0.5266297,0.8891734,-0.0287326],[0.5237466,0.9372256,-0.9932363],[0.3268539,0.9449951,-1.3848965],[-0.3697456,0.9031991,-1.3848965],[-0.5642967,0.8719431,-0.9932363],[-0.5614136,0.8238909,-0.0287326],[-0.3675118,0.8659696,0.3654201],[0.3290876,0.9077656,0.3654201],[0.5236388,0.9390216,-0.0262402],[0.5207557,0.9870738,-0.9907439],[0.323863,0.9948433,-1.3824042],[-0.3727365,0.9530473,-1.3824042],[-0.5672876,0.9217913,-0.9907439],[-0.5644045,0.8737391,-0.0262402],[-0.3564294,0.8876444,0.346442],[0.3154931,0.9279597,0.346442],[0.5024643,0.957998,-0.0299587],[0.4996094,1.0055803,-0.9850315],[0.3103879,1.0130471,-1.3614321],[-0.3615346,0.9727317,-1.3614321],[-0.5485058,0.9426934,-0.9850315],[-0.5456509,0.8951111,-0.0299587]],"bolts":8},
|
||||
"Thigh.Block": {"solid":[[0.2199377,1.0082324,0.243278],[0.2192007,1.0205159,-0.003278],[0.1625648,1.0199426,-0.0597762],[-0.2036396,0.9979704,-0.0597762],[-0.2599377,0.9917676,-0.003278],[-0.2592007,0.9794841,0.243278],[-0.2025648,0.9800573,0.2997762],[0.1636396,1.0020295,0.2997762],[0.262308,0.9699251,0.257832],[0.2614721,0.9838576,-0.0218199],[0.1813769,0.9830468,-0.1017204],[-0.2179051,0.9590899,-0.1017204],[-0.2975226,0.9503179,-0.0218199],[-0.2966867,0.9363854,0.257832],[-0.2165914,0.9371961,0.3377326],[0.1826905,0.9611531,0.3377326],[0.2694862,0.8502895,0.2518502],[0.2686502,0.8642219,-0.0278017],[0.188555,0.8634112,-0.1077022],[-0.2107269,0.8394543,-0.1077022],[-0.2903445,0.8306822,-0.0278017],[-0.2895085,0.8167497,0.2518502],[-0.2094133,0.8175604,0.3317508],[0.1898686,0.8415174,0.3317508]],"facets":18,"panels":[],"bolts":0},
|
||||
"Thigh.Lame": {"solid":[[0.5152019,1.0169734,-1.1630588],[0.3580984,1.0120851,-1.3899561],[-0.3986245,0.9666817,-1.3899561],[-0.5551853,0.9527501,-1.1630588],[-0.5091674,0.9524506,-1.0100318],[0.46955,1.0111736,-1.0100318],[0.561354,0.9798173,-1.1707984],[0.3813663,0.9742171,-1.4307466],[-0.4171976,0.9263031,-1.4307466],[-0.5965636,0.9103422,-1.1707984],[-0.5364322,0.909951,-0.9708382],[0.5017008,0.972239,-0.9708382],[0.5673421,0.8800166,-1.1727943],[0.3873544,0.8744164,-1.4327425],[-0.4112095,0.8265026,-1.4327425],[-0.5905755,0.8105416,-1.1727943],[-0.5304441,0.8101503,-0.9728342],[0.5076889,0.8724384,-0.9728342]],"facets":14,"panels":[],"bolts":0},
|
||||
"Thigh.Outer": {"solid":[[-0.8963261,-0.6993303,0.0405074],[-0.9234846,-0.6971576,-0.6427998],[-0.9302595,-0.4659773,-1.2745335],[-0.8760005,0.2877677,-1.4255476],[-0.8321795,0.6398191,-1.0341262],[-0.7895345,0.6364074,0.0388219],[-0.7930059,0.3335055,0.55784],[-0.859628,-0.475686,0.5106725],[-0.8593135,-0.7424191,0.0480094],[-0.8871133,-0.7401951,-0.6514348],[-0.8941858,-0.4988625,-1.3109107],[-0.8367438,0.299098,-1.4707837],[-0.7897608,0.6765533,-1.0511172],[-0.7460753,0.6730585,0.0480094],[-0.749751,0.3523302,0.5975726],[-0.8203176,-0.504772,0.5476124],[-0.6601087,-0.7583555,0.0400412],[-0.6879086,-0.7561315,-0.659403],[-0.694981,-0.5147989,-1.3188789],[-0.6375391,0.2831616,-1.4787519],[-0.590556,0.6606169,-1.0590854],[-0.5468705,0.6571221,0.0400412],[-0.5505463,0.3363939,0.5896044],[-0.6211129,-0.5207084,0.5396442]],"facets":18,"panels":[[-0.7794868,0.2906393,0.4795566],[-0.7763985,0.560117,0.0178105],[-0.7886124,0.5610941,-0.2894937],[-0.8835093,-0.6251161,-0.2894937],[-0.8711026,-0.6261086,0.0226564],[-0.8387128,-0.4287195,0.4376253],[-0.8492085,0.2962171,0.4823454],[-0.8461201,0.5656947,0.0205993],[-0.8583341,0.5666718,-0.2867048],[-0.9532309,-0.6195383,-0.2867049],[-0.9408243,-0.6205308,0.0254452],[-0.9084345,-0.4231417,0.4404142],[-0.870836,0.2868047,0.4624791],[-0.8678498,0.5473692,0.0160056],[-0.8790552,0.5482656,-0.2659239],[-0.9707623,-0.5980719,-0.2659239],[-0.9593307,-0.5989864,0.0216942],[-0.9280897,-0.4085987,0.4219443],[-0.7963567,0.5617135,-0.4843388],[-0.8170925,0.5633725,-1.0060527],[-0.8549845,0.2589536,-1.3445148],[-0.9032756,-0.4118871,-1.2101108],[-0.8970585,-0.624032,-0.6303939],[-0.8912535,-0.6244965,-0.4843389],[-0.8361976,0.5649008,-0.4827452],[-0.8569335,0.5665597,-1.004459],[-0.8948255,0.2621409,-1.3429213],[-0.9431165,-0.4086998,-1.2085171],[-0.9368995,-0.6208448,-0.6288003],[-0.9310944,-0.6213092,-0.4827453],[-0.8585073,0.5466217,-0.5019325],[-0.8781428,0.5481926,-0.9959635],[-0.9144538,0.2564758,-1.3203032],[-0.9611534,-0.3922571,-1.1903285],[-0.9550851,-0.5993261,-0.6244828],[-0.9502143,-0.5997157,-0.5019326]],"bolts":12},
|
||||
"Thigh.OuterStep": {"solid":[[-0.9694378,-0.3795951,-0.0167539],[-0.9879788,-0.3781119,-0.4832461],[-0.9809105,-0.2015447,-0.6596745],[-0.951655,0.1641499,-0.6596745],[-0.9305622,0.3395951,-0.4832461],[-0.9120212,0.3381118,-0.0167539],[-0.9190895,0.1615447,0.1596745],[-0.948345,-0.2041499,0.1596745],[-0.9321286,-0.4227076,-0.0017921],[-0.9519857,-0.4211191,-0.5013952],[-0.9439794,-0.2211206,-0.7012363],[-0.9120813,0.1776055,-0.7012363],[-0.8881895,0.3763331,-0.5013952],[-0.8683324,0.3747445,-0.0017921],[-0.8763387,0.1747461,0.1980491],[-0.9082368,-0.22398,0.1980491],[-0.8424864,-0.429879,-0.0053778],[-0.8623435,-0.4282905,-0.5049809],[-0.8543373,-0.228292,-0.704822],[-0.8224391,0.1704341,-0.704822],[-0.7985473,0.3691617,-0.5049809],[-0.7786903,0.3675731,-0.0053778],[-0.7866965,0.1675747,0.1944634],[-0.8185946,-0.2311514,0.1944634]],"facets":18,"panels":[],"bolts":0},
|
||||
"Thigh.Inner": {"solid":[[0.8776518,-0.5265174,-0.8959235],[0.861841,-0.3684096,-1.41],[0.7737058,0.5129414,-1.41],[0.7623708,0.6262924,-0.603093],[0.7732095,0.5179051,-0.24],[0.871125,-0.4612505,-0.24],[0.8418908,-0.5709032,-0.9],[0.8249752,-0.4017468,-1.45],[0.7304466,0.5435384,-1.45],[0.7185062,0.6629429,-0.6],[0.7304466,0.5435384,-0.2],[0.8349255,-0.5012506,-0.2],[0.6826848,-0.5868238,-0.9],[0.6657692,-0.4176674,-1.45],[0.5712407,0.5276178,-1.45],[0.5593002,0.6470223,-0.6],[0.5712407,0.5276178,-0.2],[0.6757196,-0.5171711,-0.2]],"facets":14,"panels":[[0.7588614,0.4603896,-0.315],[0.8041243,0.0077606,-0.315],[0.8041242,0.0077606,-1.335],[0.7602884,0.4461192,-1.335],[0.7500883,0.5481198,-0.6088924],[0.828514,0.4673549,-0.315],[0.8737769,0.0147259,-0.315],[0.8737769,0.0147259,-1.335],[0.829941,0.4530844,-1.335],[0.819741,0.5550851,-0.6088925],[0.8498954,0.4545382,-0.335],[0.8916876,0.0366167,-0.335],[0.8916875,0.0366167,-1.3150001],[0.8515706,0.437786,-1.3150001],[0.8416732,0.5367599,-0.610439],[0.8235274,-0.1862716,-0.3149999],[0.8444706,-0.3957034,-0.3149999],[0.8501749,-0.4527469,-0.88828],[0.8364357,-0.3153551,-1.3349999],[0.8235274,-0.1862716,-1.3349999],[0.8633289,-0.1822915,-0.3149999],[0.884272,-0.3917232,-0.3149999],[0.8899764,-0.4487667,-0.88828],[0.8762372,-0.3113749,-1.3349999],[0.8633289,-0.1822915,-1.3349999],[0.8852197,-0.2002021,-0.3349999],[0.9023718,-0.3717233,-0.3349999],[0.9078569,-0.4265738,-0.8862417],[0.8946701,-0.2947063,-1.3149999],[0.8852197,-0.2002021,-1.3149999]],"bolts":10},
|
||||
"Thigh.Rear": {"solid":[[0.6,-0.9654287,0.0414257],[0.6,-0.9993547,-0.6370928],[0.3989588,-1.0139576,-0.9291516],[-0.3989588,-1.0139576,-0.9291516],[-0.6,-0.9993547,-0.6370928],[-0.6,-0.9654287,0.0414257],[-0.4336241,-0.9460424,0.4291516],[0.4336241,-0.9460424,0.4291516],[0.64,-0.9250687,0.0476282],[0.64,-0.960025,-0.6514985],[0.42,-0.976005,-0.9710993],[-0.42,-0.976005,-0.9710993],[-0.64,-0.960025,-0.6514985],[-0.64,-0.9250687,0.0476282],[-0.46,-0.9040949,0.4671042],[0.46,-0.9040949,0.4671042],[0.64,-0.7452933,0.0386394],[0.64,-0.7802496,-0.6604872],[0.42,-0.7962296,-0.980088],[-0.42,-0.7962296,-0.980088],[-0.64,-0.7802496,-0.6604872],[-0.64,-0.7452933,0.0386394],[-0.46,-0.7243195,0.4581155],[0.46,-0.7243195,0.4581155]],"facets":18,"panels":[[0.525,-0.9462224,0.0250518],[0.3841694,-0.9298127,0.3532465],[-0.3841694,-0.9298127,0.3532465],[-0.525,-0.9462224,0.0250518],[-0.525,-0.9782164,-0.6148264],[-0.3595065,-0.9902372,-0.8552439],[0.3595065,-0.9902372,-0.8552439],[0.525,-0.9782164,-0.6148264],[0.525,-0.99616,0.0275487],[0.3841694,-0.9797503,0.3557433],[-0.3841694,-0.9797503,0.3557433],[-0.525,-0.99616,0.0275487],[-0.525,-1.028154,-0.6123295],[-0.3595065,-1.0401748,-0.8527471],[0.3595065,-1.0401748,-0.8527471],[0.525,-1.028154,-0.6123295],[0.505,-1.0163401,0.0244474],[0.3709815,-1.0007241,0.3367671],[-0.3709815,-1.0007241,0.3367671],[-0.505,-1.0163401,0.0244474],[-0.505,-1.0478188,-0.6051267],[-0.3489859,-1.0591512,-0.8317733],[0.3489859,-1.0591512,-0.8317733],[0.505,-1.0478188,-0.6051267]],"bolts":8},
|
||||
"Thigh.RearStep": {"solid":[[0.31,-1.0533367,-0.166735],[0.31,-1.0666631,-0.433265],[0.2334315,-1.0704868,-0.509738],[-0.2334315,-1.0704868,-0.509738],[-0.31,-1.0666631,-0.433265],[-0.31,-1.0533367,-0.166735],[-0.2334315,-1.0495131,-0.090262],[0.2334315,-1.0495131,-0.090262],[0.35,-1.0125592,-0.1521847],[0.35,-1.0275404,-0.4518104],[0.25,-1.0325342,-0.5516856],[-0.25,-1.0325342,-0.5516856],[-0.35,-1.0275404,-0.4518104],[-0.35,-1.0125592,-0.1521847],[-0.25,-1.0075654,-0.0523094],[0.25,-1.0075654,-0.0523094],[0.35,-0.932659,-0.1561797],[0.35,-0.9476403,-0.4558054],[0.25,-0.9526341,-0.5556806],[-0.25,-0.9526341,-0.5556806],[-0.35,-0.9476403,-0.4558054],[-0.35,-0.932659,-0.1561797],[-0.25,-0.9276652,-0.0563044],[0.25,-0.9276652,-0.0563044]],"facets":18,"panels":[],"bolts":0},
|
||||
"Thigh.CornerOut": {"solid":[[-0.6046741,0.7607402,0.2029137],[-0.6419686,0.7969987,-1.1029136],[-0.6830156,0.7580089,-1.1594374],[-0.7575075,0.6813887,-1.1594374],[-0.7953259,0.6392598,-1.1029136],[-0.7580314,0.6030012,0.2029137],[-0.7169843,0.6419911,0.2594374],[-0.6424925,0.7186113,0.2594374],[-0.5476611,0.7610992,0.217877],[-0.5859013,0.7982771,-1.1210611],[-0.6439505,0.7431371,-1.2009977],[-0.7415414,0.6427579,-1.2009977],[-0.7950248,0.5831786,-1.1210611],[-0.7567846,0.5460007,0.217877],[-0.6987353,0.6011407,0.2978136],[-0.6011444,0.70152,0.2978136],[-0.4330328,0.6496551,0.2115088],[-0.471273,0.686833,-1.1274294],[-0.5293223,0.631693,-1.207366],[-0.6269132,0.5313138,-1.207366],[-0.6803964,0.4717345,-1.1274294],[-0.6421562,0.4345566,0.2115088],[-0.584107,0.4896966,0.2914454],[-0.4865161,0.5900759,0.2914454]],"facets":18,"panels":[],"bolts":0},
|
||||
"Thigh.CornerIn": {"solid":[[0.7228147,0.6258237,-0.1367753],[0.7426594,0.6451172,-1.0632248],[0.7111945,0.6794759,-1.1097726],[0.6506443,0.7417562,-1.1097726],[0.6171853,0.7741762,-1.0632248],[0.5973406,0.7548828,-0.1367753],[0.6288055,0.7205241,-0.0902275],[0.6893557,0.6582438,-0.0902275],[0.7216761,0.5689284,-0.1214086],[0.7422302,0.5889115,-1.0809804],[0.6949335,0.6405582,-1.1509492],[0.6112841,0.7265977,-1.1509492],[0.5609899,0.7753302,-1.0809804],[0.5404358,0.755347,-0.1214086],[0.5877325,0.7037003,-0.0514398],[0.6713819,0.6176609,-0.0514398],[0.6213416,0.4713809,-0.1255892],[0.6418957,0.4913641,-1.085161],[0.594599,0.5430108,-1.1551298],[0.5109496,0.6290503,-1.1551298],[0.4606554,0.6777828,-1.085161],[0.4401013,0.6577996,-0.1255892],[0.487398,0.6061529,-0.0556204],[0.5710474,0.5201135,-0.0556204]],"facets":18,"panels":[],"bolts":0},
|
||||
"Thigh.Cap": {"solid":[[0.4661148,-0.3206001,0.7921801],[-0.4661148,-0.3206001,0.7921801],[-0.5578418,0.2065509,0.6340348],[-0.3392738,0.5031305,0.5450609],[0.3392738,0.5031305,0.5450609],[0.5578418,0.2065509,0.6340348],[0.4999999,-0.370407,0.765361],[-0.4999999,-0.370407,0.765361],[-0.6,0.2042887,0.5929522],[-0.36,0.5299496,0.4952539],[0.36,0.5299496,0.4952539],[0.6,0.2042887,0.5929522],[0.4999999,-0.4106357,0.6312653],[-0.4999999,-0.4106357,0.6312653],[-0.6,0.16406,0.4588565],[-0.36,0.4897209,0.3611582],[0.36,0.4897209,0.3611582],[0.6,0.16406,0.4588565]],"facets":14,"panels":[[0.3004121,0.4255465,0.5474553],[-0.3004121,0.4255465,0.5474553],[-0.4787954,0.1834945,0.620071],[-0.4025803,-0.25451,0.7514725],[0.4025803,-0.25451,0.7514725],[0.4787954,0.1834945,0.620071],[0.3004121,0.4399139,0.5953466],[-0.3004121,0.4399139,0.5953466],[-0.4787954,0.1978619,0.6679623],[-0.4025803,-0.2401427,0.7993639],[0.4025803,-0.2401427,0.7993639],[0.4787954,0.1978619,0.6679623],[0.2900489,0.4265044,0.6202502],[-0.2900489,0.4265044,0.6202502],[-0.4577163,0.198993,0.6885036],[-0.3856378,-0.2152392,0.8127734],[0.3856378,-0.2152392,0.8127734],[0.4577163,0.198993,0.6885036]],"bolts":6}
|
||||
}}
|
||||
]}
|
||||
82
surfaces/blender/tests/fixtures/plates_raptor.json
vendored
Normal file
82
surfaces/blender/tests/fixtures/plates_raptor.json
vendored
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
{"source": {"branch": "nibu/fable-raptor-4", "sha": "0c271035b89cbf36b26977cc5a19c94e07199ae5", "blender": "5.3.0"},
|
||||
"table": {"schema": "brokkr.plates.v0", "plates": [
|
||||
{"name": "Torso.Jaw1", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.27, 5.5, 4.344352800343537], [0.25, 5.5, 4.14792737789203], [0.6025, 4.75, 4.437397172236504], [0.6125, 4.75, 4.857397172236504]], "inside": [0.0, 5.125, 4.5561471722365035], "lift": 0.1, "thick": 0.14, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "olive_light", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 9.0, "seed": [1, 0]}},
|
||||
{"name": "Torso.Jaw2", "mat": "olive_light", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.6131733333333336, 4.72, 4.885944978524653], [0.6160000000000002, 4.72, 4.4478971722365035], [0.88375, 3.95, 4.672185089974293], [0.85025, 3.95, 5.162396244735779]], "inside": [0.0, 4.335, 4.819518423307627], "lift": 0.13, "thick": 0.16, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "khaki", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 0.9, "seed": [18, 17]}},
|
||||
{"name": "Torso.Jaw3", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.8582000000000001, 3.92, 5.171231323471511], [0.8920000000000001, 3.92, 4.680185089974293], [1.041875, 3.05, 4.885938303341902], [1.029375, 3.25, 5.265938303341902]], "inside": [0.0, 3.535, 5.03285175664096], "lift": 0.1, "thick": 0.14, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "olive_light", "min_area": 0.12, "lifts": [0.035, 0.035], "inset": 0.07, "gap": 0.04, "split": 99.0, "seed": [35, 34]}},
|
||||
{"name": "Torso.JawLip1", "mat": "gunmetal", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.27666666666666656, 5.4, 4.19167737789203], [0.1577777777777777, 5.4, 4.03167737789203], [0.45000000000000007, 4.5, 4.364897172236503], [0.7150000000000001, 4.5, 4.5248971722365035]], "inside": [0.0, 4.95, 4.617397172236504], "lift": 0.04, "thick": 0.08, "taper": 0.035, "back": 0.94, "gap": 0.025}},
|
||||
{"name": "Torso.JawLip2", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.7330000000000001, 4.46, 4.536185089974293], [0.4620000000000001, 4.46, 4.3761850899742925], [0.63, 3.4, 4.655938303341902], [1.0025, 3.4, 4.815938303341902]], "inside": [0.0, 3.9299999999999997, 4.927518423307626], "lift": 0.05, "thick": 0.08, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "olive_light", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 9.0, "seed": [69, 68]}},
|
||||
{"name": "Torso.CollarU", "mat": "olive_light", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.0636, 3.5, 6.0693942065828415], [0.53, 3.5, 6.007794206582841], [0.566, 3.14, 6.083710663170325], [0.06863999999999999, 3.08, 6.155219361779141]], "inside": [0.0, 3.305, 5.084938303341902], "lift": 0.17, "thick": 0.16, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "khaki", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 9.0, "seed": [86, 85]}},
|
||||
{"name": "Torso.CollarF", "mat": "olive_light", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.53, 3.5, 6.007794206582841], [1.00125, 3.5, 5.212185089974293], [1.02375, 3.3, 5.255938303341902], [0.566, 3.14, 6.083710663170325]], "inside": [0.0, 3.36, 5.073938303341902], "lift": 0.16, "thick": 0.16, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "khaki", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 9.0, "seed": [103, 102]}},
|
||||
{"name": "Torso.Cheek", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.5910599999999999, 3.08, 6.0618721194416505], [1.01152, 3.24, 5.29989720287198], [1.0611000000000002, 2.5, 5.445415433520716], [0.9396, 2.32, 5.664961644345172], [0.6307200000000001, 2.32, 6.133612994552364]], "inside": [0.0, 2.692, 5.207538303341902], "lift": 0.11, "thick": 0.13, "taper": 0.035, "back": 0.94, "gap": 0.025}, "fits": [{"kind": "mark", "id": "27", "at": [0.006142872851341963, 0.0045098247937858105], "height": 0.5}]},
|
||||
{"name": "Torso.CheekDeck", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.06911999999999999, 3.04, 6.1615584474346505], [0.56448, 3.04, 6.1013584474346505], [0.6076, 2.0, 6.175354661707495], [0.0744, 2.0, 6.235554661707495]], "inside": [0.0, 2.52, 5.241938303341902], "lift": 0.07, "thick": 0.1, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "olive_light", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 0.9, "seed": [137, 136]}},
|
||||
{"name": "Torso.Gill", "mat": "gunmetal", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.63168, 2.28, 6.135409293752973], [1.06132, 2.28, 5.488082927942363], [1.06038, 1.98, 5.5440385341450344], [0.6378699999999999, 1.98, 6.148364408169792]], "inside": [0.0, 2.13, 5.319938303341901], "lift": 0.05, "thick": 0.09, "taper": 0.035, "back": 0.94, "gap": 0.025}},
|
||||
{"name": "Torso.Shoulder", "mat": "olive_light", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.63681, 1.94, 6.149855403487022], [1.0762500000000002, 1.94, 5.524430162810625], [0.9305714285714286, 0.62, 5.77571206803326], [0.5378933333333333, 0.42, 6.1004641922008265]], "inside": [0.0, 1.23, 5.472763496143958], "lift": 0.2, "thick": 0.16, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "khaki", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 0.7, "seed": [171, 170]}},
|
||||
{"name": "Torso.ShoulderDeck", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.07428, 1.96, 6.236924230634243], [0.6066199999999999, 1.96, 6.176724230634243], [0.51744, 0.44, 6.119364493385301], [0.06336, 0.44, 6.179564493385301]], "inside": [0.0, 1.2, 5.477763496143958], "lift": 0.09, "thick": 0.1, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "olive_light", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 0.6, "seed": [188, 187]}},
|
||||
{"name": "Torso.Belt1", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[1.0571000000000002, 3.0, 5.299138303341902], [1.04525, 3.02, 4.891938303341902], [1.07, 2.36, 5.023938303341902], [1.0796000000000001, 2.36, 5.427138303341902]], "inside": [0.0, 2.685, 5.208938303341902], "lift": 0.07, "thick": 0.11, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "olive_light", "min_area": 0.12, "lifts": [0.035, 0.035], "inset": 0.07, "gap": 0.04, "split": 99.0, "seed": [205, 204]}},
|
||||
{"name": "Torso.Belt2", "mat": "olive_light", "bevel": 0.012, "sides": "both", "slab": {"corners": [[1.0796000000000001, 2.33, 5.433138303341901], [1.07, 2.33, 5.029938303341901], [1.03875, 1.5, 5.1777634961439585], [1.0483500000000001, 1.5, 5.5809634961439585]], "inside": [0.0, 1.915, 5.358596829477292], "lift": 0.11, "thick": 0.12, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "khaki", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 9.0, "seed": [222, 221]}},
|
||||
{"name": "Torso.Belt3", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[1.046475, 1.47, 5.585963496143958], [1.036875, 1.47, 5.182763496143958], [0.9480000000000001, 0.78, 5.326616966580977], [0.9301714285714286, 0.62, 5.759668263975169]], "inside": [0.0, 1.085, 5.496930162810625], "lift": 0.08, "thick": 0.11, "taper": 0.035, "back": 0.94, "gap": 0.025}},
|
||||
{"name": "Torso.Lip1", "mat": "gunmetal", "bevel": 0.012, "sides": "both", "slab": {"corners": [[1.0070000000000001, 3.36, 4.823938303341902], [0.632, 3.36, 4.663938303341902], [0.66, 2.4, 4.855938303341902], [1.07, 2.4, 5.015938303341902]], "inside": [0.0, 2.88, 5.169938303341902], "lift": 0.03, "thick": 0.08, "taper": 0.035, "back": 0.94, "gap": 0.025}},
|
||||
{"name": "Torso.Lip2", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[1.07, 2.36, 5.023938303341902], [0.66, 2.36, 4.863938303341902], [0.625, 1.3, 5.0510968294772915], [1.02625, 1.3, 5.211096829477292]], "inside": [0.0, 1.83, 5.372763496143959], "lift": 0.05, "thick": 0.08, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "olive_light", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 9.0, "seed": [273, 272]}},
|
||||
{"name": "Torso.Lip3", "mat": "gunmetal", "bevel": 0.012, "sides": "both", "slab": {"corners": [[1.02375, 1.26, 5.2177634961439585], [0.623, 1.26, 5.057763496143958], [0.56, 0.5, 5.250616966580976], [0.9, 0.5, 5.410616966580976]], "inside": [0.0, 0.88, 5.546616966580976], "lift": 0.03, "thick": 0.08, "taper": 0.035, "back": 0.94, "gap": 0.025}},
|
||||
{"name": "Torso.Hood1D", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.0624, 0.4, 6.169880489976104], [0.52, 0.4, 6.108280489976104], [0.364, -0.66, 6.250353133913001], [0.04368, -0.66, 6.3119531339130015]], "inside": [0.0, -0.13, 5.896217574199579], "lift": 0.14, "thick": 0.11, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "olive_light", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 9.0, "seed": [307, 306]}},
|
||||
{"name": "Torso.Hood1F", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.5601485714285714, 0.56, 6.135829871438327], [0.9411428571428572, 0.74, 5.338616966580977], [0.6, -0.1, 5.633944846926852], [0.488, -0.66, 5.797178285195826], [0.36976, -0.66, 6.24185255718071]], "inside": [0.0, -0.024000000000000004, 5.852853937835943], "lift": 0.13, "thick": 0.12, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "olive_light", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 0.5, "seed": [324, 323]}},
|
||||
{"name": "Torso.Hood2D", "mat": "olive_light", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.044399999999999995, -0.6, 6.311459761576258], [0.37, -0.6, 6.249859761576258], [0.32, -1.5, 6.226910880175944], [0.0384, -1.5, 6.288510880175944]], "inside": [0.0, -1.05, 6.070119461666414], "lift": 0.1, "thick": 0.1, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "khaki", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 9.0, "seed": [341, 340]}},
|
||||
{"name": "Torso.Hood2F", "mat": "olive_light", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.37392, -0.62, 6.242114324404738], [0.496, -0.62, 5.794825344019356], [0.41, -1.5, 5.8465900499017085], [0.3244, -1.5, 6.21998395024202]], "inside": [0.0, -1.06, 6.070707696960532], "lift": 0.09, "thick": 0.11, "taper": 0.035, "back": 0.94, "gap": 0.025}},
|
||||
{"name": "Torso.Hood3D", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.03864, -1.46, 6.292862675791256], [0.322, -1.46, 6.231262675791256], [0.26, -2.3, 6.16377625008143], [0.0312, -2.3, 6.22537625008143]], "inside": [0.0, -1.88, 6.152707433134606], "lift": 0.06, "thick": 0.09, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "olive_light", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 9.0, "seed": [375, 374]}},
|
||||
{"name": "Torso.Hood3F", "mat": "khaki", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.32646000000000003, -1.46, 6.22419092354263], [0.4135, -1.46, 5.844237108725237], [0.32, -2.3, 5.992069135262265], [0.2632, -2.3, 6.161355376401335]], "inside": [0.0, -1.88, 6.152707433134606], "lift": 0.05, "thick": 0.1, "taper": 0.035, "back": 0.94, "gap": 0.025}, "clad": {"mat": "olive_light", "min_area": 0.12, "lifts": [0.035, 0.06], "inset": 0.07, "gap": 0.04, "split": 9.0, "seed": [392, 391]}},
|
||||
{"name": "Torso.HoodLip", "mat": "gunmetal", "bevel": 0.012, "sides": "both", "slab": {"corners": [[0.85, 0.4, 5.4406169665809765], [0.5366666666666667, 0.4, 5.280616966580976], [0.24749999999999997, -2.2, 5.810792539517585], [0.33124999999999993, -2.2, 5.970792539517585]], "inside": [0.0, -0.9000000000000001, 6.061295932254649], "lift": 0.03, "thick": 0.07, "taper": 0.035, "back": 0.94, "gap": 0.025}}
|
||||
]},
|
||||
"cases": [
|
||||
{"side": 1, "truth": {
|
||||
"Torso.Jaw1.R": {"solid":[[0.6781577,4.8458824,4.7452664],[0.668655,4.8445058,4.4767356],[0.3750727,5.4858899,4.2300553],[0.3787763,5.4840679,4.3069553],[0.6626044,4.800034,4.8098192],[0.6499786,4.7982044,4.4530377],[0.3264895,5.5049257,4.1812291],[0.3335624,5.5014462,4.3280835],[0.5565017,4.7785773,4.7914252],[0.5446335,4.7768579,4.4560513],[0.2405537,5.4411759,4.200551],[0.2472022,5.4379053,4.338594]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Jaw1.L": {"solid":[[-0.3787763,5.4840679,4.3069553],[-0.3750727,5.4858899,4.2300553],[-0.668655,4.8445058,4.4767356],[-0.6781577,4.8458824,4.7452664],[-0.3335624,5.5014462,4.3280835],[-0.3264895,5.5049257,4.1812291],[-0.6499786,4.7982044,4.4530377],[-0.6626044,4.800034,4.8098187],[-0.2472022,5.4379053,4.338594],[-0.2405537,5.4411759,4.200551],[-0.5446335,4.7768579,4.4560513],[-0.5565017,4.7785773,4.7914252]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Jaw2.R": {"solid":[[0.9634969,4.0501137,5.0842671],[0.9793593,4.0470967,4.7224078],[0.7621094,4.706634,4.5318127],[0.7502888,4.7032971,4.8479657],[0.9395706,4.0060921,5.1315699],[0.9587276,4.0024481,4.6945519],[0.7194206,4.7289476,4.4846058],[0.7049535,4.7248635,4.8715405],[0.8148237,3.9873223,5.106564],[0.8328313,3.9838972,4.6957669],[0.6078827,4.6668067,4.4984179],[0.5942836,4.6629677,4.8621368]],"facets":10,"panels":[[0.7623737,4.6329627,4.6227379],[0.755846,4.6311202,4.7973275],[0.9262363,4.1091132,4.9861736],[0.9355094,4.1073494,4.7746315],[0.7954733,4.644258,4.624095],[0.7889456,4.642415,4.7986841],[0.9593359,4.1204081,4.9875302],[0.968609,4.1186442,4.7759881],[0.8198669,4.6315074,4.6510701],[0.8148514,4.6300917,4.785213],[0.9730081,4.1455636,4.9605002],[0.9803985,4.1441579,4.7919059]],"bolts":4},
|
||||
"Torso.Jaw2.L": {"solid":[[-0.7502887,4.7032971,4.8479657],[-0.7621094,4.706634,4.5318127],[-0.9793593,4.0470967,4.7224078],[-0.9634969,4.0501137,5.0842671],[-0.7049535,4.7248635,4.8715405],[-0.7194206,4.7289476,4.4846058],[-0.9587276,4.0024481,4.6945519],[-0.9395706,4.0060921,5.1315699],[-0.5942836,4.6629682,4.8621368],[-0.6078827,4.6668067,4.4984179],[-0.8328313,3.9838972,4.6957669],[-0.8148237,3.9873223,5.106564]],"facets":10,"panels":[[-0.9262362,4.1091132,4.9861732],[-0.7558458,4.6311202,4.797327],[-0.7623736,4.6329632,4.6227379],[-0.9355093,4.1073499,4.774631],[-0.9829783,4.1284761,4.9884992],[-0.812588,4.6504831,4.7996531],[-0.8191157,4.6523261,4.6250639],[-0.9922515,4.1267123,4.776957],[-0.9966506,4.1536317,4.9614692],[-0.8384938,4.6381598,4.7861819],[-0.8435093,4.6395755,4.6520391],[-1.004041,4.152226,4.7928748]],"bolts":4},
|
||||
"Torso.Jaw3.R": {"solid":[[1.1034771,3.2995813,5.2017331],[1.1353582,3.1601076,4.9280725],[0.9894645,3.8798358,4.7565813],[0.984347,3.8839259,5.1203036],[1.0727185,3.273221,5.2393327],[1.1118007,3.1022437,4.9038582],[0.9487557,3.9065831,4.7122068],[0.9425905,3.9115105,5.1503859],[0.9666496,3.2685959,5.2238503],[1.0033869,3.107877,4.908504],[0.8501246,3.8639562,4.7283521],[0.8443294,3.868588,5.1402402]],"facets":10,"panels":[[0.9797079,3.8106408,5.0591025],[1.0768427,3.3341856,5.1254978],[1.0943214,3.2577195,4.9754639],[0.9827303,3.8082252,4.8442941],[1.0139892,3.8176858,5.0595059],[1.1111239,3.3412309,5.1259007],[1.1286026,3.2647648,4.9758673],[1.0170115,3.8152704,4.844697],[1.03785,3.8019233,5.042316],[1.1287004,3.3562937,5.1044154],[1.1420641,3.2978299,4.9897037],[1.0402737,3.7999861,4.8700538]],"bolts":4},
|
||||
"Torso.Jaw3.L": {"solid":[[-0.984347,3.8839259,5.1203036],[-0.9894645,3.8798358,4.7565813],[-1.1353582,3.1601076,4.9280725],[-1.1034771,3.2995813,5.2017331],[-0.9425905,3.9115105,5.1503859],[-0.9487557,3.9065831,4.7122068],[-1.1118007,3.1022437,4.9038582],[-1.0727185,3.273221,5.2393327],[-0.8443294,3.868588,5.1402402],[-0.8501246,3.8639562,4.7283521],[-1.0033869,3.107877,4.908504],[-0.9666496,3.2685959,5.2238503]],"facets":10,"panels":[[-1.0943214,3.2577195,4.9754634],[-1.0768428,3.3341856,5.1254973],[-0.979708,3.8106406,5.0591021],[-0.9827303,3.8082252,4.8442936],[-1.1286026,3.2647645,4.9758668],[-1.111124,3.3412306,5.1259003],[-1.0139892,3.8176858,5.0595055],[-1.0170116,3.8152702,4.8446965],[-1.1420641,3.2978299,4.9897032],[-1.1287004,3.3562937,5.1044149],[-1.03785,3.801923,5.0423155],[-1.0402738,3.7999861,4.8700533]],"bolts":4},
|
||||
"Torso.JawLip1.R": {"solid":[[0.6458802,4.5582738,4.4395108],[0.5161161,4.5574179,4.3403563],[0.2400006,5.3381481,4.0823326],[0.2889529,5.3373065,4.1198077],[0.6731222,4.5253091,4.5064259],[0.4764318,4.5240121,4.3561325],[0.1752755,5.375546,4.0747085],[0.2844312,5.3736696,4.1582718],[0.6295741,4.5529151,4.528182],[0.4446852,4.5516958,4.3869061],[0.1615982,5.352138,4.1223679],[0.2642045,5.3503742,4.2009172]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.JawLip1.L": {"solid":[[-0.2889529,5.3373065,4.1198077],[-0.2400006,5.3381481,4.0823326],[-0.5161161,4.5574179,4.3403563],[-0.6458802,4.5582738,4.4395108],[-0.2844312,5.3736696,4.1582718],[-0.1752755,5.375546,4.0747085],[-0.4764318,4.5240121,4.3561325],[-0.6731222,4.5253091,4.5064259],[-0.2642045,5.3503742,4.2009172],[-0.1615982,5.352138,4.1223679],[-0.4446852,4.5516958,4.3869061],[-0.6295741,4.5529151,4.528182]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.JawLip2.R": {"solid":[[0.9485517,3.4529181,4.7355824],[0.7014969,3.4510305,4.6154981],[0.5440177,4.3942752,4.3846078],[0.7175547,4.3920512,4.4695377],[0.9750648,3.4237115,4.7926283],[0.6596735,3.4213021,4.639328],[0.4905131,4.4345131,4.3913107],[0.7271858,4.4314795,4.5071402],[0.9398439,3.4604948,4.8200493],[0.6433761,3.4582298,4.6759472],[0.4843653,4.4106483,4.442811],[0.7068377,4.4077964,4.5516906]],"facets":10,"panels":[[0.6592853,4.3262753,4.4743786],[0.8565182,3.5244124,4.7015362],[0.7461367,3.5235691,4.6478839],[0.6120198,4.3268809,4.4512467],[0.6852901,4.3175545,4.4210148],[0.882523,3.5156915,4.6481724],[0.7721415,3.5148482,4.5945201],[0.6380246,4.3181601,4.3978829],[0.6797866,4.2950239,4.399528],[0.8673726,3.5323808,4.6155748],[0.7960405,3.5318358,4.5809031],[0.6685987,4.295167,4.3940525]],"bolts":4},
|
||||
"Torso.JawLip2.L": {"solid":[[-0.7175547,4.3920512,4.4695377],[-0.5440177,4.3942752,4.3846078],[-0.7014969,3.4510307,4.6154981],[-0.9485517,3.4529181,4.7355824],[-0.7271858,4.4314795,4.5071402],[-0.4905131,4.4345131,4.3913107],[-0.6596735,3.4213021,4.639328],[-0.9750648,3.4237115,4.7926283],[-0.7068377,4.4077964,4.5516906],[-0.4843653,4.4106483,4.442811],[-0.6433761,3.4582298,4.6759472],[-0.9398439,3.4604948,4.8200493]],"facets":10,"panels":[[-0.6592851,4.3262753,4.4743786],[-0.6120197,4.3268809,4.4512467],[-0.7461365,3.5235691,4.6478839],[-0.8565181,3.5244124,4.7015362],[-0.6852899,4.3175545,4.4210148],[-0.6380244,4.3181601,4.3978829],[-0.7721414,3.5148482,4.5945201],[-0.8825229,3.5156915,4.6481724],[-0.6797863,4.2950234,4.399528],[-0.6685985,4.295167,4.3940525],[-0.7960405,3.5318358,4.5809031],[-0.8673725,3.5323808,4.6155748]],"bolts":4},
|
||||
"Torso.CollarU.R": {"solid":[[0.1480696,3.1818228,6.300221],[0.5215798,3.2264247,6.2441702],[0.4968882,3.4767935,6.1938457],[0.1442731,3.4762638,6.2378926],[0.1096004,3.1358895,6.278759],[0.5551332,3.1890917,6.2119007],[0.5240929,3.5038362,6.1486363],[0.1048643,3.5032063,6.2010045],[0.1073099,3.1218333,6.1532855],[0.5261107,3.1718433,6.0904384],[0.4969327,3.4677031,6.0309701],[0.1028579,3.4671111,6.0801959]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.CollarU.L": {"solid":[[-0.1442731,3.4762638,6.2378926],[-0.4968882,3.4767935,6.1938457],[-0.5215798,3.2264247,6.2441702],[-0.1480696,3.1818228,6.300221],[-0.1048643,3.5032063,6.2010045],[-0.5240929,3.5038362,6.1486363],[-0.5551332,3.1890917,6.2119007],[-0.1096004,3.1358895,6.278759],[-0.1028579,3.4671111,6.0801959],[-0.4969327,3.4677031,6.0309701],[-0.5261107,3.1718433,6.0904384],[-0.1073099,3.1218333,6.1532855]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.CollarF.R": {"solid":[[0.72499,3.2426014,6.0970759],[1.1215882,3.3813784,5.3768516],[1.1122297,3.4722867,5.3575101],[0.701372,3.4719968,6.048275],[0.6817346,3.1941087,6.1187196],[1.1131568,3.3450711,5.3352547],[1.0972214,3.4998662,5.302321],[0.650287,3.4995508,6.0537405],[0.5885689,3.1813512,6.0310478],[0.9941058,3.3232558,5.294591],[0.9791265,3.4687634,5.2636328],[0.5590081,3.4684668,5.9699674]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.CollarF.L": {"solid":[[-0.701372,3.4719968,6.048275],[-1.1122297,3.4722867,5.3575101],[-1.1215882,3.3813784,5.3768516],[-0.72499,3.2426014,6.0970759],[-0.650287,3.4995508,6.0537405],[-1.0972214,3.4998662,5.302321],[-1.1131568,3.3450711,5.3352547],[-0.6817346,3.1941087,6.1187196],[-0.5590081,3.4684668,5.9699674],[-0.9791265,3.4687634,5.2636328],[-0.9941058,3.3232558,5.294591],[-0.5885689,3.1813512,6.0310478]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Cheek.R": {"solid":[[0.7616042,2.3949468,6.1404848],[1.0143056,2.3933237,5.734005],[1.1105072,2.5457008,5.542192],[1.085451,3.1817539,5.4284258],[0.7093408,3.0426319,6.0677066],[0.7164118,2.3559163,6.155828],[0.9945078,2.3541298,5.7084999],[1.1004012,2.5218582,5.4973631],[1.0728861,3.2203295,5.3724322],[0.6590133,3.0672393,6.0758991],[0.6478956,2.3647487,6.0824809],[0.9093057,2.3630698,5.6619925],[1.0088454,2.5207343,5.4635239],[0.9829814,3.1772974,5.3460889],[0.593941,3.0333924,6.0073476]],"facets":12,"panels":[],"bolts":0},
|
||||
"Torso.Cheek.L": {"solid":[[-0.7093408,3.0426319,6.0677066],[-1.085451,3.1817539,5.4284258],[-1.1105072,2.5457008,5.542192],[-1.0143056,2.3933237,5.734005],[-0.7616042,2.3949468,6.1404848],[-0.6590133,3.0672393,6.0758991],[-1.0728861,3.2203295,5.3724322],[-1.1004012,2.5218582,5.4973631],[-0.9945078,2.3541298,5.7084999],[-0.7164119,2.3559163,6.155828],[-0.5939409,3.0333924,6.0073476],[-0.9829814,3.1772974,5.3460889],[-1.0088454,2.5207343,5.4635239],[-0.9093057,2.3630698,5.6619925],[-0.6478956,2.364749,6.0824809]],"facets":12,"panels":[],"bolts":0},
|
||||
"Torso.CheekDeck.R": {"solid":[[0.1419043,2.0650213,6.2945924],[0.5534907,2.0649021,6.2464862],[0.515558,2.9853468,6.1829267],[0.1370073,2.98522,6.2271891],[0.1032736,2.027564,6.266542],[0.5856587,2.0274243,6.2101612],[0.5448481,3.0177033,6.1417794],[0.0980052,3.0175533,6.1940269],[0.109527,2.0525076,6.19835],[0.562969,2.0523763,6.1453519],[0.5246071,2.9832382,6.0810733],[0.1045747,2.9830976,6.1301856]],"facets":10,"panels":[[0.4465562,2.9140482,6.1760697],[0.2045898,2.9139671,6.2043619],[0.208744,2.1333499,6.2615409],[0.4787329,2.1332717,6.2299848],[0.4506091,2.9166093,6.2107396],[0.2086427,2.9165282,6.2390318],[0.212797,2.135911,6.2962108],[0.4827859,2.1358328,6.2646546],[0.433872,2.8981199,6.2342525],[0.2309297,2.898052,6.2579818],[0.2348717,2.157315,6.3122396],[0.4644041,2.1572485,6.2854118]],"bolts":4},
|
||||
"Torso.CheekDeck.L": {"solid":[[-0.1370073,2.98522,6.2271891],[-0.515558,2.9853468,6.1829267],[-0.5534908,2.0649021,6.2464862],[-0.1419043,2.0650213,6.2945924],[-0.0980052,3.0175533,6.1940269],[-0.5448481,3.0177033,6.1417794],[-0.5856587,2.0274243,6.2101612],[-0.1032736,2.027564,6.266542],[-0.1045747,2.9830976,6.1301856],[-0.5246071,2.9832382,6.0810733],[-0.5629691,2.0523763,6.1453519],[-0.109527,2.0525076,6.19835]],"facets":10,"panels":[[-0.4465562,2.9140482,6.1760697],[-0.4787329,2.1332717,6.2299848],[-0.2087439,2.1333499,6.2615409],[-0.2045898,2.9139671,6.2043619],[-0.4535041,2.9184387,6.2355042],[-0.4856809,2.1376622,6.2894192],[-0.2156919,2.1377404,6.3209753],[-0.2115377,2.9183576,6.2637963],[-0.4367669,2.8999493,6.259017],[-0.4672992,2.1590779,6.3101764],[-0.2377666,2.1591444,6.3370037],[-0.2338247,2.8998814,6.2827458]],"bolts":4},
|
||||
"Torso.Gill.R": {"solid":[[0.7139895,2.0437119,6.1258149],[1.0652895,2.0431433,5.6095428],[1.0703707,2.2240007,5.5789557],[0.7057446,2.223469,6.1149549],[0.6670325,2.0063245,6.1372304],[1.0553687,2.0056958,5.5665302],[1.0624131,2.256434,5.5241241],[0.6555879,2.2558405,6.1221561],[0.6332603,2.0098648,6.0883889],[0.9982963,2.009274,5.5519304],[1.0049181,2.2449677,5.5120687],[0.6225024,2.24441,6.0742188]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Gill.L": {"solid":[[-0.7057446,2.223469,6.1149549],[-1.0703707,2.2240007,5.5789557],[-1.0652895,2.0431433,5.6095428],[-0.7139896,2.0437119,6.1258149],[-0.6555879,2.2558405,6.1221561],[-1.0624131,2.256434,5.5241241],[-1.0553687,2.0056958,5.5665302],[-0.6670325,2.0063245,6.1372304],[-0.6225024,2.24441,6.0742188],[-1.0049181,2.2449677,5.5120687],[-0.9982963,2.009274,5.5519304],[-0.6332603,2.0098648,6.0883889]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Shoulder.R": {"solid":[[0.766121,0.503258,6.2084999],[1.0149217,0.6597862,5.9122195],[1.2070429,1.8741268,5.7282615],[0.8078286,1.8753638,6.2140069],[0.7152762,0.4519182,6.2131157],[1.0066018,0.6351999,5.8661952],[1.208279,1.9099404,5.6730876],[0.7596377,1.9113306,6.2189732],[0.631173,0.5016816,6.120554],[0.905019,0.6739665,5.7944489],[1.0945956,1.8722225,5.6129274],[0.6728727,1.8735293,6.12606]],"facets":10,"panels":[[0.9620576,0.7113007,5.9471393],[1.1350672,1.8048418,5.7814813],[0.8347065,1.8057724,6.1469455],[0.7983067,0.6082799,6.1421394],[1.0083938,0.7097393,5.9852252],[1.1814033,1.8032804,5.8195667],[0.8810427,1.804211,6.1850314],[0.8446428,0.6067187,6.1802254],[1.013148,0.7237886,6.0115247],[1.180697,1.7828155,5.8510952],[0.9085804,1.7836586,6.1821938],[0.873697,0.6360558,6.177588]],"bolts":4},
|
||||
"Torso.Shoulder.L": {"solid":[[-0.8078286,1.8753638,6.2140069],[-1.2070429,1.8741268,5.7282615],[-1.0149217,0.6597862,5.9122195],[-0.766121,0.503258,6.2084999],[-0.7596377,1.9113306,6.2189732],[-1.208279,1.9099404,5.6730876],[-1.0066018,0.6351999,5.8661952],[-0.7152762,0.4519182,6.2131157],[-0.6728727,1.8735293,6.12606],[-1.0945956,1.8722225,5.6129274],[-0.905019,0.6739665,5.7944489],[-0.631173,0.5016816,6.120554]],"facets":10,"panels":[[-0.9620576,0.7113007,5.9471393],[-0.7983067,0.6082799,6.1421394],[-0.8347066,1.8057724,6.1469455],[-1.1350672,1.8048418,5.7814813],[-1.0083938,0.7097393,5.9852252],[-0.8446428,0.6067187,6.1802254],[-0.8810427,1.804211,6.1850314],[-1.1814033,1.8032804,5.8195667],[-1.013148,0.7237886,6.0115247],[-0.873697,0.6360558,6.177588],[-0.9085804,1.7836586,6.1821938],[-1.180697,1.7828155,5.8510952]],"bolts":4},
|
||||
"Torso.ShoulderDeck.R": {"solid":[[0.1338997,0.4963008,6.2615356],[0.4724211,0.4961444,6.2204647],[0.554043,1.8963948,6.2689981],[0.1444805,1.8962564,6.3186746],[0.094679,0.4627956,6.2296085],[0.5009658,0.4626078,6.180316],[0.5866662,1.9328259,6.2312741],[0.1057881,1.9326636,6.2896004],[0.100499,0.5095817,6.1653223],[0.4824086,0.5094053,6.1189871],[0.562967,1.8914104,6.1668882],[0.1109416,1.8912575,6.221715]],"facets":10,"panels":[[0.4045028,0.5669425,6.2114944],[0.4779677,1.8272576,6.2551775],[0.2110364,1.8271676,6.2875538],[0.2015125,0.5670362,6.2361221],[0.4117219,0.564459,6.2710066],[0.4851868,1.8247741,6.3146901],[0.2182556,1.824684,6.3470664],[0.2087317,0.5645527,6.2956343],[0.3954107,0.5836226,6.2939491],[0.466545,1.8039564,6.3362465],[0.2403655,1.80388,6.3636799],[0.2311435,0.5836985,6.3138785]],"bolts":4},
|
||||
"Torso.ShoulderDeck.L": {"solid":[[-0.1444805,1.8962564,6.3186746],[-0.5540429,1.8963948,6.2689981],[-0.4724211,0.4961443,6.2204647],[-0.1338998,0.4963008,6.2615356],[-0.1057881,1.9326636,6.2896004],[-0.5866662,1.9328259,6.2312741],[-0.5009658,0.4626078,6.180316],[-0.094679,0.4627956,6.2296085],[-0.1109416,1.8912575,6.221715],[-0.562967,1.8914104,6.1668882],[-0.4824086,0.5094053,6.1189871],[-0.100499,0.5095817,6.1653223]],"facets":10,"panels":[[-0.4045027,0.5669426,6.211494],[-0.2015124,0.5670363,6.2361217],[-0.2110364,1.8271676,6.2875533],[-0.4779676,1.8272578,6.255177],[-0.4087139,0.5654938,6.2462096],[-0.2057236,0.5655876,6.2708373],[-0.2152475,1.8257189,6.322269],[-0.4821788,1.825809,6.2898927],[-0.3924026,0.5846575,6.2691517],[-0.2281355,0.5847334,6.2890816],[-0.2373575,1.8049148,6.3388824],[-0.4635369,1.8049912,6.3114491]],"bolts":4},
|
||||
"Torso.Belt1.R": {"solid":[[1.146176,2.4221623,5.3521624],[1.1389598,2.4221458,5.071332],[1.1194549,2.9585156,4.964046],[1.1271794,2.9445682,5.2476935],[1.1133937,2.38609,5.3957429],[1.1043435,2.3860693,5.0435414],[1.0822154,2.9945703,4.9218278],[1.0919032,2.9770784,5.2775593],[1.0375291,2.4017417,5.3835039],[1.029022,2.4017222,5.0524349],[1.0082216,2.9737132,4.938024],[1.0173281,2.9572709,5.2724113]],"facets":10,"panels":[[1.104007,2.8835981,5.0507927],[1.1078055,2.8767397,5.1902728],[1.1218143,2.4914992,5.267312],[1.1182659,2.4914911,5.1292229],[1.1389785,2.88469,5.0498943],[1.1427768,2.8778317,5.189374],[1.1567856,2.4925911,5.2664132],[1.1532373,2.492583,5.1283245],[1.1602581,2.8640873,5.074019],[1.1629348,2.8592544,5.172308],[1.1755184,2.5132041,5.2415099],[1.1730181,2.5131984,5.1442046]],"bolts":4},
|
||||
"Torso.Belt1.L": {"solid":[[-1.1271794,2.9445682,5.2476935],[-1.1194549,2.9585156,4.964046],[-1.1389598,2.4221458,5.071332],[-1.146176,2.4221623,5.3521624],[-1.0919032,2.9770784,5.2775593],[-1.0822154,2.9945703,4.9218278],[-1.1043435,2.3860693,5.0435414],[-1.1133937,2.38609,5.3957429],[-1.0173281,2.9572709,5.2724113],[-1.0082216,2.9737132,4.938024],[-1.029022,2.4017222,5.0524349],[-1.0375291,2.4017417,5.3835039]],"facets":10,"panels":[[-1.1040069,2.8835983,5.0507936],[-1.1182657,2.4914913,5.1292238],[-1.1218141,2.4914994,5.2673125],[-1.1078054,2.8767397,5.1902738],[-1.1389784,2.8846903,5.0498953],[-1.1532372,2.4925833,5.128325],[-1.1567855,2.4925914,5.2664137],[-1.1427768,2.8778317,5.1893749],[-1.1602579,2.8640876,5.0740199],[-1.173018,2.5131986,5.1442051],[-1.1755183,2.5132043,5.2415104],[-1.1629347,2.8592544,5.1723089]],"bolts":4},
|
||||
"Torso.Belt2.R": {"solid":[[1.1590292,1.5553447,5.5067554],[1.15233,1.5553447,5.2253861],[1.1790659,2.2654498,5.0989141],[1.1857651,2.2654498,5.3802838],[1.1235993,1.5218399,5.5493498],[1.1152079,1.5218399,5.1969128],[1.144577,2.3018837,5.0579844],[1.1529684,2.3018837,5.4104218],[1.0393271,1.5487978,5.5366302],[1.0314392,1.5487978,5.2053394],[1.0590461,2.2820389,5.0747471],[1.0669341,2.2820389,5.4060378]],"facets":10,"panels":[[1.161463,2.1963477,5.3221474],[1.1399935,1.62612,5.4237065],[1.1366785,1.6261201,5.2844734],[1.1581479,2.1963477,5.1829138],[1.2213935,2.1938372,5.3207207],[1.199924,1.6236094,5.4222798],[1.196609,1.6236095,5.2830462],[1.2180784,2.1938372,5.1814871],[1.2401345,2.1730177,5.3034987],[1.2201698,1.642755,5.3979402],[1.2178216,1.6427552,5.2993169],[1.2377863,2.1730177,5.2048755]],"bolts":4},
|
||||
"Torso.Belt2.L": {"solid":[[-1.1857651,2.2654498,5.3802838],[-1.1790659,2.2654498,5.0989141],[-1.15233,1.5553447,5.2253861],[-1.1590292,1.5553447,5.5067554],[-1.1529684,2.3018837,5.4104218],[-1.144577,2.3018837,5.0579844],[-1.1152079,1.5218399,5.1969128],[-1.1235993,1.5218399,5.5493498],[-1.0669341,2.2820389,5.4060383],[-1.0590461,2.2820389,5.0747471],[-1.0314392,1.5487978,5.2053394],[-1.0393271,1.5487978,5.5366302]],"facets":10,"panels":[[-1.1366785,1.62612,5.2844734],[-1.1399935,1.62612,5.4237065],[-1.161463,2.1963477,5.3221474],[-1.1581479,2.1963477,5.1829138],[-1.1716379,1.6246555,5.2836409],[-1.174953,1.6246555,5.422874],[-1.1964225,2.1948833,5.3213153],[-1.1931074,2.1948833,5.1820812],[-1.1928506,1.6438012,5.2999115],[-1.1951988,1.6438012,5.3985343],[-1.2151635,2.1740639,5.3040934],[-1.2128153,2.1740639,5.2054701]],"bolts":4},
|
||||
"Torso.Belt3.R": {"solid":[[1.0221877,0.7020862,5.6781473],[1.0325204,0.81351,5.3773651],[1.1108152,1.3995476,5.2550621],[1.1154573,1.3998268,5.5356541],[0.9808402,0.6525131,5.7254996],[0.9938226,0.7925092,5.3475885],[1.0801847,1.4389318,5.2126832],[1.0860105,1.4392823,5.5648246],[0.9098068,0.6883913,5.7109475],[0.9220102,0.8199875,5.355711],[1.0031906,1.4276248,5.2289],[1.0086669,1.4279542,5.5599132]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Belt3.L": {"solid":[[-1.1154573,1.3998268,5.5356541],[-1.1108152,1.3995476,5.2550621],[-1.0325204,0.81351,5.3773651],[-1.0221877,0.7020862,5.6781473],[-1.0860105,1.4392823,5.5648246],[-1.0801847,1.4389318,5.2126832],[-0.9938226,0.7925092,5.3475885],[-0.9808403,0.6525132,5.7254992],[-1.0086669,1.4279542,5.5599132],[-1.0031906,1.4276248,5.2289],[-0.9220102,0.8199875,5.355711],[-0.9098068,0.6883913,5.7109475]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Lip1.R": {"solid":[[1.0201858,2.4545801,4.9563909],[0.7262938,2.4538357,4.8369279],[0.6996334,3.2962456,4.6738377],[0.9670646,3.2954555,4.7828097],[1.0420594,2.4259324,5.0087824],[0.6817942,2.4250197,4.8623395],[0.6529431,3.3366497,4.6858482],[0.9845879,3.33567,4.8209863],[1.0132276,2.4606547,5.0400338],[0.6745782,2.4597969,4.9023776],[0.6474582,3.3167291,4.7364755],[0.9592044,3.3158081,4.8635054]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Lip1.L": {"solid":[[-0.9670646,3.2954555,4.7828097],[-0.6996334,3.2962456,4.6738377],[-0.7262938,2.4538357,4.8369279],[-1.0201858,2.4545801,4.9563909],[-0.9845879,3.33567,4.8209863],[-0.652943,3.3366497,4.6858482],[-0.6817942,2.4250197,4.8623395],[-1.0420594,2.4259324,5.0087824],[-0.9592044,3.3158081,4.8635054],[-0.6474582,3.3167291,4.7364755],[-0.6745782,2.4597969,4.9023776],[-1.0132276,2.4606547,5.0400338]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Lip2.R": {"solid":[[0.9911727,1.3502163,5.1321969],[0.7006019,1.3504183,5.0175533],[0.7322098,2.2920723,4.8499608],[1.0295374,2.2922714,4.9671926],[1.0096952,1.3218635,5.1831384],[0.6542254,1.3221107,5.0428891],[0.6881451,2.3326383,4.8630385],[1.0508684,2.3328812,5.0060549],[0.9839019,1.360075,5.2147918],[0.6497603,1.3603073,5.0829573],[0.6816448,2.3102033,4.9138975],[1.0226047,2.3104317,5.0483332]],"facets":10,"panels":[[0.9216167,1.4226836,5.1127429],[0.7608439,1.4227954,5.0493107],[0.7878281,2.226702,4.9062343],[0.9543645,2.2268133,4.9718971],[0.9342599,1.416554,5.080687],[0.7734872,1.4166658,5.0172548],[0.8004714,2.2205722,4.8741784],[0.9670078,2.2206838,4.9398413],[0.9236757,1.4327556,5.0515776],[0.799988,1.4328415,5.0027776],[0.8256512,2.1973917,4.8667054],[0.9548187,2.1974781,4.917634]],"bolts":4},
|
||||
"Torso.Lip2.L": {"solid":[[-1.0295374,2.2922711,4.9671926],[-0.7322098,2.2920723,4.8499608],[-0.7006019,1.3504183,5.0175533],[-0.9911727,1.3502163,5.1321969],[-1.0508684,2.3328812,5.0060549],[-0.6881451,2.3326383,4.8630385],[-0.6542254,1.3221107,5.0428891],[-1.0096952,1.3218635,5.1831384],[-1.0226047,2.3104315,5.0483332],[-0.6816448,2.3102033,4.9138975],[-0.6497603,1.3603073,5.0829573],[-0.9839019,1.360075,5.2147918]],"facets":10,"panels":[[-0.9216166,1.4226835,5.1127429],[-0.9543644,2.2268131,4.9718971],[-0.7878281,2.2267017,4.9062343],[-0.7608438,1.4227953,5.0493107],[-0.9432907,1.4121755,5.0577903],[-0.9760386,2.2163053,4.916944],[-0.8095022,2.2161939,4.8512812],[-0.7825179,1.4122874,4.9943581],[-0.9327064,1.4283772,5.0286808],[-0.9638494,2.1930995,4.8947372],[-0.834682,2.1930132,4.8438082],[-0.8090188,1.4284631,4.9798803]],"bolts":4},
|
||||
"Torso.Lip3.R": {"solid":[[0.8676552,0.5484633,5.3409948],[0.629285,0.5507765,5.2378912],[0.6864839,1.1930634,5.0655351],[0.9688227,1.1951368,5.1861811],[0.8812362,0.5239664,5.3939147],[0.5808482,0.5268815,5.2639861],[0.6439989,1.2360016,5.0736952],[0.9930302,1.2385647,5.2228398],[0.8577532,0.5576117,5.4243941],[0.5753885,0.5603519,5.3022614],[0.6347501,1.2269248,5.1233878],[0.9628395,1.2293341,5.2635837]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Lip3.L": {"solid":[[-0.9688227,1.1951368,5.1861811],[-0.6864839,1.1930634,5.0655351],[-0.629285,0.5507765,5.2378912],[-0.8676552,0.5484633,5.3409948],[-0.9930302,1.2385647,5.2228398],[-0.6439989,1.2360016,5.0736952],[-0.5808482,0.5268815,5.2639861],[-0.8812362,0.5239664,5.3939147],[-0.9628395,1.2293341,5.2635837],[-0.6347501,1.2269248,5.1233878],[-0.5753885,0.5603519,5.3022614],[-0.8577532,0.5576117,5.4243941]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Hood1D.R": {"solid":[[0.12437,-0.5841965,6.4268317],[0.3345847,-0.5832529,6.3944097],[0.4716979,0.3567483,6.2592425],[0.1423651,0.3574846,6.3097682],[0.0838059,-0.6232779,6.4021449],[0.3593167,-0.6220412,6.3596516],[0.5065353,0.3872391,6.2145228],[0.1031336,0.388141,6.276412],[0.0832575,-0.6018638,6.3232055],[0.3422377,-0.6007013,6.2832618],[0.4806232,0.3480221,6.1468406],[0.1014256,0.3488699,6.2050166]],"facets":10,"panels":[[0.3884488,0.2850463,6.2603598],[0.2072538,0.2854514,6.2881584],[0.1919241,-0.5167541,6.3878837],[0.2715463,-0.5163967,6.3756032],[0.3974983,0.2921931,6.3192415],[0.2163033,0.2925983,6.3470402],[0.2009735,-0.5096073,6.4467649],[0.2805958,-0.5092499,6.4344845],[0.3775912,0.2747698,6.3447957],[0.2387213,0.2750803,6.3661008],[0.224153,-0.4872751,6.4608717],[0.2664632,-0.4870851,6.4543462]],"bolts":4},
|
||||
"Torso.Hood1D.L": {"solid":[[-0.1423651,0.3574846,6.3097682],[-0.4716979,0.3567483,6.2592425],[-0.3345847,-0.5832529,6.3944097],[-0.12437,-0.5841965,6.4268317],[-0.1031336,0.388141,6.276412],[-0.5065353,0.3872391,6.2145228],[-0.3593167,-0.6220412,6.3596516],[-0.0838059,-0.6232779,6.4021449],[-0.1014256,0.3488699,6.2050166],[-0.4806232,0.3480221,6.1468406],[-0.3422377,-0.6007013,6.2832618],[-0.0832575,-0.6018638,6.3232055]],"facets":10,"panels":[[-0.1919241,-0.516754,6.3878837],[-0.2072538,0.2854515,6.2881584],[-0.3884487,0.2850464,6.2603598],[-0.2715462,-0.5163966,6.3756032],[-0.1972029,-0.512585,6.4222312],[-0.2125326,0.2896205,6.322506],[-0.3937276,0.2892154,6.2947073],[-0.2768251,-0.5122277,6.4099507],[-0.2203824,-0.4902529,6.4363379],[-0.2349506,0.2721025,6.341567],[-0.3738205,0.2717921,6.3202615],[-0.2626925,-0.490063,6.4298124]],"bolts":4},
|
||||
"Torso.Hood1F.R": {"solid":[[0.4889922,-0.6167604,6.2126741],[0.6078163,-0.6218183,5.8866138],[0.9811482,0.6417188,5.4644799],[0.7089781,0.487129,6.133101],[0.4376203,-0.6451254,6.2363691],[0.5786441,-0.6511283,5.8493915],[0.9770675,0.6957217,5.3981285],[0.6700795,0.5213558,6.1522841],[0.3732574,-0.5951188,6.1853604],[0.5058198,-0.6007615,5.8216019],[0.8803378,0.6652775,5.3974147],[0.5917692,0.5013735,6.1063209]],"facets":11,"panels":[[0.6432545,0.1313842,6.0858674],[0.5083398,-0.5456179,6.1346684],[0.5838301,-0.5488312,5.9275188],[0.7427546,-0.0109527,5.7478194],[0.6988522,0.1217758,6.1062775],[0.5639374,-0.5552263,6.1550784],[0.6394277,-0.5584396,5.9479289],[0.7983524,-0.0205611,5.76823],[0.7187667,0.0906101,6.0961523],[0.5932928,-0.5390178,6.1415386],[0.6564021,-0.5417041,5.9683633],[0.8062518,-0.0345391,5.7989254],[0.7033786,0.4330879,6.0641189],[0.6795222,0.3133766,6.0727487],[0.7913266,0.1534384,5.6928978],[0.9083525,0.5495109,5.5605745],[0.7358106,0.427483,6.076025],[0.7119542,0.3077717,6.0846543],[0.8237587,0.1478335,5.7048035],[0.9407845,0.543906,5.5724802],[0.7580383,0.4079248,6.065063],[0.7399283,0.3170487,6.0716138],[0.8424519,0.1703869,5.7232943],[0.9438132,0.513443,5.6086831]],"bolts":8},
|
||||
"Torso.Hood1F.L": {"solid":[[-0.7089781,0.487129,6.133101],[-0.9811482,0.6417188,5.4644799],[-0.6078163,-0.6218184,5.8866138],[-0.4889922,-0.6167604,6.2126741],[-0.6700795,0.5213558,6.1522841],[-0.9770675,0.6957217,5.3981285],[-0.5786441,-0.6511284,5.8493915],[-0.4376203,-0.6451254,6.2363691],[-0.5917692,0.5013735,6.1063209],[-0.8803378,0.6652775,5.3974147],[-0.5058198,-0.6007615,5.8216019],[-0.3732574,-0.5951188,6.1853604]],"facets":11,"panels":[[-0.7033787,0.4330879,6.0641189],[-0.9083524,0.5495109,5.5605745],[-0.7575487,0.0391177,5.7310915],[-0.654301,0.1868157,6.0818715],[-0.7589764,0.4234796,6.0845289],[-0.9639502,0.5399025,5.5809851],[-0.8131465,0.0295093,5.751502],[-0.7098987,0.1772073,6.1022816],[-0.7812041,0.4039214,6.0735674],[-0.9669788,0.5094395,5.617188],[-0.8318397,0.0520627,5.7699924],[-0.7378727,0.1864843,6.089241],[-0.7089766,-0.1252735,5.7860131],[-0.5838298,-0.5488313,5.9275193],[-0.5083395,-0.5456179,6.1346688],[-0.6180329,0.0048233,6.0949907],[-0.7414086,-0.1308784,5.7979188],[-0.6162618,-0.5544362,5.939425],[-0.5407715,-0.5512229,6.146575],[-0.6504649,-0.0007816,6.1068964],[-0.7493081,-0.1448564,5.8286147],[-0.6332361,-0.5377007,5.9598594],[-0.5701269,-0.5350143,6.1330347],[-0.6703794,-0.0319473,6.0967712]],"bolts":8},
|
||||
"Torso.Hood2D.R": {"solid":[[0.1169894,-1.4431006,6.374145],[0.2846297,-1.4431865,6.3402987],[0.3272185,-0.6630456,6.3564939],[0.1229361,-0.6631249,6.3977323],[0.0754922,-1.4769762,6.3457222],[0.3101459,-1.4770966,6.2983465],[0.3565559,-0.6269588,6.3159947],[0.0819721,-0.6270654,6.3714247],[0.0704687,-1.4494553,6.2812676],[0.2910432,-1.4495684,6.2367344],[0.3346686,-0.6504388,6.2533236],[0.0765598,-0.650539,6.3054276]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Hood2D.L": {"solid":[[-0.1229361,-0.6631249,6.3977323],[-0.3272185,-0.6630456,6.3564939],[-0.2846297,-1.4431865,6.3402987],[-0.1169894,-1.4431006,6.374145],[-0.0819721,-0.6270654,6.3714247],[-0.3565559,-0.6269588,6.3159947],[-0.3101459,-1.4770966,6.2983465],[-0.0754922,-1.4769762,6.3457222],[-0.0765598,-0.650539,6.3054276],[-0.3346686,-0.6504388,6.2533236],[-0.2910432,-1.4495684,6.2367344],[-0.0704687,-1.4494553,6.2812676]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Hood2F.R": {"solid":[[0.4256355,-1.4462472,6.1845303],[0.4919126,-1.4467067,5.924593],[0.5590963,-0.6859823,5.8780618],[0.4755452,-0.6863772,6.2054691],[0.3808642,-1.4786416,6.2088552],[0.4636741,-1.4792155,5.8840771],[0.5370334,-0.6485647,5.8332686],[0.4353537,-0.6490453,6.2317157],[0.3127733,-1.4484841,6.1801996],[0.3906146,-1.4490235,5.874908],[0.4595724,-0.6682117,5.827148],[0.3639935,-0.6686635,6.2016883]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Hood2F.L": {"solid":[[-0.4755452,-0.6863772,6.2054691],[-0.5590963,-0.6859823,5.8780618],[-0.4919126,-1.4467067,5.924593],[-0.4256355,-1.4462472,6.1845303],[-0.4353537,-0.6490453,6.2317157],[-0.5370334,-0.6485647,5.8332686],[-0.4636741,-1.4792155,5.8840771],[-0.3808642,-1.4786416,6.2088552],[-0.3639935,-0.6686635,6.2016883],[-0.4595724,-0.6682117,5.827148],[-0.3906146,-1.4490235,5.874908],[-0.3127733,-1.4484841,6.1801996]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Hood3D.R": {"solid":[[0.1032437,-2.2453222,6.2714987],[0.2205016,-2.2456303,6.2435641],[0.2724218,-1.5248752,6.2962074],[0.1108723,-1.5251584,6.33463],[0.0607521,-2.277041,6.2426353],[0.244008,-2.2775223,6.1989779],[0.3009622,-1.4868872,6.2567248],[0.0691178,-1.4872937,6.3118663],[0.0545442,-2.2485428,6.1899295],[0.2268047,-2.2489953,6.1488914],[0.2803416,-1.5057983,6.2031736],[0.0624079,-1.5061804,6.2550068]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Hood3D.L": {"solid":[[-0.1108722,-1.5251584,6.33463],[-0.2724218,-1.5248752,6.2962074],[-0.2205016,-2.2456303,6.2435641],[-0.1032437,-2.2453222,6.2714987],[-0.0691178,-1.4872937,6.3118663],[-0.3009622,-1.4868872,6.2567248],[-0.244008,-2.2775223,6.1989779],[-0.0607521,-2.277041,6.2426353],[-0.0624079,-1.5061804,6.2550068],[-0.2803416,-1.5057983,6.2031736],[-0.2268047,-2.2489953,6.1488914],[-0.0545442,-2.2485428,6.1899295]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Hood3F.R": {"solid":[[0.3368095,-2.2442985,6.1210251],[0.3540591,-2.2438414,6.0513573],[0.4430484,-1.5238899,5.9266953],[0.3822896,-1.5235535,6.1727257],[0.2923129,-2.2766652,6.144166],[0.3244511,-2.2758133,6.0143657],[0.4220367,-1.4863158,5.8776622],[0.3422129,-1.4858738,6.2008915],[0.2325801,-2.2478509,6.1235294],[0.2627901,-2.24705,6.0015173],[0.3545205,-1.5049223,5.8730159],[0.2794862,-1.5045068,6.1768513]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.Hood3F.L": {"solid":[[-0.3822896,-1.5235535,6.1727257],[-0.4430485,-1.5238899,5.9266953],[-0.3540591,-2.2438414,6.0513573],[-0.3368095,-2.2442985,6.1210251],[-0.3422129,-1.4858738,6.2008915],[-0.4220367,-1.4863158,5.8776622],[-0.3244511,-2.2758133,6.0143661],[-0.2923129,-2.2766652,6.144166],[-0.2794861,-1.5045068,6.1768513],[-0.3545205,-1.5049223,5.8730159],[-0.2627901,-2.24705,6.0015173],[-0.2325801,-2.2478509,6.1235294]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.HoodLip.R": {"solid":[[0.3319675,-2.1517057,5.8672805],[0.2972293,-2.1460621,5.8425512],[0.6060616,0.3312727,5.2865472],[0.7946815,0.3373919,5.4095373],[0.3353004,-2.1816168,5.9219961],[0.2456244,-2.1670485,5.8581576],[0.5622626,0.3729025,5.2881007],[0.8116803,0.380994,5.4507341],[0.3257884,-2.0959625,5.932734],[0.241493,-2.0822682,5.872726],[0.5391329,0.3052856,5.3368726],[0.7735855,0.3128915,5.4897475]],"facets":10,"panels":[],"bolts":0},
|
||||
"Torso.HoodLip.L": {"solid":[[-0.7946815,0.3373919,5.4095373],[-0.6060616,0.3312727,5.2865472],[-0.2972293,-2.1460621,5.8425512],[-0.3319675,-2.1517057,5.8672805],[-0.8116803,0.380994,5.4507341],[-0.5622626,0.3729025,5.2881007],[-0.2456244,-2.1670485,5.8581576],[-0.3353004,-2.1816168,5.9219961],[-0.7735855,0.3128915,5.4897475],[-0.5391329,0.3052856,5.3368726],[-0.241493,-2.0822682,5.872726],[-0.3257884,-2.0959625,5.932734]],"facets":10,"panels":[],"bolts":0}
|
||||
}}
|
||||
]}
|
||||
BIN
surfaces/blender/tests/fixtures/ram_meshes.npz
vendored
Normal file
BIN
surfaces/blender/tests/fixtures/ram_meshes.npz
vendored
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
1
surfaces/blender/tests/fixtures/raptor_plates.json
vendored
Normal file
1
surfaces/blender/tests/fixtures/raptor_plates.json
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"note":"RAPTOR (sheet 38): the hull plate that bears the 27, its four corners marked by eye in the hero (the right flank) and in the SIDE view (the left flank, so side -1), with the nose's front face and the two laser emitters. Coordinates are the hull's (raptor_form.SHEET at 3ced828: x right, y forward of the sheet's hip column, z up). side is raptor_form.SHEET.camera(), square-on at the sheet's 28.6 px a metre. world gives each mark's (y, z) off the SIDE view and its x from the hull's mass (the nose 0, the emitters +-0.56, a plate corner the flank's half-width at its station and height): hero is brokkr_reference.core.solve(world, pixels, box, model rolled, lens 50). The seven marks admit no camera under 21.8 px rms (left-out 44 px, lens not determined; 25.1 px at 50 mm): the sheet's two views do not draw one rigid hull, and four of the seven marks are the plate's own corners. What block_plate gives through these cameras is two views agreeing on a plate, not a measured accuracy: there is no truth for this plate.","cameras":{"hero":{"C":[11.303769012415719,10.50084330876064,1.6426541643628032],"R":[[-0.5899084170655855,0.7870428136060581,0.1804762284242304],[0.1745987487019839,-0.09389198835577137,0.9801528306719831],[0.7883675135537211,0.6097113284773865,-0.08202901620441301]],"f":944.4444444444445,"c":[400.0,320.0]},"side":{"C":[-400.0,0.0,0.0],"R":[[0.0,-1.0,0.0],[0.0,0.0,1.0],[-1.0,0.0,0.0]],"f":11441.176470588236,"c":[348.5,849.5]}},"box":[60,0,740,640],"world":{"nose":[0.0,5.681233933161954,4.038046272493573],"emitter_r":[0.56,4.96452442159383,3.7583547557840613],"emitter_l":[-0.56,4.96452442159383,3.7583547557840613],"p_ft":[0.6753672831185238,4.14293059125964,5.4365038560411305],"p_fb":[1.0477429305912596,4.317737789203084,4.632390745501285],"p_rb":[1.2748071979434448,3.0940874035989716,4.80719794344473],"p_rt":[1.282382176520994,3.0241645244215936,5.576349614395887]},"pixels":{"nose":[683,250],"emitter_r":[557,273],"emitter_l":[617,283],"p_ft":[500,120],"p_fb":[539,183],"p_rb":[461,184],"p_rt":[459,108]},"plate":{"corners":["p_ft","p_fb","p_rb","p_rt"]},"traces":[{"view":"hero","from":"p_ft","to":"p_fb","side":1,"line":[[500,120],[539,183]]},{"view":"side","from":"p_ft","to":"p_fb","side":-1,"line":[[230,694],[225,717]]},{"view":"hero","from":"p_fb","to":"p_rb","side":1,"line":[[539,183],[461,184]]},{"view":"side","from":"p_fb","to":"p_rb","side":-1,"line":[[225,717],[260,712]]},{"view":"hero","from":"p_rb","to":"p_rt","side":1,"line":[[461,184],[459,108]]},{"view":"side","from":"p_rb","to":"p_rt","side":-1,"line":[[260,712],[262,690]]},{"view":"hero","from":"p_rt","to":"p_ft","side":1,"line":[[459,108],[500,120]]},{"view":"side","from":"p_rt","to":"p_ft","side":-1,"line":[[262,690],[230,694]]}]}
|
||||
1
surfaces/blender/tests/fixtures/spectre_plates.json
vendored
Normal file
1
surfaces/blender/tests/fixtures/spectre_plates.json
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"note":"SPECTRE's roof and cheek as plates. Cameras: spectre_skel.cameras() at nibu/fable-spectre-2 74fc241, solved by this repo's brokkr_reference.core; frames: the hull pitched about the waist by spectre_skel.PITCH (hero 3 degrees, side 0). Traces marked hand are spectre_skel.TRACES (roof brow and ridge, cheek chine); a trace marked fitted-edge is the straight edge between two vertices of spectre_fits.json's fitted cage drawn through the camera, standing in for a side nobody traced, so the outline closes. reference is spectre_fits.json's fitted cage along the traced runs: a fit from a hand blocking, not ground truth.","cameras":{"hero":{"C":[-9.721115556958573,18.859090658741355,5.242272804029844],"R":[[-0.862189601405842,-0.5065857195259607,0.0],[0.034125232508362004,-0.05807984607580026,0.9977285201827507],[-0.5054350202883507,0.8602311551276064,0.06736319480204615]],"f":1785.0,"c":[378.0,353.0]},"side":{"C":[60.84416742645475,1.422308134553987,3.13474760877321],"R":[[3.061616997868383e-16,1.0,0.0],[0.011634411213376642,-3.5620111131064444e-18,0.9999323179474289],[0.9999323179474289,-3.0614097813457806e-16,-0.011634411213376642]],"f":2200.0,"c":[892.0,532.0]}},"frames":{"hero":[[1.0,0.0,0.0,0.0],[0.0,0.9986295347545738,0.052335956242943835,-0.2773805680876023],[0.0,-0.052335956242943835,0.9986295347545738,0.007263465800758873],[0.0,0.0,0.0,1.0]],"side":[[1.0,0.0,0.0,0.0],[0.0,1.0,0.0,0.0],[0.0,-0.0,1.0,0.0],[0.0,0.0,0.0,1.0]]},"plates":{"roof":{"plate":{"corners":["ridge_rear","nose","brow_rear"],"mirror":true,"seam":["ridge_rear","nose"]},"traces":[{"view":"side","from":"ridge_rear","to":"nose","side":1,"line":[[883,400],[898,408],[930,426],[958,441]],"source":"hand"},{"view":"hero","from":"brow_rear","to":"nose","side":-1,"line":[[487,47],[443,92],[427,126],[400,128],[360,135],[325,142]],"source":"hand"},{"view":"side","from":"brow_rear","to":"nose","side":1,"line":[[883,404],[900.7,413.6],[919,423.6],[938.6,436.4],[958.6,443]],"source":"hand"},{"view":"hero","from":"brow_rear","to":"ridge_rear","side":-1,"line":[[487.1,47.1],[424.7,35.3]],"source":"fitted-edge"},{"view":"side","from":"brow_rear","to":"ridge_rear","side":1,"line":[[883.0,404.1],[883.0,399.9]],"source":"fitted-edge"}],"reference":{"ridge":[[0.0,1.173941,7.498167],[0.0,2.063931,7.015758],[0.0,2.624251,6.687296],[0.0,3.079302,6.461668],[0.0,3.280227,6.334663]],"brow":[[0.776479,1.177565,7.327593],[0.653669,2.30313,6.743599],[0.929821,2.609515,6.428508],[0.197231,2.908778,6.436474],[0.0,3.280227,6.334663]]}},"cheek":{"plate":{"corners":["chine_rear","jaw","chin"],"mirror":true,"seam":["jaw","chin"]},"traces":[{"view":"hero","from":"chine_rear","to":"jaw","side":-1,"line":[[472,169],[438,180],[390,170],[312,182]],"source":"hand"},{"view":"side","from":"chine_rear","to":"jaw","side":1,"line":[[919,447],[945,456.5],[961,459]],"source":"hand"},{"view":"side","from":"jaw","to":"chin","side":1,"line":[[965.6,456.7],[957.7,463.1]],"source":"fitted-edge"},{"view":"hero","from":"chin","to":"chine_rear","side":-1,"line":[[331.3,199.5],[472.1,167.8]],"source":"fitted-edge"},{"view":"side","from":"chin","to":"chine_rear","side":1,"line":[[957.7,463.1],[921.1,451.0]],"source":"fitted-edge"}],"reference":{"chine":[[1.097992,2.211844,6.0315],[0.924701,2.658187,5.897007],[0.340462,2.978516,6.057156],[0.0,3.458134,5.926945]]}}}}
|
||||
1
surfaces/blender/tests/fixtures/spectre_truth.json
vendored
Normal file
1
surfaces/blender/tests/fixtures/spectre_truth.json
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -518,6 +518,7 @@
|
|||
"brokkr_kitbash.joint",
|
||||
"brokkr_kitbash.slide",
|
||||
"brokkr_kitbash.joints",
|
||||
"brokkr_kitbash.follow",
|
||||
"brokkr_kitbash.close",
|
||||
"brokkr_kitbash.boolean",
|
||||
"brokkr_kitbash.cut",
|
||||
|
|
|
|||
669
surfaces/blender/tests/live/kitbash_follows.py
Normal file
669
surfaces/blender/tests/live/kitbash_follows.py
Normal file
|
|
@ -0,0 +1,669 @@
|
|||
"""Live proof, in a background Blender, of brokkr_kitbash followers through run_intent: brokkr_kitbash.follow states a
|
||||
ratio or a loop, posing a driver derives every follower in the same action (core.close_loop for a loop), a follower
|
||||
refuses to be posed, brokkr.joints version 2 marks driven rows and pages, and each refusal changes nothing. Not part of
|
||||
the unittest run: it needs Blender.
|
||||
|
||||
blender --background --factory-startup --python-exit-code 1 --python surfaces/blender/tests/live/kitbash_follows.py -- <out>
|
||||
|
||||
Run it with private BLENDER_USER_CONFIG, BLENDER_USER_EXTENSIONS and BLENDER_USER_SCRIPTS directories (it refuses
|
||||
without them). <out> is an absolute path; writes <out>.result.json and exits 1 when a check failed. The checks run
|
||||
inside one try: an uncaught error is a failed check that names the check before it.
|
||||
|
||||
The scene, every strut 0.09 wide so its pins take a ram's: a four-bar (Crank on the root Ground, Rocker on the root
|
||||
Base, Coupler closing on the crank); a ram (A_Barrel on the root Pad, A_Rod in its bore, closing on the rocker), named
|
||||
to sort before the four-bar it waits on; ratio followers of the crank (Cap, Pinion, and X_Rod's slide in X_Barrel); a
|
||||
torque link (T_Rod sliding in the root T_Barrel, T_Upper and T_Lower closing on T_Lug, a strut on the rod's
|
||||
rod_end_back held at 90 degrees by limits of that one value. A real torque link exists to stop the rod rolling in its
|
||||
barrel, so a lug with no travel is the mechanism and not a way around the kit; and a strut's two pins face one way, so
|
||||
two arms from the barrel's pin cannot face the rod's own); a second crank (Crank2 on the root Ground2)
|
||||
whose ram closes on the rocker, and a loop hung from its own driver (K3, B3, Rk3, Cp3 on the root G3), for the
|
||||
one-driver refusals at the statement, and after it an attach, a clear, widened limits, a pose over limits written by hand and a
|
||||
detach that would each give a stated loop a second driver, and the reads that tell of one made by hand (follows.holds, the joints report's manyDrivers); Idle and Tip for the refusals and for the writes a two-driver loop does not refuse; a tree of 264 struts with 62-character names for a joints
|
||||
report over several receipts. Bounds follow lodur:ruling:deterministic-bound-margin, both readings beside each; the
|
||||
result file carries the readings.
|
||||
"""
|
||||
import importlib.util
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import traceback
|
||||
import types
|
||||
from pathlib import Path
|
||||
|
||||
import bpy
|
||||
import numpy as np
|
||||
from mathutils import Matrix
|
||||
|
||||
SURFACE = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(SURFACE / "tools"))
|
||||
import private_dirs # noqa: E402
|
||||
|
||||
_refused = private_dirs.refusal(os.environ, os.path.expanduser("~"), lambda kind: bpy.utils.user_resource(kind))
|
||||
if _refused:
|
||||
raise SystemExit(_refused)
|
||||
OUT = sys.argv[sys.argv.index("--") + 1]
|
||||
if not Path(OUT).is_absolute():
|
||||
raise SystemExit(f"{OUT!r} is not an absolute path")
|
||||
package = types.ModuleType("brokkr_bridge")
|
||||
package.__path__ = [str(SURFACE / "brokkr_bridge")]
|
||||
sys.modules["brokkr_bridge"] = package
|
||||
from brokkr_bridge import blender_target as bt # noqa: E402
|
||||
|
||||
import addon_utils # noqa: E402
|
||||
|
||||
spec = importlib.util.spec_from_file_location("brokkr_kitbash_core_reference", SURFACE / "brokkr_kitbash" / "core.py")
|
||||
core = importlib.util.module_from_spec(spec) # core as the unit tests load it: the frames every reading here is taken against
|
||||
spec.loader.exec_module(core)
|
||||
|
||||
sys.path.append(str(SURFACE))
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
for module in ("brokkr_mesh_polish", "brokkr_kitbash"):
|
||||
addon_utils.enable(module, default_set=True)
|
||||
target = bt.BrokkrBlenderTarget(bpy)
|
||||
WORK = Path(tempfile.mkdtemp(prefix="brokkr-kitbash-follows-"))
|
||||
target.configure_action_dirs("", str(WORK))
|
||||
target.reload_host_actions()
|
||||
R = {"blender": bpy.app.version_string, "checks": [], "hostErrors": target.host_actions()[1], "readings": {}}
|
||||
COUNT = [0]
|
||||
kit = core.load_kit("mechanical")
|
||||
# Each mutant's reading below is its least over the cases here that it changes; the shipped reading is the worst.
|
||||
# Metres (or a difference of unit vectors) between a loop's closing socket and the socket it closes on, read from the two
|
||||
# world matrices after a driver was posed; a rod's slide against this file's own solve reads against it too. Shipped
|
||||
# worst 6.4e-07 (float32 matrices); least claimed mutant 0.041 (F11, the ram solved before the four-bar whose rocker it
|
||||
# closes on, at the smallest turn here); separation 250 each side.
|
||||
CLOSED = 1.6e-4
|
||||
# Degrees between a loop follower's roll and the one this file solves by its own steps of core.close_loop from the rest
|
||||
# pose. Shipped worst 3.3e-05 (an action's roll is a float32 field); least claimed mutant 2.7 (F11 again: the barrel
|
||||
# aimed at where the rocker was); separation 290 each side.
|
||||
SOLVED = 9.4e-3
|
||||
# A ratio follower's roll in degrees or slide in metres against k x the driver's value + offset, read from the stored
|
||||
# values. Shipped 0: the same doubles. A rule, a double's rounding at these sizes (6e-14 at 360) with room; mutant R1
|
||||
# (the ratio taken from the driver's value before the pose) reads 0.09 on the crosshead's slide and 45 on the kneecap.
|
||||
RATIO = 1e-9
|
||||
ROT = [0.3, -0.2, 0.5] # the roots' rotation: no axis of the scene lines up with the world's
|
||||
D0, REST = 30.0, (-40.0, 70.0) # the four-bar at rest: the crank's roll, and the rocker's and coupler's
|
||||
RAM_REST = (200.0, 0.1) # the ram at rest: the barrel's roll and the rod's slide
|
||||
|
||||
|
||||
def check(name, ok, detail=None):
|
||||
try:
|
||||
json.dumps(detail, default=str)
|
||||
except TypeError:
|
||||
detail = repr(detail)
|
||||
R["checks"].append({"name": name, "ok": bool(ok), "detail": None if ok else detail})
|
||||
|
||||
|
||||
def reading(name, value):
|
||||
R["readings"][name] = max(R["readings"].get(name, 0.0), float(value))
|
||||
return float(value)
|
||||
|
||||
|
||||
def send(action, **fields):
|
||||
COUNT[0] += 1
|
||||
receipt = target.run_intent(bpy.context, {"commandId": f"live-{COUNT[0]}", "requestedBy": "test/driver", "action": action, **fields})
|
||||
result = None
|
||||
if receipt.get("hostResult"):
|
||||
try:
|
||||
result = json.loads(receipt["hostResult"])
|
||||
except ValueError:
|
||||
result = None
|
||||
if not action.endswith(("place_part", "attach")) or receipt["status"] != "accepted":
|
||||
print("SEND", action, receipt["status"], str(receipt["message"])[:300], flush=True)
|
||||
return receipt, result
|
||||
|
||||
|
||||
def place(name, part, params="", world=None):
|
||||
send("brokkr_kitbash.place_part", part=part, object_name=name, params=params)
|
||||
if world is not None:
|
||||
world = Matrix(np.asarray(world).tolist())
|
||||
send("setObjectTransform", targetObjectName=name, location=list(world.translation), rotationEuler=list(world.to_euler("XYZ")))
|
||||
return bpy.data.objects[name]
|
||||
|
||||
|
||||
def attach(name, socket_name, parent, parent_socket, roll=0.0):
|
||||
receipt, _ = send("brokkr_kitbash.attach", object_name=name, socket=socket_name, parent_name=parent, parent_socket=parent_socket, roll=roll)
|
||||
return receipt["status"] == "accepted"
|
||||
|
||||
|
||||
def socket(obj, name):
|
||||
built = core.build(core.part(kit, obj["kit_part"]), json.loads(obj["kit_params"]))
|
||||
return next(s for s in built.sockets if s["name"] == name)
|
||||
|
||||
|
||||
def world(obj):
|
||||
return np.array(obj.matrix_world, dtype=np.float64)
|
||||
|
||||
|
||||
def frame(obj, name):
|
||||
"""A socket's world frame, from the object's matrix_world and core's build of its stored params."""
|
||||
return world(obj) @ socket(obj, name)["matrix"]
|
||||
|
||||
|
||||
def apart(obj, name, other, other_name):
|
||||
"""How far two sockets stand from meeting as a pin, read from the scene: origins apart, or normals not opposed."""
|
||||
a, b = frame(obj, name), frame(other, other_name)
|
||||
return max(float(np.abs(a[:3, 3] - b[:3, 3]).max()), float(np.abs(a[:3, 2] + b[:3, 2]).max()))
|
||||
|
||||
|
||||
def connection(name):
|
||||
receipt, report = send("brokkr_kitbash.report", object_name=name)
|
||||
return report["parts"][0]["connection"] if report else {"error": receipt["message"]}
|
||||
|
||||
|
||||
def scene_state():
|
||||
return {o.name: (o.parent and o.parent.name, np.round(np.array(o.matrix_basis), 6).tolist(), np.round(np.array(o.matrix_parent_inverse), 6).tolist(), len(o.data.vertices),
|
||||
{k: repr(o[k]) for k in sorted(o.keys()) if k.startswith("kit_")}) for o in bpy.data.objects}
|
||||
|
||||
|
||||
def refused(label, action, fields, *expected):
|
||||
state = scene_state()
|
||||
receipt, _ = send(action, **fields)
|
||||
check(f"refused, scene unchanged: {label}", receipt["status"] != "accepted" and all(text in str(receipt["message"]) for text in expected) and scene_state() == state,
|
||||
[receipt["status"], receipt["message"], expected])
|
||||
|
||||
|
||||
def stepped(solve, seed, start, end, step):
|
||||
"""This file's own derivation: the loop's two values after the input goes from start to end in steps of at most `step`."""
|
||||
count = max(1, math.ceil(abs(end - start) / step))
|
||||
for index in range(1, count + 1):
|
||||
seed, _ = solve(start + (end - start) * index / count, seed)
|
||||
return seed
|
||||
|
||||
|
||||
def turned(a, b):
|
||||
return abs((a - b + 180.0) % 360.0 - 180.0)
|
||||
|
||||
|
||||
try:
|
||||
rows = [row["name"] for row in target.host_actions()[0] if row["name"].startswith("brokkr_kitbash.")]
|
||||
check("follow loads as a host action after joints, with no errors", not R["hostErrors"] and "brokkr_kitbash.joints" in rows
|
||||
and rows[rows.index("brokkr_kitbash.joints") + 1] == "brokkr_kitbash.follow", [R["hostErrors"], rows])
|
||||
|
||||
# --- the four-bar -----------------------------------------------------------------------------------------------------
|
||||
turn = np.eye(4)
|
||||
turn[:3, :3] = core._rotation([math.degrees(v) for v in ROT])
|
||||
turn[:3, 3] = [1.0, 2.0, 3.0]
|
||||
W = "width=0.09; "
|
||||
ground = place("Ground", "strut", W + "length=0.8", turn)
|
||||
crank, rocker, coupler = place("Crank", "strut", W + "length=0.5"), place("Rocker", "strut", W + "length=0.9"), place("Coupler", "strut", W + "length=0.7")
|
||||
attach("Crank", "end_a", "Ground", "end_a", D0)
|
||||
|
||||
def crank_pin(roll, name="end_b"):
|
||||
return world(ground) @ core.mate(socket(ground, "end_a"), socket(crank, "end_a"), roll) @ socket(crank, name)["matrix"]
|
||||
|
||||
def rocker_world(base_world, roll):
|
||||
return base_world @ core.mate(socket(ground, "end_a"), socket(rocker, "end_a"), roll)
|
||||
|
||||
end = rocker_world(turn, REST[0]) @ core.mate(socket(rocker, "end_b"), socket(coupler, "end_a"), REST[1]) @ socket(coupler, "end_b")["matrix"]
|
||||
shift = np.eye(4)
|
||||
shift[:3, 3] = crank_pin(D0)[:3, 3] - end[:3, 3]
|
||||
base = place("Base", "strut", W + "length=0.8", shift @ turn) # where the loop closes at rest
|
||||
attach("Rocker", "end_a", "Base", "end_a", REST[0])
|
||||
attach("Coupler", "end_a", "Rocker", "end_b", REST[1])
|
||||
receipt, report = send("brokkr_kitbash.close", object_name="Coupler", socket="end_b", other_name="Crank", other_socket="end_b")
|
||||
check("the four-bar stands closed at rest: crank on Ground, rocker on Base, the coupler's end closing on the crank's", receipt["status"] == "accepted"
|
||||
and report["closure"]["holds"] is True, [receipt["message"], report and report["closure"]])
|
||||
four_bar = [(socket(base, "end_a"), socket(rocker, "end_a"), "revolute"), (socket(rocker, "end_b"), socket(coupler, "end_a"), "revolute")]
|
||||
|
||||
def solve_four_bar(roll, seed):
|
||||
return core.close_loop(world(base), four_bar, socket(coupler, "end_b"), crank_pin(roll), seed)
|
||||
|
||||
# --- parts for the refusals ---------------------------------------------------------------------------------------------
|
||||
far = np.eye(4)
|
||||
far[:3, 3] = [0.0, -8.0, 0.0]
|
||||
place("Idle", "strut", W), place("Tip", "strut", W), place("Loose", "strut", W)
|
||||
attach("Idle", "end_a", "Ground", "end_b", 15.0)
|
||||
attach("Tip", "end_a", "Idle", "end_b", 0.0)
|
||||
tank = place("Tank", "tank", "radius=0.3; length=1.2")
|
||||
place("Brk", "bracket")
|
||||
attach("Brk", "mount", "Tank", "lug_b")
|
||||
loop = '{"driver": "Crank", "kind": "loop"}'
|
||||
refused("a loop whose two ends both stand still when the driver moves (F7)", "brokkr_kitbash.follow", {"object_name": "Coupler", "record": '{"driver": "Idle", "kind": "loop"}'},
|
||||
"'Base' (the base) and 'Crank' (closed on), neither moves with 'Idle'")
|
||||
place("G3", "strut", W + "length=0.8", far @ far @ far @ turn)
|
||||
k3, b3, rk3, cp3 = place("K3", "strut", W + "length=0.5"), place("B3", "strut", W + "length=0.8"), place("Rk3", "strut", W + "length=0.9"), place("Cp3", "strut", W + "length=0.7")
|
||||
attach("K3", "end_a", "G3", "end_a", 10.0)
|
||||
attach("B3", "end_a", "K3", "end_a_back", 0.0)
|
||||
hung = None
|
||||
for guess in ((g0, g1) for g0 in range(-180, 180, 45) for g1 in range(-180, 180, 45)): # a pose at which a rocker and coupler on B3 close on K3
|
||||
try:
|
||||
hung, _ = core.close_loop(world(b3), [(socket(b3, "end_b"), socket(rk3, "end_a"), "revolute"), (socket(rk3, "end_b_back"), socket(cp3, "end_a"), "revolute")],
|
||||
socket(cp3, "end_b"), frame(k3, "end_b"), (float(guess[0]), float(guess[1])))
|
||||
break
|
||||
except core.KitError:
|
||||
continue
|
||||
attach("Rk3", "end_a", "B3", "end_b", core._wrapped(hung[0]) if hung else 0.0)
|
||||
attach("Cp3", "end_a", "Rk3", "end_b_back", core._wrapped(hung[1]) if hung else 0.0)
|
||||
receipt, report = send("brokkr_kitbash.close", object_name="Cp3", socket="end_b", other_name="K3", other_socket="end_b")
|
||||
check("a loop whose base hangs from the part it closes on stands closed", hung is not None and receipt["status"] == "accepted" and report["closure"]["holds"] is True, [hung, receipt["message"]])
|
||||
refused("a loop whose two ends both move with the driver (F7, the other half)", "brokkr_kitbash.follow", {"object_name": "Cp3", "record": '{"driver": "K3", "kind": "loop"}'},
|
||||
"'B3' (the base) and 'K3' (closed on), both move with 'K3'")
|
||||
refused("a loop follower that states no closure", "brokkr_kitbash.follow", {"object_name": "Rocker", "record": loop}, "'Rocker' states no closure that holds")
|
||||
refused("a follower on a rigid connection", "brokkr_kitbash.follow", {"object_name": "Brk", "record": '{"driver": "Crank", "kind": "ratio", "k": 1, "offset": 0}'},
|
||||
"socket type 'mount' states no dof")
|
||||
refused("a follower that is not attached", "brokkr_kitbash.follow", {"object_name": "Loose", "record": loop}, "'Loose' (the follower) is not attached")
|
||||
refused("a part that follows itself", "brokkr_kitbash.follow", {"object_name": "Idle", "record": '{"driver": "Idle", "kind": "ratio", "k": 1, "offset": 0}'}, "'Idle' is the follower itself")
|
||||
refused("a driver below its follower", "brokkr_kitbash.follow", {"object_name": "Idle", "record": '{"driver": "Tip", "kind": "ratio", "k": 1, "offset": 0}'}, "'Tip' is below 'Idle'")
|
||||
for bad in ('{"driver": "Crank", "kind": "ratio", "k": 0, "offset": 0}', '{"driver": "Crank", "kind": "ratio", "k": 1}', '{"driver": "Crank", "kind": "gear"}',
|
||||
'{"driver": "Crank", "kind": "loop", "k": 1}', "[1, 2]", '{"a"'):
|
||||
refused(f"a record that is not one of the three shapes: {bad}", "brokkr_kitbash.follow", {"object_name": "Idle", "record": bad}, "record must be")
|
||||
refused("clearing a part that follows nothing", "brokkr_kitbash.follow", {"object_name": "Idle", "record": "null"}, "'Idle' follows nothing")
|
||||
|
||||
# --- a loop follows -----------------------------------------------------------------------------------------------------
|
||||
receipt, report = send("brokkr_kitbash.follow", object_name="Coupler", record=loop)
|
||||
rocker_row, coupler_row = connection("Rocker"), report["connection"] if report else None
|
||||
check("follow states the loop on the closing part and its parent, both following the crank, and the report lists them as written",
|
||||
receipt["status"] == "accepted" and [f["part"] for f in report["followers"]] == ["Rocker", "Coupler"]
|
||||
and coupler_row["follows"] == {"driver": "Crank", "kind": "loop", "k": None, "offset": None, "holds": True, "reason": None} == rocker_row["follows"]
|
||||
and json.loads(rocker["kit_follows"]) == {"kind": "loop"} == json.loads(coupler["kit_follows"]) and rocker["kit_follows_driver"] == crank == coupler["kit_follows_driver"],
|
||||
[receipt["message"], report and report.get("followers"), rocker_row, coupler_row])
|
||||
seed = REST
|
||||
for roll, label in ((75.0, "a 45 degree turn"), (150.0, "to 120 past rest"), (D0, "and back to rest"), (0.0, "30 the other way")):
|
||||
was = crank["kit_roll"]
|
||||
receipt, report = send("brokkr_kitbash.roll", object_name="Crank", roll=roll)
|
||||
seed = stepped(solve_four_bar, seed, was, roll, 5.0)
|
||||
ok = receipt["status"] == "accepted" and reading("closed", apart(coupler, "end_b", crank, "end_b")) < CLOSED
|
||||
ok = ok and max(reading("solved", turned(rocker["kit_roll"], seed[0])), reading("solved", turned(coupler["kit_roll"], seed[1]))) < SOLVED
|
||||
check(f"rolling the crank {label} moves rocker and coupler with it: the closure holds in the scene and the rolls are this file's own stepped solve",
|
||||
ok and [f["part"] for f in report["followers"]] == ["Rocker", "Coupler"] and report["closures"][0] == {"part": "Coupler", "to": "Crank", "holds": True}
|
||||
and connection("Rocker")["holds"] and connection("Coupler")["holds"], [receipt["message"], R["readings"], report and report.get("followers"), seed])
|
||||
refused("the crank driven past the loop's dead centre, naming the driver's value and the closing part", "brokkr_kitbash.roll", {"object_name": "Crank", "roll": -5.0},
|
||||
"'Crank' at -5: the loop 'Coupler' closes on 'Crank' ('Rocker' and 'Coupler' follow): the loop is at a dead centre", "nothing changed")
|
||||
send("brokkr_kitbash.roll", object_name="Crank", roll=-2.0) # beside the toggle: 32 back from rest
|
||||
seed = stepped(solve_four_bar, seed, 0.0, -2.0, 5.0)
|
||||
jump = None
|
||||
for roll in range(10, 151): # the nearest jump from here that one solve from the stated rolls does not survive: refused in the dead centre, or on the other branch
|
||||
direct = stepped(solve_four_bar, seed, -2.0, float(roll), 5.0)
|
||||
try:
|
||||
once, _ = solve_four_bar(float(roll), seed)
|
||||
except core.KitError:
|
||||
once = None
|
||||
if once is None or turned(once[0], direct[0]) > 1.0:
|
||||
jump = float(roll)
|
||||
break
|
||||
R["readings"]["jump"] = jump or 0.0
|
||||
receipt, report = send("brokkr_kitbash.roll", object_name="Crank", roll=jump or 47.0)
|
||||
seed = stepped(solve_four_bar, seed, -2.0, jump or 47.0, 5.0)
|
||||
check("a jump from beside the toggle that one solve from the stated rolls does not survive ends on the stepped answer, the branch the linkage is on (F2)",
|
||||
jump is not None and receipt["status"] == "accepted" and reading("solved", turned(rocker["kit_roll"], seed[0])) < SOLVED and reading("solved", turned(coupler["kit_roll"], seed[1])) < SOLVED
|
||||
and reading("closed", apart(coupler, "end_b", crank, "end_b")) < CLOSED, [jump, receipt["message"], rocker["kit_roll"], coupler["kit_roll"], seed])
|
||||
send("brokkr_kitbash.roll", object_name="Crank", roll=D0)
|
||||
seed = stepped(solve_four_bar, seed, jump or 47.0, D0, 5.0)
|
||||
|
||||
# --- followers are derived only ---------------------------------------------------------------------------------------
|
||||
for name in ("Rocker", "Coupler"):
|
||||
refused(f"roll on the follower {name}, naming its driver (F4)", "brokkr_kitbash.roll", {"object_name": name, "roll": 10.0}, f"{name!r} follows 'Crank' (loop): its value is derived")
|
||||
refused("aim on a follower", "brokkr_kitbash.aim", {"object_name": "Rocker", "axis": "+z", "direction_x": 1.0, "direction_y": 0.0, "direction_z": 0.0}, "'Rocker' follows 'Crank'")
|
||||
refused("reach on a follower", "brokkr_kitbash.reach", {"object_name": "Rocker", "socket": "end_b", "direction_x": 0.0, "direction_y": 0.0, "direction_z": 1.0, "height": 3.0}, "'Rocker' follows 'Crank'")
|
||||
was = rocker["kit_roll"]
|
||||
receipt, report = send("brokkr_kitbash.joint", object_name="Rocker", record='{"limits": [-100, 20], "mechanism": "rocker"}')
|
||||
check("joint on a follower states limits and a mechanism and keeps its derived value and its statement", receipt["status"] == "accepted" and rocker["kit_roll"] == was
|
||||
and report["connection"]["limits"] == [-100.0, 20.0] and report["connection"]["mechanism"] == "rocker" and report["connection"]["follows"]["holds"] is True,
|
||||
[receipt["message"], report and report["connection"]])
|
||||
refused("joint limits on a follower that do not hold its derived value", "brokkr_kitbash.joint", {"object_name": "Rocker", "record": '{"limits": [0, 20]}'}, "is outside the joint's limits")
|
||||
refused("a driver that is itself a follower", "brokkr_kitbash.follow", {"object_name": "Idle", "record": '{"driver": "Rocker", "kind": "ratio", "k": 1, "offset": 0}'},
|
||||
"'Rocker' is itself a follower")
|
||||
refused("a follower that drives another", "brokkr_kitbash.follow", {"object_name": "Crank", "record": '{"driver": "Idle", "kind": "ratio", "k": 1, "offset": 0}'},
|
||||
"'Crank' drives 'Coupler': a driver is never a follower")
|
||||
refused("a follower that already follows", "brokkr_kitbash.follow", {"object_name": "Coupler", "record": loop}, "'Rocker' already follows")
|
||||
refused("a closure stated by a loop's parent follower", "brokkr_kitbash.close", {"object_name": "Rocker", "socket": "end_a_back", "other_name": "Loose", "other_socket": "end_a"},
|
||||
"'Rocker' follows as the parent of a loop")
|
||||
|
||||
# --- ratios -----------------------------------------------------------------------------------------------------------------
|
||||
place("Cap", "strut", W), place("Pinion", "strut", W), place("X_Barrel", "ram_barrel"), place("X_Rod", "ram_rod")
|
||||
attach("Cap", "end_a", "Crank", "end_a_back", 0.0)
|
||||
attach("Pinion", "end_a", "Ground", "end_b_back", 0.0)
|
||||
attach("X_Barrel", "base", "Ground", "end_a_back", 90.0)
|
||||
attach("X_Rod", "piston", "X_Barrel", "bore", 0.0)
|
||||
cap, pinion, x_rod = (bpy.data.objects[name] for name in ("Cap", "Pinion", "X_Rod"))
|
||||
half = '{"driver": "Crank", "kind": "ratio", "k": 0.5, "offset": 0}'
|
||||
refused("a ratio whose driver states no limits (F3)", "brokkr_kitbash.follow", {"object_name": "Cap", "record": half}, "'Cap' follows it by ratio, and a ratio's driver states limits")
|
||||
send("brokkr_kitbash.joint", object_name="Crank", record='{"limits": [-2, 160], "mechanism": "crank"}')
|
||||
receipts = [send("brokkr_kitbash.follow", object_name="Cap", record=half), send("brokkr_kitbash.follow", object_name="Pinion", record='{"driver": "Crank", "kind": "ratio", "k": -3, "offset": 10}'),
|
||||
send("brokkr_kitbash.follow", object_name="X_Rod", record='{"driver": "Crank", "kind": "ratio", "k": 0.001, "offset": 0.02}')]
|
||||
|
||||
def ratios():
|
||||
at = crank["kit_roll"]
|
||||
return max(reading("ratio", turned(cap["kit_roll"], 0.5 * at)), reading("ratio", turned(pinion["kit_roll"], -3.0 * at + 10.0)), reading("ratio", abs(x_rod["kit_slide"] - (0.001 * at + 0.02))))
|
||||
|
||||
check("a kneecap at k 0.5, a pinion at k -3 and a crosshead's slide at 0.001 m a degree follow the crank at once: each is k x its roll + offset",
|
||||
all(receipt["status"] == "accepted" for receipt, _ in receipts) and ratios() < RATIO and abs(cap["kit_roll"] - 15.0) < RATIO and abs(x_rod["kit_slide"] - 0.05) < RATIO
|
||||
and [f["part"] for f in receipts[2][1]["followers"]] == ["Cap", "Pinion", "X_Rod", "Rocker", "Coupler"]
|
||||
and receipts[2][1]["connection"]["follows"] == {"driver": "Crank", "kind": "ratio", "k": 0.001, "offset": 0.02, "holds": True, "reason": None}
|
||||
and connection("X_Rod")["holds"] and connection("Cap")["holds"], [[r["message"] for r, _ in receipts], R["readings"], receipts[2][1] and receipts[2][1].get("followers")])
|
||||
receipt, report = send("brokkr_kitbash.roll", object_name="Crank", roll=120.0)
|
||||
seed = stepped(solve_four_bar, seed, D0, 120.0, 5.0)
|
||||
check("rolling the crank moves ratio followers and the loop in one action: ratios first in the report, the pinion's roll brought inside a turn",
|
||||
receipt["status"] == "accepted" and ratios() < RATIO and abs(pinion["kit_roll"] - 10.0) < RATIO and abs(x_rod["kit_slide"] - 0.14) < RATIO
|
||||
and reading("closed", apart(coupler, "end_b", crank, "end_b")) < CLOSED and reading("solved", turned(rocker["kit_roll"], seed[0])) < SOLVED
|
||||
and reading("slid", float(np.linalg.norm(frame(x_rod, "piston")[:3, 3] - frame(x_rod.parent, "bore")[:3, 3] - 0.14 * frame(x_rod.parent, "bore")[:3, 2]))) < CLOSED
|
||||
and [f["part"] for f in report["followers"]] == ["Cap", "Pinion", "X_Rod", "Rocker", "Coupler"], [receipt["message"], R["readings"], pinion["kit_roll"], x_rod["kit_slide"]])
|
||||
refused("slide on a follower", "brokkr_kitbash.slide", {"object_name": "X_Rod", "slide": 0.1}, "'X_Rod' follows 'Crank' (ratio): its value is derived")
|
||||
send("brokkr_kitbash.joint", object_name="Cap", record='{"limits": [0, 70]}')
|
||||
refused("a pose of the driver that takes a follower outside its own limits: the driver is not written either (F5)", "brokkr_kitbash.roll", {"object_name": "Crank", "roll": 150.0},
|
||||
"'Cap' on 'Crank': its roll 75 is outside the joint's limits 0 to 70")
|
||||
refused("clearing the limits of a driver a ratio follows", "brokkr_kitbash.joint", {"object_name": "Crank", "record": '{"limits": null}'}, "'Cap' follows it by ratio, and a ratio's driver states limits")
|
||||
receipt, report = send("brokkr_kitbash.follow", object_name="Pinion", record="null")
|
||||
cleared = receipt["status"] == "accepted" and report["cleared"] == ["Pinion"] and report["connection"]["follows"] is None and "kit_follows" not in pinion and "kit_follows_driver" not in pinion
|
||||
receipt, report = send("brokkr_kitbash.roll", object_name="Pinion", roll=33.0)
|
||||
check("follow with null clears the statement, and the part is posed by hand again", cleared and receipt["status"] == "accepted" and abs(pinion["kit_roll"] - 33.0) < RATIO, [receipt["message"]])
|
||||
|
||||
# --- two loops: a ram closing on the rocker, solved after the four-bar ---------------------------------------------------
|
||||
send("brokkr_kitbash.roll", object_name="Crank", roll=D0)
|
||||
seed = stepped(solve_four_bar, seed, 120.0, D0, 5.0)
|
||||
a_barrel, a_rod = place("A_Barrel", "ram_barrel"), place("A_Rod", "ram_rod")
|
||||
|
||||
def rod_end(pad_world, values, pin=None):
|
||||
return (pad_world @ core.mate(pin or socket(ground, "end_a"), socket(a_barrel, "base"), values[0]) @ core.mate(socket(a_barrel, "bore"), socket(a_rod, "piston"), 0.0, values[1])
|
||||
@ socket(a_rod, "rod_end")["matrix"])
|
||||
|
||||
# one driver: a ram on a second crank closes on the rocker, which follows the first (the probe of finding second-driver-loop-opens)
|
||||
place("S_Barrel", "ram_barrel"), place("S_Rod", "ram_rod")
|
||||
crank2 = place("Crank2", "strut", W + "length=0.4")
|
||||
shift = np.eye(4)
|
||||
shift[:3, 3] = frame(rocker, "end_b_back")[:3, 3] - rod_end(turn, RAM_REST, socket(crank2, "end_b"))[:3, 3]
|
||||
place("Ground2", "strut", W + "length=0.8", shift @ turn @ np.linalg.inv(core.mate(socket(ground, "end_a"), socket(crank2, "end_a"), 20.0)))
|
||||
attach("Crank2", "end_a", "Ground2", "end_a", 20.0)
|
||||
attach("S_Barrel", "base", "Crank2", "end_b", RAM_REST[0])
|
||||
attach("S_Rod", "piston", "S_Barrel", "bore", 0.0)
|
||||
send("brokkr_kitbash.slide", object_name="S_Rod", slide=RAM_REST[1])
|
||||
receipt, report = send("brokkr_kitbash.close", object_name="S_Rod", socket="rod_end", other_name="Rocker", other_socket="end_b_back")
|
||||
check("a ram on a second crank stands closed on the rocker", receipt["status"] == "accepted" and report["closure"]["holds"] is True, [receipt["message"], report and report["closure"]])
|
||||
refused("a loop whose ends depend on two drivers: its base is its own driver and the part it closes on follows another", "brokkr_kitbash.follow",
|
||||
{"object_name": "S_Rod", "record": '{"driver": "Crank2", "kind": "loop"}'},
|
||||
"'Crank2' (the base) and 'Rocker' (closed on), depend on more than one driver: 'Crank2' and 'Crank' ('Rocker' follows it)", "A follower takes its value from one driver")
|
||||
refused("and with the crank as the driver: the ram's base hangs from the second crank, which is posed by hand", "brokkr_kitbash.follow", {"object_name": "S_Rod", "record": loop},
|
||||
"depend on more than one driver: 'Crank' and 'Crank2' (it follows nothing and its joint has travel, so it is posed by hand)")
|
||||
receipt, _ = send("brokkr_kitbash.detach", object_name="S_Rod")
|
||||
check("the refused ram is detached, and the rocker's pin is free again", receipt["status"] == "accepted" and "kit_close" not in bpy.data.objects["S_Rod"], receipt["message"])
|
||||
|
||||
shift = np.eye(4)
|
||||
shift[:3, 3] = frame(rocker, "end_b_back")[:3, 3] - rod_end(turn, RAM_REST)[:3, 3]
|
||||
pad = place("Pad", "strut", W + "length=0.8", shift @ turn)
|
||||
attach("A_Barrel", "base", "Pad", "end_a", RAM_REST[0])
|
||||
attach("A_Rod", "piston", "A_Barrel", "bore", 0.0)
|
||||
send("brokkr_kitbash.slide", object_name="A_Rod", slide=RAM_REST[1])
|
||||
send("brokkr_kitbash.close", object_name="A_Rod", socket="rod_end", other_name="Rocker", other_socket="end_b_back")
|
||||
receipt, report = send("brokkr_kitbash.follow", object_name="A_Rod", record=loop)
|
||||
check("a ram on its own ground pin closes on the rocker and follows the crank: the end it closes on follows the driver",
|
||||
receipt["status"] == "accepted" and [f["part"] for f in report["followers"]] == ["Cap", "X_Rod", "Rocker", "Coupler", "A_Barrel", "A_Rod"]
|
||||
and report["connection"]["follows"]["holds"] is True, [receipt["message"], report and report.get("followers")])
|
||||
ram_loop = [(socket(pad, "end_a"), socket(a_barrel, "base"), "revolute"), (socket(a_barrel, "bore"), socket(a_rod, "piston"), "prismatic")]
|
||||
ram_seed = RAM_REST
|
||||
for roll in (60.0, 110.0, 45.0):
|
||||
was = crank["kit_roll"]
|
||||
receipt, report = send("brokkr_kitbash.roll", object_name="Crank", roll=roll)
|
||||
count = max(1, math.ceil(abs(roll - was) / 5.0))
|
||||
for index in range(1, count + 1): # this file's own derivation: at each step the four-bar, then the ram against the rocker where that step put it
|
||||
seed, _ = solve_four_bar(was + (roll - was) * index / count, seed)
|
||||
pin = rocker_world(world(base), seed[0]) @ socket(rocker, "end_b_back")["matrix"]
|
||||
ram_seed, _ = core.close_loop(world(pad), ram_loop, socket(a_rod, "rod_end"), pin, ram_seed)
|
||||
R["readings"][f"ram closed at {roll:g}"], R["readings"][f"ram solved at {roll:g}"] = apart(a_rod, "rod_end", rocker, "end_b_back"), turned(a_barrel["kit_roll"], ram_seed[0])
|
||||
check(f"rolling the crank to {roll:g} solves the four-bar and then the ram that closes on its rocker (F11): both closures hold and the barrel's roll and rod's slide are this file's own",
|
||||
receipt["status"] == "accepted" and reading("closed", apart(a_rod, "rod_end", rocker, "end_b_back")) < CLOSED and reading("closed", apart(coupler, "end_b", crank, "end_b")) < CLOSED
|
||||
and reading("solved", turned(a_barrel["kit_roll"], ram_seed[0])) < SOLVED and reading("closed", abs(a_rod["kit_slide"] - ram_seed[1])) < CLOSED
|
||||
and [f["part"] for f in report["followers"]][-4:] == ["Rocker", "Coupler", "A_Barrel", "A_Rod"]
|
||||
and [row for row in report["closures"] if not row["holds"]] == [], [receipt["message"], R["readings"], a_barrel["kit_roll"], a_rod["kit_slide"], ram_seed])
|
||||
|
||||
# --- one driver, after the loop is stated: each action that could give a loop a second one refuses it -------------------------
|
||||
place("P_Mount", "strut", W + "length=0.8", far @ far @ far @ far @ far @ turn)
|
||||
refused("attach after the loop is stated: the ram's pad hung on a free pin is a second driver between the loop's ends", "brokkr_kitbash.attach",
|
||||
{"object_name": "Pad", "socket": "end_b", "parent_name": "P_Mount", "parent_socket": "end_a", "roll": 0.0},
|
||||
"the two ends of the loop 'A_Rod' closes, 'Pad' (the base) and 'Rocker' (closed on), depend on more than one driver: 'Crank' and 'Pad' (it follows nothing and its joint has travel",
|
||||
"clear the loop (brokkr_kitbash.follow on 'A_Rod' with record null)")
|
||||
refused("clear after the loop is stated: the four-bar's rocker, no longer a follower, is a second driver of the ram that closes on it", "brokkr_kitbash.follow",
|
||||
{"object_name": "Coupler", "record": "null"},
|
||||
"the two ends of the loop 'A_Rod' closes, 'Pad' (the base) and 'Rocker' (closed on), depend on more than one driver: 'Crank' and 'Rocker' (it follows nothing and its joint has travel")
|
||||
|
||||
# --- a torque link: a slide drives two arms ---------------------------------------------------------------------------------
|
||||
t_barrel, t_rod = place("T_Barrel", "ram_barrel", "", far @ turn), place("T_Rod", "ram_rod")
|
||||
t_upper, t_lower, t_lug = place("T_Upper", "strut", W + "length=0.5"), place("T_Lower", "strut", W + "length=0.5"), place("T_Lug", "strut", W + "length=0.3")
|
||||
attach("T_Rod", "piston", "T_Barrel", "bore", 0.0)
|
||||
send("brokkr_kitbash.joint", object_name="T_Rod", record='{"limits": [0, 0.3], "mechanism": "oleo", "compliance": {"hertz": 3, "damping_ratio": 0.6}}')
|
||||
send("brokkr_kitbash.slide", object_name="T_Rod", slide=0.05)
|
||||
attach("T_Lug", "end_a", "T_Rod", "rod_end_back", 90.0)
|
||||
link = [(socket(t_barrel, "base_back"), socket(t_upper, "end_a"), "revolute"), (socket(t_upper, "end_b"), socket(t_lower, "end_a"), "revolute")]
|
||||
|
||||
def lug_pin(slide):
|
||||
return (world(t_barrel) @ core.mate(socket(t_barrel, "bore"), socket(t_rod, "piston"), 0.0, slide) @ core.mate(socket(t_rod, "rod_end_back"), socket(t_lug, "end_a"), 90.0)
|
||||
@ socket(t_lug, "end_b")["matrix"])
|
||||
|
||||
def solve_link(slide, values):
|
||||
return core.close_loop(world(t_barrel), link, socket(t_lower, "end_b"), lug_pin(slide), values)
|
||||
|
||||
arms = None
|
||||
for guess in ((40.0, 100.0), (-40.0, -100.0), (140.0, 100.0), (-140.0, -100.0), (90.0, 90.0), (-90.0, -90.0), (10.0, 150.0), (-10.0, -150.0)):
|
||||
try:
|
||||
arms, _ = solve_link(0.05, guess)
|
||||
break
|
||||
except core.KitError:
|
||||
continue
|
||||
check("the torque link's rest pose is found: two arms from the barrel's pin to the lug on the rod", arms is not None, "no guess closed the loop")
|
||||
arms = tuple(core._wrapped(v) for v in arms)
|
||||
attach("T_Upper", "end_a", "T_Barrel", "base_back", arms[0])
|
||||
attach("T_Lower", "end_a", "T_Upper", "end_b", arms[1])
|
||||
send("brokkr_kitbash.close", object_name="T_Lower", socket="end_b", other_name="T_Lug", other_socket="end_b")
|
||||
refused("a loop that closes on a part hung from the driver by a free pin: the lug's roll is a second input (the probe of finding torque-link-lug-is-a-free-dof)", "brokkr_kitbash.follow",
|
||||
{"object_name": "T_Lower", "record": '{"driver": "T_Rod", "kind": "loop"}'},
|
||||
"'T_Barrel' (the base) and 'T_Lug' (closed on), depend on more than one driver: 'T_Rod' and 'T_Lug' (it follows nothing and its joint has travel, so it is posed by hand)")
|
||||
receipt, report = send("brokkr_kitbash.joint", object_name="T_Lug", record='{"limits": [90, 90], "mechanism": "lug"}')
|
||||
check("limits of one value hold the lug on the rod: a pin with no travel", receipt["status"] == "accepted" and report["connection"]["limits"] == [90.0, 90.0], receipt["message"])
|
||||
receipt, report = send("brokkr_kitbash.follow", object_name="T_Lower", record='{"driver": "T_Rod", "kind": "loop"}')
|
||||
check("the arms follow the rod's slide as a loop: its base is the barrel, above the driver, and it closes on a part that hangs from the driver",
|
||||
receipt["status"] == "accepted" and [f["part"] for f in report["followers"]] == ["T_Upper", "T_Lower"], [receipt["message"], report and report.get("followers")])
|
||||
for slide in (0.15, 0.0, 0.11):
|
||||
was = t_rod["kit_slide"]
|
||||
receipt, report = send("brokkr_kitbash.slide", object_name="T_Rod", slide=slide)
|
||||
arms = stepped(solve_link, arms, was, slide, 0.02)
|
||||
check(f"sliding the rod to {slide:g} folds the arms: the closure holds in the scene and the rolls are this file's own stepped solve",
|
||||
receipt["status"] == "accepted" and reading("closed", apart(t_lower, "end_b", t_lug, "end_b")) < CLOSED
|
||||
and max(reading("solved", turned(t_upper["kit_roll"], arms[0])), reading("solved", turned(t_lower["kit_roll"], arms[1]))) < SOLVED
|
||||
and report["closures"][0]["holds"] is True, [receipt["message"], R["readings"], t_upper["kit_roll"], t_lower["kit_roll"], arms])
|
||||
refused("a slide outside the driver's limits", "brokkr_kitbash.slide", {"object_name": "T_Rod", "slide": 0.4}, "its slide 0.4 is outside the joint's limits 0 to 0.3")
|
||||
refused("a roll of the held lug: no pose opens the torque link", "brokkr_kitbash.roll", {"object_name": "T_Lug", "roll": 100.0}, "'T_Lug' on 'T_Rod': its roll 100 is outside the joint's limits 90 to 90")
|
||||
for label, limits in (("widened", "[80, 100]"), ("cleared", "null")):
|
||||
refused(f"limits {label} after the loop is stated: the lug, given travel, is a second driver of the torque link", "brokkr_kitbash.joint",
|
||||
{"object_name": "T_Lug", "record": '{"limits": %s}' % limits},
|
||||
"the two ends of the loop 'T_Lower' closes, 'T_Barrel' (the base) and 'T_Lug' (closed on), depend on more than one driver: 'T_Rod' and 'T_Lug' (it follows nothing and its joint has travel")
|
||||
t_lug["kit_min"], t_lug["kit_max"] = 80.0, 100.0 # by hand, past every action: the next write of any pose reads the rule
|
||||
refused("a pose of the driver after the lug's limits were widened by hand: the writer reads the rule before it writes", "brokkr_kitbash.slide", {"object_name": "T_Rod", "slide": 0.1},
|
||||
"depend on more than one driver: 'T_Rod' and 'T_Lug' (it follows nothing and its joint has travel")
|
||||
refused("and a pose of the lug itself", "brokkr_kitbash.roll", {"object_name": "T_Lug", "roll": 95.0}, "depend on more than one driver: 'T_Rod' and 'T_Lug'")
|
||||
# a second driver no write made is told by every read of the loop, while its closure still stands closed (finding two-driver-loop-reported-nowhere):
|
||||
# each follower's follows row reads holds false and names both drivers, and the joints report of a tree the loop is in lists the loop by its closing part
|
||||
told = "the loop 'T_Lower' closes has more than one driver: 'T_Rod' and 'T_Lug' (it follows nothing and its joint has travel, so it is posed by hand)"
|
||||
rows = {name: send("brokkr_kitbash.report", object_name=name)[1]["parts"][0] for name in ("T_Upper", "T_Lower")}
|
||||
check("a loop given a second driver by hand reads follows.holds false on both followers, naming both drivers, while its closure holds",
|
||||
all(row["connection"]["follows"]["holds"] is False and row["connection"]["follows"]["reason"].startswith(told) for row in rows.values())
|
||||
and rows["T_Lower"]["closure"]["holds"] is True, [{name: row["connection"] for name, row in rows.items()}, rows["T_Lower"]["closure"]])
|
||||
receipt, joints = send("brokkr_kitbash.joints", object_name="T_Barrel")
|
||||
receipt2, joints2 = send("brokkr_kitbash.joints", object_name="T_Lug")
|
||||
receipt3, joints3 = send("brokkr_kitbash.joints", object_name="Ground")
|
||||
check("the joints report lists a loop with a second driver in manyDrivers, by its closing part and with both drivers: in a report of the whole mechanism, "
|
||||
"in one of the second driver's own sub-tree, and not in one of a tree the loop is no part of",
|
||||
all(r["status"] == "accepted" for r in (receipt, receipt2, receipt3)) and joints["manyDrivers"] == [{"loop": "T_Lower", "drivers": ["T_Rod", "T_Lug"]}] == joints2["manyDrivers"]
|
||||
and joints3["manyDrivers"] == [], [receipt["message"], joints and joints.get("manyDrivers"), joints2 and joints2.get("manyDrivers"), joints3 and joints3.get("manyDrivers")])
|
||||
# the rule judges the write, not the scene: with the torque link holding a second driver, a write is refused when it touches that loop (a part of it,
|
||||
# or one it hangs from) or would give another loop a second driver, and every other write is made (finding parent-hook-gates-on-scene-not-change)
|
||||
shape = lambda *names: {name: np.array([v.co[:] for v in bpy.data.objects[name].data.vertices]).tobytes() for name in names} # noqa: E731
|
||||
was = shape("T_Lug", "T_Lower")
|
||||
refused("set_params of the part a two-driver loop closes on (finding set-params-writes-before-the-guard): the rule is read before the mesh is rebuilt",
|
||||
"brokkr_kitbash.set_params", {"object_name": "T_Lug", "params": "length=0.31"},
|
||||
"the two ends of the loop 'T_Lower' closes, 'T_Barrel' (the base) and 'T_Lug' (closed on), depend on more than one driver: 'T_Rod' and 'T_Lug' (it follows nothing and its joint has travel", "nothing changed")
|
||||
check("and nothing moved: the part's vertices read as before the refusal", shape("T_Lug", "T_Lower") == was)
|
||||
refused("setObjectParent of the root a two-driver loop hangs from: the write touches the loop", "setObjectParent", {"targetObjectName": "T_Barrel", "parentObjectName": "Loose"},
|
||||
"the two ends of the loop 'T_Lower' closes, 'T_Barrel' (the base) and 'T_Lug' (closed on), depend on more than one driver: 'T_Rod' and 'T_Lug'", "nothing changed")
|
||||
refused("setObjectParent that gives another loop a second driver, in a scene that already holds one: the four-bar's base under Idle", "setObjectParent",
|
||||
{"targetObjectName": "Base", "parentObjectName": "Idle"},
|
||||
"the two ends of the loop 'A_Rod' closes, 'Pad' (the base) and 'Rocker' (closed on), depend on more than one driver: 'Crank' and 'Idle' (it follows nothing and its joint has travel", "nothing changed")
|
||||
idle, tip_was = bpy.data.objects["Idle"], connection("Tip")
|
||||
length, was = json.loads(idle["kit_params"])["length"], shape("Idle")
|
||||
receipt, _ = send("brokkr_kitbash.set_params", object_name="Idle", params="length=0.6")
|
||||
grown = receipt["status"] == "accepted" and shape("Idle") != was and connection("Tip")["holds"] is True
|
||||
receipt2, _ = send("brokkr_kitbash.set_params", object_name="Idle", params=f"length={length!r}")
|
||||
check("set_params of a part no loop hangs from is written in a scene that holds a second driver, and set back",
|
||||
grown and receipt2["status"] == "accepted" and shape("Idle") == was and connection("Tip") == tip_was and tip_was["holds"] is True, [receipt["message"], receipt2["message"], tip_was, connection("Tip")])
|
||||
rolled = idle["kit_roll"]
|
||||
receipt, _ = send("brokkr_kitbash.roll", object_name="Idle", roll=rolled + 5.0)
|
||||
receipt2, _ = send("brokkr_kitbash.roll", object_name="Idle", roll=rolled)
|
||||
check("a pose of a joint no loop hangs from is written in a scene that holds a second driver", receipt["status"] == "accepted" and receipt2["status"] == "accepted", [receipt["message"], receipt2["message"]])
|
||||
plain, cam = bpy.data.objects.new("PlainEmpty", None), bpy.data.objects.new("Cam", bpy.data.cameras.new("Cam")) # Soul's probe P2a, P2b: neither is a kit part
|
||||
for made in (plain, cam):
|
||||
bpy.context.scene.collection.objects.link(made)
|
||||
asked = []
|
||||
for name, parent in (("Cam", "PlainEmpty"), ("PlainEmpty", "Ground"), ("PlainEmpty", "T_Lug"), ("Cam", "")):
|
||||
receipt, _ = send("setObjectParent", targetObjectName=name, parentObjectName=parent)
|
||||
asked.append((receipt["status"], bpy.data.objects[name].parent and bpy.data.objects[name].parent.name, str(receipt["message"])[:200]))
|
||||
check("setObjectParent of a camera under an empty, of the empty under a kit part and under a part of the two-driver loop itself, and clearing the camera's, "
|
||||
"are written in a scene that holds a second driver: nothing of a loop hangs from them",
|
||||
[row[:2] for row in asked] == [("accepted", "PlainEmpty"), ("accepted", "Ground"), ("accepted", "T_Lug"), ("accepted", None)], asked)
|
||||
receipt, _ = send("setObjectParent", targetObjectName="T_Barrel", parentObjectName="Cam")
|
||||
check("and the loop's root under that camera is refused: the camera is no kit part, the root is what the loop hangs from",
|
||||
receipt["status"] != "accepted" and "depend on more than one driver: 'T_Rod' and 'T_Lug'" in str(receipt["message"]) and t_barrel.parent is None, [receipt["status"], receipt["message"]])
|
||||
for made in (cam, plain):
|
||||
bpy.data.objects.remove(made)
|
||||
# a loop whose driver neither end hangs from, stated by hand on Loose and closing on Tip, whose two free pins are second drivers: a write of the
|
||||
# driver that poses nothing (its followers are not written) still touches the loop
|
||||
place("H_Upper", "strut", W), place("H_Lower", "strut", W)
|
||||
attach("H_Upper", "end_a", "Loose", "end_a", 30.0), attach("H_Lower", "end_a", "H_Upper", "end_b", 40.0)
|
||||
h_upper, h_lower = bpy.data.objects["H_Upper"], bpy.data.objects["H_Lower"]
|
||||
h_lower["kit_close_socket"], h_lower["kit_close_to"], h_lower["kit_close_to_socket"] = "end_b", bpy.data.objects["Tip"], "end_b"
|
||||
for made in (h_upper, h_lower):
|
||||
made["kit_follows"], made["kit_follows_driver"] = '{"kind": "loop"}', crank
|
||||
refused("set_params of the driver of a two-driver loop that neither end hangs from: the write touches the loop", "brokkr_kitbash.set_params",
|
||||
{"object_name": "Crank", "params": f"length={json.loads(crank['kit_params'])['length']!r}"},
|
||||
"the two ends of the loop 'H_Lower' closes, 'Loose' (the base) and 'Tip' (closed on), depend on more than one driver: 'Crank' and 'Idle' (it follows nothing and its joint has travel", "nothing changed")
|
||||
for made in (h_lower, h_upper):
|
||||
bpy.data.objects.remove(made)
|
||||
t_lug["kit_min"], t_lug["kit_max"] = 90.0, 90.0
|
||||
receipt, report = send("brokkr_kitbash.slide", object_name="T_Rod", slide=0.11)
|
||||
check("with the lug held again the driver is posed", receipt["status"] == "accepted" and report["closures"][0]["holds"] is True, receipt["message"])
|
||||
receipt, report = send("brokkr_kitbash.report", object_name="T_Lower")
|
||||
receipt2, joints = send("brokkr_kitbash.joints", object_name="T_Barrel")
|
||||
check("and with one driver again the follower's follows row holds and the joints report lists no loop",
|
||||
receipt["status"] == "accepted" and receipt2["status"] == "accepted" and report["parts"][0]["connection"]["follows"] == {"driver": "T_Rod", "kind": "loop", "k": None, "offset": None, "holds": True, "reason": None}
|
||||
and joints["manyDrivers"] == [], [receipt["message"], report and report["parts"][0]["connection"], joints and joints.get("manyDrivers")])
|
||||
receipt, joints = send("brokkr_kitbash.joints", object_name="T_Barrel")
|
||||
check("the torque link has one degree of freedom: the rod's slide is its one row with travel that nothing drives, the lug is its one held row, the arms are driven, and no row is unlimited",
|
||||
receipt["status"] == "accepted" and [(row["id"], row["kind"], row["driven"] and row["driven"]["by"], row["min"], row["max"], row["held"]) for row in joints["joints"]] == [
|
||||
("T_Rod", "prismatic", None, -0.11, 0.19, False), ("T_Lug", "revolute", None, 0.0, 0.0, True), ("T_Upper", "revolute", "T_Rod", None, None, False), ("T_Lower", "revolute", "T_Rod", None, None, False)]
|
||||
and joints["unlimited"] == [] and reading("closed", apart(t_lower, "end_b", t_lug, "end_b")) < CLOSED, [receipt["message"], joints])
|
||||
place("T_Mount", "strut", W, far @ far @ far @ far @ turn)
|
||||
hinged = attach("T_Barrel", "base", "T_Mount", "end_a", 25.0)
|
||||
receipt, report = send("brokkr_kitbash.follow", object_name="T_Lower", record="null")
|
||||
cleared = receipt["status"] == "accepted" and report["cleared"] == ["T_Upper", "T_Lower"]
|
||||
receipt, report = send("brokkr_kitbash.follow", object_name="T_Lower", record='{"driver": "T_Rod", "kind": "loop"}')
|
||||
check("a joint both ends of a loop hang from is not one the loop depends on: the barrel hung on a free hinge, the arms follow the rod again",
|
||||
hinged and cleared and receipt["status"] == "accepted" and [f["part"] for f in report["followers"]] == ["T_Upper", "T_Lower"]
|
||||
and reading("closed", apart(t_lower, "end_b", t_lug, "end_b")) < CLOSED, [hinged, cleared, receipt["message"]])
|
||||
|
||||
refused("detach after the loop is stated: the lug cut from the rod no longer hangs from the barrel, so the barrel's free hinge is a second driver", "brokkr_kitbash.detach",
|
||||
{"object_name": "T_Lug"},
|
||||
"the two ends of the loop 'T_Lower' closes, 'T_Barrel' (the base) and 'T_Lug' (closed on), depend on more than one driver: 'T_Rod' and 'T_Barrel' (it follows nothing and its joint has travel")
|
||||
|
||||
refused("setObjectParent clearing the lug's parent (finding bridge-reparent-bypasses-the-guard): Brokkr's own row asks the same rule before it writes a parent", "setObjectParent",
|
||||
{"targetObjectName": "T_Lug", "parentObjectName": ""},
|
||||
"the two ends of the loop 'T_Lower' closes, 'T_Barrel' (the base) and 'T_Lug' (closed on), depend on more than one driver: 'T_Rod' and 'T_Barrel' (it follows nothing and its joint has travel", "nothing changed")
|
||||
refused("setObjectParent of a root onto a part on a free pin: with the four-bar's base under Idle, the rocker the ram closes on depends on Idle's roll", "setObjectParent",
|
||||
{"targetObjectName": "Base", "parentObjectName": "Idle"},
|
||||
"the two ends of the loop 'A_Rod' closes, 'Pad' (the base) and 'Rocker' (closed on), depend on more than one driver: 'Crank' and 'Idle' (it follows nothing and its joint has travel", "nothing changed")
|
||||
receipt, _ = send("setObjectParent", targetObjectName="Loose", parentObjectName="Idle")
|
||||
under = bpy.data.objects["Loose"].parent
|
||||
receipt2, _ = send("setObjectParent", targetObjectName="Loose", parentObjectName="")
|
||||
check("setObjectParent of a part no loop depends on is written as before, and cleared again", receipt["status"] == "accepted" and under == bpy.data.objects["Idle"]
|
||||
and receipt2["status"] == "accepted" and bpy.data.objects["Loose"].parent is None, [receipt["message"], receipt2["message"]])
|
||||
|
||||
# --- joints, version 2 ----------------------------------------------------------------------------------------------------------
|
||||
receipt, joints = send("brokkr_kitbash.joints", object_name="Ground")
|
||||
table = {row["id"]: row for row in (joints or {}).get("joints", [])}
|
||||
check("joints is version 2: a driven row names what drives it (F6), and unlimited lists the rows that are not driven and state no limits",
|
||||
receipt["status"] == "accepted" and joints["version"] == 2 and [row["id"] for row in joints["joints"]] == ["Crank", "Cap", "Idle", "Tip", "Pinion", "X_Barrel", "X_Rod"]
|
||||
and table["Crank"]["driven"] is None and table["Cap"]["driven"] == {"by": "Crank", "kind": "ratio", "k": 0.5, "offset": 0.0}
|
||||
and table["X_Rod"]["driven"] == {"by": "Crank", "kind": "ratio", "k": 0.001, "offset": 0.02} and table["X_Rod"]["kind"] == "prismatic"
|
||||
and joints["unlimited"] == ["Idle", "Tip", "Pinion", "X_Barrel"] and joints["next"] is None and "jointsOmitted" not in joints, [receipt["message"], joints])
|
||||
receipt, joints = send("brokkr_kitbash.joints", object_name="Base")
|
||||
check("a loop's two followers are driven rows, kind loop", receipt["status"] == "accepted" and [(row["id"], row["driven"]) for row in joints["joints"]] == [
|
||||
("Rocker", {"by": "Crank", "kind": "loop", "k": None, "offset": None}), ("Coupler", {"by": "Crank", "kind": "loop", "k": None, "offset": None})] and joints["unlimited"] == [], joints)
|
||||
receipt, joints = send("brokkr_kitbash.joints", object_name="T_Rod")
|
||||
check("a root that states a DOF connection has its own row first, parent null", receipt["status"] == "accepted"
|
||||
and [(row["id"], row["parent"], row["kind"]) for row in joints["joints"]] == [("T_Rod", None, "prismatic"), ("T_Lug", "T_Rod", "revolute")]
|
||||
and joints["joints"][0]["compliance"] == {"damping_ratio": 0.6, "hertz": 3.0} and joints["rigid"] == 0, joints)
|
||||
receipt, joints = send("brokkr_kitbash.joints", object_name="Ground", after="Idle")
|
||||
check("after carries the rows after an id (F12)", receipt["status"] == "accepted" and [row["id"] for row in joints["joints"]] == ["Tip", "Pinion", "X_Barrel", "X_Rod"]
|
||||
and joints["joints"][0]["parent"] == "Idle" and joints["unlimited"] == ["Tip", "Pinion", "X_Barrel"], joints)
|
||||
refused("after an id that is no row's", "brokkr_kitbash.joints", {"object_name": "Ground", "after": "Base"}, "after 'Base' is not the id of a joint under 'Ground'")
|
||||
long = [f"Actuator_joint_name_that_is_long_but_legal_in_blender_{index:04d}_x" for index in range(265)] # 62 characters, of the 63 Blender takes
|
||||
place(long[0], "strut", W + "length=0.3", far @ far @ turn)
|
||||
place(long[1], "strut", W + "length=0.3")
|
||||
attach(long[1], "end_a", long[0], "end_a", 7.0)
|
||||
for chain, on in enumerate(("end_a", "end_a_back", "end_b", "end_b_back")): # four chains of 66 on the root's four pins: 264 joints, none limited
|
||||
for index in range(max(2, chain * 66 + 1), chain * 66 + 67): # copies of the one attached by the actions, each stating its own connection: the report reads what is stated
|
||||
copy = bpy.data.objects[long[1]].copy()
|
||||
copy.name, copy.parent = long[index], bpy.data.objects[long[0] if index == chain * 66 + 1 else long[index - 1]]
|
||||
copy["kit_parent_socket"] = on if index == chain * 66 + 1 else "end_b"
|
||||
bpy.context.scene.collection.objects.link(copy)
|
||||
pages, after = [], ""
|
||||
for _ in range(2): # the first two reports; each costs a pass over the 264 parts
|
||||
receipt, page = send("brokkr_kitbash.joints", object_name=long[0], after=after)
|
||||
pages.append((receipt["status"], len(receipt.get("hostResult") or ""), page or {}))
|
||||
after = (page or {}).get("next") or ""
|
||||
carried = [[row["id"] for row in page.get("joints", [])] for _, _, page in pages]
|
||||
R["readings"]["rows in the first receipt"], R["readings"]["longest receipt"] = len(carried[0]), max(size for _, size, _ in pages)
|
||||
check("a tree of 264 unlimited joints with long names, whose ids alone are over a receipt, is many reports and none over a receipt: each carries rows, the ids of its own "
|
||||
"rows as unlimited, a count of what it omits and the last id it carries as next, and after it the next carries on",
|
||||
all(status == "accepted" and size <= 16000 and page.get("joints") and page["unlimited"] == ids and page["next"] == ids[-1] for (status, size, page), ids in zip(pages, carried))
|
||||
and sum(len(json.dumps(name)) + 1 for name in long[1:]) > 16000 and [name for ids in carried for name in ids] == long[1:len(carried[0]) + len(carried[1]) + 1]
|
||||
and [page["jointsOmitted"] for _, _, page in pages] == [264 - len(carried[0]), 264 - len(carried[0]) - len(carried[1])],
|
||||
[[(status, size, len(ids), page.get("jointsOmitted"), page.get("next")) for (status, size, page), ids in zip(pages, carried)]])
|
||||
|
||||
# --- the joint-records Lows -------------------------------------------------------------------------------------------------
|
||||
send("brokkr_kitbash.joint", object_name="Idle", record='{"limits": [0, 30]}')
|
||||
idle = bpy.data.objects["Idle"]
|
||||
idle["kit_roll"] = 50.0 # by hand: no action writes a roll outside its limits
|
||||
refused("set_params of a part whose roll was written by hand outside its limits (F9): the mesh is not rebuilt", "brokkr_kitbash.set_params", {"object_name": "Idle", "params": "length=0.6"},
|
||||
"'Idle' on 'Ground': its roll 50 is outside the joint's limits 0 to 30")
|
||||
refused("and of its parent", "brokkr_kitbash.set_params", {"object_name": "Ground", "params": "length=0.9"}, "'Idle' on 'Ground': its roll 50 is outside the joint's limits 0 to 30")
|
||||
idle["kit_roll"], idle["kit_slide"] = 15.0, 0.1
|
||||
refused("set_params of a part with a slide written by hand on a revolute connection", "brokkr_kitbash.set_params", {"object_name": "Idle", "params": "length=0.6"},
|
||||
"socket type 'pivot' is revolute: only a prismatic connection slides")
|
||||
del idle["kit_slide"]
|
||||
idle["kit_compliance"] = '{"damping_ratio": 0.7, "hertz": 4.0}' # by hand: a compliance is a prismatic joint's
|
||||
receipt, joints = send("brokkr_kitbash.joints", object_name="Idle")
|
||||
row = connection("Idle")
|
||||
check("a compliance written by hand on a revolute joint reads null in the report and the joints report (F10), and the limits beside it still read",
|
||||
receipt["status"] == "accepted" and row["compliance"] is None and row["limits"] == [0.0, 30.0] and joints["joints"][0]["id"] == "Idle" and joints["joints"][0]["compliance"] is None, [row, joints])
|
||||
receipt, report = send("brokkr_kitbash.set_params", object_name="Idle", params="length=0.6")
|
||||
check("set_params seats through the one writer: the part is rebuilt, its child seated on the moved socket, and the hand-written compliance is gone",
|
||||
receipt["status"] == "accepted" and "kit_compliance" not in idle and connection("Tip")["holds"] and reading("closed", apart(bpy.data.objects["Tip"], "end_a", idle, "end_b")) < CLOSED,
|
||||
[receipt["message"], sorted(idle.keys())])
|
||||
|
||||
# --- detach ---------------------------------------------------------------------------------------------------------------------
|
||||
receipt, report = send("brokkr_kitbash.detach", object_name="T_Lower")
|
||||
upper_row = connection("T_Upper")
|
||||
check("detaching a loop's closing follower clears its partner's statement too", receipt["status"] == "accepted" and upper_row["follows"] is None
|
||||
and not [k for o in (t_upper, t_lower) for k in o.keys() if k.startswith("kit_follows")], [receipt["message"], upper_row, sorted(t_upper.keys())])
|
||||
receipt, report = send("brokkr_kitbash.roll", object_name="T_Upper", roll=12.0)
|
||||
check("and the partner is posed by hand again", receipt["status"] == "accepted", receipt["message"])
|
||||
receipt, report = send("brokkr_kitbash.detach", object_name="Crank")
|
||||
cap_row, coupler_row = connection("Cap"), connection("Coupler")
|
||||
check("detaching a driver leaves its followers' statements, which report that the driver states no DOF connection",
|
||||
receipt["status"] == "accepted" and cap_row["follows"] == {"driver": "Crank", "kind": "ratio", "k": 0.5, "offset": 0.0, "holds": False, "reason": "the driver states no DOF connection"}
|
||||
and coupler_row["follows"]["holds"] is False and coupler_row["follows"]["reason"] == "the driver states no DOF connection", [receipt["message"], cap_row, coupler_row])
|
||||
bpy.data.objects.remove(crank)
|
||||
coupler_row = connection("Coupler")
|
||||
check("and once the driver is deleted, that it is gone", coupler_row["follows"]["driver"] is None and coupler_row["follows"]["reason"] == "the driver is gone: deleted, or in no collection", coupler_row)
|
||||
constrained = [o.name for o in bpy.data.objects if o.constraints or (o.animation_data and o.animation_data.drivers)]
|
||||
check("no Blender driver or constraint was made", constrained == [], constrained)
|
||||
except Exception: # noqa: BLE001 whatever it was, it is a failed check with a name, printed and written, not a missing result file
|
||||
check(f"no uncaught error after: {R['checks'][-1]['name'] if R['checks'] else 'the start'}", False, traceback.format_exc().splitlines()[-8:])
|
||||
|
||||
R["ok"] = all(c["ok"] for c in R["checks"])
|
||||
R["readings"] = {name: float(f"{value:.2g}") for name, value in sorted(R["readings"].items())}
|
||||
for c in R["checks"]:
|
||||
print("CHECK", "ok " if c["ok"] else "FAIL", c["name"], "" if c["ok"] else c["detail"], flush=True)
|
||||
Path(OUT + ".result.json").write_text(json.dumps(R, indent=1, default=str), encoding="utf-8")
|
||||
print("READINGS", R["readings"], flush=True)
|
||||
sys.exit(0 if R["ok"] else 1)
|
||||
517
surfaces/blender/tests/live/kitbash_follows.result.json
Normal file
517
surfaces/blender/tests/live/kitbash_follows.result.json
Normal file
|
|
@ -0,0 +1,517 @@
|
|||
{
|
||||
"blender": "5.3.0",
|
||||
"checks": [
|
||||
{
|
||||
"name": "follow loads as a host action after joints, with no errors",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "the four-bar stands closed at rest: crank on Ground, rocker on Base, the coupler's end closing on the crank's",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a loop whose two ends both stand still when the driver moves (F7)",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a loop whose base hangs from the part it closes on stands closed",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a loop whose two ends both move with the driver (F7, the other half)",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a loop follower that states no closure",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a follower on a rigid connection",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a follower that is not attached",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a part that follows itself",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a driver below its follower",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a record that is not one of the three shapes: {\"driver\": \"Crank\", \"kind\": \"ratio\", \"k\": 0, \"offset\": 0}",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a record that is not one of the three shapes: {\"driver\": \"Crank\", \"kind\": \"ratio\", \"k\": 1}",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a record that is not one of the three shapes: {\"driver\": \"Crank\", \"kind\": \"gear\"}",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a record that is not one of the three shapes: {\"driver\": \"Crank\", \"kind\": \"loop\", \"k\": 1}",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a record that is not one of the three shapes: [1, 2]",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a record that is not one of the three shapes: {\"a\"",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: clearing a part that follows nothing",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "follow states the loop on the closing part and its parent, both following the crank, and the report lists them as written",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rolling the crank a 45 degree turn moves rocker and coupler with it: the closure holds in the scene and the rolls are this file's own stepped solve",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rolling the crank to 120 past rest moves rocker and coupler with it: the closure holds in the scene and the rolls are this file's own stepped solve",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rolling the crank and back to rest moves rocker and coupler with it: the closure holds in the scene and the rolls are this file's own stepped solve",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rolling the crank 30 the other way moves rocker and coupler with it: the closure holds in the scene and the rolls are this file's own stepped solve",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: the crank driven past the loop's dead centre, naming the driver's value and the closing part",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a jump from beside the toggle that one solve from the stated rolls does not survive ends on the stepped answer, the branch the linkage is on (F2)",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: roll on the follower Rocker, naming its driver (F4)",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: roll on the follower Coupler, naming its driver (F4)",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: aim on a follower",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: reach on a follower",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "joint on a follower states limits and a mechanism and keeps its derived value and its statement",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: joint limits on a follower that do not hold its derived value",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a driver that is itself a follower",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a follower that drives another",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a follower that already follows",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a closure stated by a loop's parent follower",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a ratio whose driver states no limits (F3)",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a kneecap at k 0.5, a pinion at k -3 and a crosshead's slide at 0.001 m a degree follow the crank at once: each is k x its roll + offset",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rolling the crank moves ratio followers and the loop in one action: ratios first in the report, the pinion's roll brought inside a turn",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: slide on a follower",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a pose of the driver that takes a follower outside its own limits: the driver is not written either (F5)",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: clearing the limits of a driver a ratio follows",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "follow with null clears the statement, and the part is posed by hand again",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a ram on a second crank stands closed on the rocker",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a loop whose ends depend on two drivers: its base is its own driver and the part it closes on follows another",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: and with the crank as the driver: the ram's base hangs from the second crank, which is posed by hand",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "the refused ram is detached, and the rocker's pin is free again",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a ram on its own ground pin closes on the rocker and follows the crank: the end it closes on follows the driver",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rolling the crank to 60 solves the four-bar and then the ram that closes on its rocker (F11): both closures hold and the barrel's roll and rod's slide are this file's own",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rolling the crank to 110 solves the four-bar and then the ram that closes on its rocker (F11): both closures hold and the barrel's roll and rod's slide are this file's own",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rolling the crank to 45 solves the four-bar and then the ram that closes on its rocker (F11): both closures hold and the barrel's roll and rod's slide are this file's own",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: attach after the loop is stated: the ram's pad hung on a free pin is a second driver between the loop's ends",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: clear after the loop is stated: the four-bar's rocker, no longer a follower, is a second driver of the ram that closes on it",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "the torque link's rest pose is found: two arms from the barrel's pin to the lug on the rod",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a loop that closes on a part hung from the driver by a free pin: the lug's roll is a second input (the probe of finding torque-link-lug-is-a-free-dof)",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "limits of one value hold the lug on the rod: a pin with no travel",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "the arms follow the rod's slide as a loop: its base is the barrel, above the driver, and it closes on a part that hangs from the driver",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "sliding the rod to 0.15 folds the arms: the closure holds in the scene and the rolls are this file's own stepped solve",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "sliding the rod to 0 folds the arms: the closure holds in the scene and the rolls are this file's own stepped solve",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "sliding the rod to 0.11 folds the arms: the closure holds in the scene and the rolls are this file's own stepped solve",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a slide outside the driver's limits",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a roll of the held lug: no pose opens the torque link",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: limits widened after the loop is stated: the lug, given travel, is a second driver of the torque link",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: limits cleared after the loop is stated: the lug, given travel, is a second driver of the torque link",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a pose of the driver after the lug's limits were widened by hand: the writer reads the rule before it writes",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: and a pose of the lug itself",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a loop given a second driver by hand reads follows.holds false on both followers, naming both drivers, while its closure holds",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "the joints report lists a loop with a second driver in manyDrivers, by its closing part and with both drivers: in a report of the whole mechanism, in one of the second driver's own sub-tree, and not in one of a tree the loop is no part of",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: set_params of the part a two-driver loop closes on (finding set-params-writes-before-the-guard): the rule is read before the mesh is rebuilt",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "and nothing moved: the part's vertices read as before the refusal",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: setObjectParent of the root a two-driver loop hangs from: the write touches the loop",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: setObjectParent that gives another loop a second driver, in a scene that already holds one: the four-bar's base under Idle",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "set_params of a part no loop hangs from is written in a scene that holds a second driver, and set back",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a pose of a joint no loop hangs from is written in a scene that holds a second driver",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "setObjectParent of a camera under an empty, of the empty under a kit part and under a part of the two-driver loop itself, and clearing the camera's, are written in a scene that holds a second driver: nothing of a loop hangs from them",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "and the loop's root under that camera is refused: the camera is no kit part, the root is what the loop hangs from",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: set_params of the driver of a two-driver loop that neither end hangs from: the write touches the loop",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "with the lug held again the driver is posed",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "and with one driver again the follower's follows row holds and the joints report lists no loop",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "the torque link has one degree of freedom: the rod's slide is its one row with travel that nothing drives, the lug is its one held row, the arms are driven, and no row is unlimited",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a joint both ends of a loop hang from is not one the loop depends on: the barrel hung on a free hinge, the arms follow the rod again",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: detach after the loop is stated: the lug cut from the rod no longer hangs from the barrel, so the barrel's free hinge is a second driver",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: setObjectParent clearing the lug's parent (finding bridge-reparent-bypasses-the-guard): Brokkr's own row asks the same rule before it writes a parent",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: setObjectParent of a root onto a part on a free pin: with the four-bar's base under Idle, the rocker the ram closes on depends on Idle's roll",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "setObjectParent of a part no loop depends on is written as before, and cleared again",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "joints is version 2: a driven row names what drives it (F6), and unlimited lists the rows that are not driven and state no limits",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a loop's two followers are driven rows, kind loop",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a root that states a DOF connection has its own row first, parent null",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "after carries the rows after an id (F12)",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: after an id that is no row's",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a tree of 264 unlimited joints with long names, whose ids alone are over a receipt, is many reports and none over a receipt: each carries rows, the ids of its own rows as unlimited, a count of what it omits and the last id it carries as next, and after it the next carries on",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: set_params of a part whose roll was written by hand outside its limits (F9): the mesh is not rebuilt",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: and of its parent",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: set_params of a part with a slide written by hand on a revolute connection",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a compliance written by hand on a revolute joint reads null in the report and the joints report (F10), and the limits beside it still read",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "set_params seats through the one writer: the part is rebuilt, its child seated on the moved socket, and the hand-written compliance is gone",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "detaching a loop's closing follower clears its partner's statement too",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "and the partner is posed by hand again",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "detaching a driver leaves its followers' statements, which report that the driver states no DOF connection",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "and once the driver is deleted, that it is gone",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "no Blender driver or constraint was made",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
}
|
||||
],
|
||||
"hostErrors": [],
|
||||
"readings": {
|
||||
"closed": 6.4e-07,
|
||||
"jump": 49.0,
|
||||
"longest receipt": 16000.0,
|
||||
"ram closed at 110": 2.9e-07,
|
||||
"ram closed at 45": 5.3e-07,
|
||||
"ram closed at 60": 2.8e-07,
|
||||
"ram solved at 110": 5.7e-14,
|
||||
"ram solved at 45": 0.0,
|
||||
"ram solved at 60": 0.0,
|
||||
"ratio": 0.0,
|
||||
"rows in the first receipt": 32.0,
|
||||
"slid": 1e-07,
|
||||
"solved": 3.3e-05
|
||||
},
|
||||
"ok": true
|
||||
}
|
||||
486
surfaces/blender/tests/live/kitbash_plates.py
Normal file
486
surfaces/blender/tests/live/kitbash_plates.py
Normal file
|
|
@ -0,0 +1,486 @@
|
|||
"""Live proof, in a background Blender, of brokkr_kitbash.plates through run_intent: a plate table written onto a
|
||||
mechanical-kit link under a pin, each plate's mesh, fit children and anchor empties against plate.build's own answer
|
||||
under the frame, the Kit Bevels, joints unchanged by the plates, a roll of the pin carrying every plate, a hose between
|
||||
two port empties either side of the pin across its range, a rebuild in place, each refusal leaving the scene as it
|
||||
was, and a slab with a fit row of every kind written into a child per material. Not part of the unittest run: it needs Blender.
|
||||
|
||||
blender --background --factory-startup --python-exit-code 1 --python surfaces/blender/tests/live/kitbash_plates.py -- <out>
|
||||
|
||||
Run it with private BLENDER_USER_CONFIG, BLENDER_USER_EXTENSIONS and BLENDER_USER_SCRIPTS directories (it refuses
|
||||
without them). <out> is an absolute path; writes <out>.result.json and exits 1 when a check failed.
|
||||
|
||||
Bounds follow lodur:ruling:deterministic-bound-margin: each sits at the geometric mean of the shipped worst reading
|
||||
and the least claimed mutant's, both written beside it; the result file carries the readings.
|
||||
|
||||
The checks run inside one try: an uncaught error is a failed check that names the section it happened in, and the
|
||||
result file is written and the checks printed whatever happened.
|
||||
"""
|
||||
import copy
|
||||
import importlib
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import traceback
|
||||
import types
|
||||
from pathlib import Path
|
||||
|
||||
import bpy
|
||||
import numpy as np
|
||||
from mathutils import Euler, Matrix
|
||||
|
||||
SURFACE = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(SURFACE / "tools"))
|
||||
import private_dirs # noqa: E402
|
||||
|
||||
_refused = private_dirs.refusal(os.environ, os.path.expanduser("~"), lambda kind: bpy.utils.user_resource(kind))
|
||||
if _refused:
|
||||
raise SystemExit(_refused)
|
||||
OUT = sys.argv[sys.argv.index("--") + 1]
|
||||
if not Path(OUT).is_absolute():
|
||||
raise SystemExit(f"{OUT!r} is not an absolute path")
|
||||
package = types.ModuleType("brokkr_bridge")
|
||||
package.__path__ = [str(SURFACE / "brokkr_bridge")]
|
||||
sys.modules["brokkr_bridge"] = package
|
||||
from brokkr_bridge import blender_target as bt # noqa: E402
|
||||
|
||||
import addon_utils # noqa: E402
|
||||
|
||||
reference = types.ModuleType("brokkr_kitbash_plates") # plate.py as the unit tests load it: what every reading here is taken against
|
||||
reference.__path__ = [str(SURFACE / "brokkr_kitbash")]
|
||||
sys.modules["brokkr_kitbash_plates"] = reference
|
||||
plate = importlib.import_module("brokkr_kitbash_plates.plate")
|
||||
|
||||
sys.path.append(str(SURFACE))
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
for module in ("brokkr_mesh_polish", "brokkr_kitbash"):
|
||||
addon_utils.enable(module, default_set=True)
|
||||
target = bt.BrokkrBlenderTarget(bpy)
|
||||
WORK = Path(tempfile.mkdtemp(prefix="brokkr-kitbash-plates-"))
|
||||
target.configure_action_dirs("", str(WORK))
|
||||
target.reload_host_actions()
|
||||
R = {"blender": bpy.app.version_string, "checks": [], "hostErrors": target.host_actions()[1], "readings": {}, "reports": {}}
|
||||
COUNT, SECTION = [0], ["setup"]
|
||||
# The mutants of brokkr_kitbash.plates this suite was run against, each failing a check: X1 the frame applied twice (the
|
||||
# basis host_world @ frame); X2 a rebuild that deletes the plate and makes it again; X3 an anchor left at its plate's
|
||||
# origin; X4 a plate written with no parent; X5 the host's inverse as the parent inverse; X6 a kept anchor not moved; X7
|
||||
# the plate's Kit Bevel at shell's 30 degrees; X8 the panels' at 12; X9 a fit child parented to the host; X10 an
|
||||
# anchor's basis under the frame again; X11 stale children kept; X12 no sharp_face written; X13 no material refusal;
|
||||
# X14 no refusal of a taken child or anchor name; X15 a row's fittings not written (plan leaves entry["fits"] out); X16 no
|
||||
# refusal of a fit's missing material.
|
||||
#
|
||||
# Metres between a written vertex in the world (the object's matrix_world on its mesh's own coordinates) and the same
|
||||
# vertex of plate.build's answer under the frame this script holds, over every plate and fit child of the suite; inf
|
||||
# when a face differs or is smooth. Shipped worst 8.5e-08 (float32 meshes and matrices); least claimed mutant 1.7 (X1);
|
||||
# the geometric mean, separation 4400 each side.
|
||||
WRITTEN = 3.8e-4
|
||||
# Largest entry of an anchor empty's matrix_world minus the frame @ plate.build's anchor matrix. Shipped worst 2.2e-07;
|
||||
# least claimed mutant 0.041 (X6, on the rebuild that moves a port 0.05 along its face; X3 reads 1.5, X10 1.4);
|
||||
# separation 430 each side.
|
||||
ANCHORED = 9.5e-5
|
||||
# Largest entry of matrix_world after a roll of the pin minus (the shin's own motion @ matrix_world before), over
|
||||
# every plate, fit child and anchor on the shin. Shipped worst 1.0e-07; least claimed mutant 0.23 (X4: the plate stays
|
||||
# where it stood); separation 1500 each side.
|
||||
CARRIED = 1.5e-4
|
||||
# Largest entry of a kept anchor's basis after a rebuild minus plate.build's matrix for the rebuilt row. Shipped worst
|
||||
# 2.1e-07; least claimed mutant 0.049 (X6); separation 480 each side.
|
||||
MOVED = 1.0e-4
|
||||
# Metres along a port's z between the port, as plate.build places it on the panel's top, and the nearest hose vertex
|
||||
# within 1.5 hose radii of it; 1 when no vertex stands that near, or no hose was made. Shipped worst 3.9e-08; least
|
||||
# claimed mutant 1 (X10: the hose is routed from where the empty stands, off the plate; under X1, X3 and X4 hose
|
||||
# refuses); separation 5000 each side.
|
||||
PORTED = 2.0e-4
|
||||
RADIUS, CLEARANCE = 0.006, 0.005
|
||||
|
||||
|
||||
def check(name, ok, detail=None):
|
||||
R["checks"].append({"name": name, "ok": bool(ok), "detail": None if ok else detail}) # what was seen, when it was not what was promised
|
||||
|
||||
|
||||
def reading(name, value):
|
||||
R["readings"][name] = max(R["readings"].get(name, 0.0), float(value))
|
||||
return float(value)
|
||||
|
||||
|
||||
def section(name):
|
||||
SECTION[0] = name
|
||||
print("SECTION", name, flush=True)
|
||||
|
||||
|
||||
def send(action, **fields):
|
||||
COUNT[0] += 1
|
||||
receipt = target.run_intent(bpy.context, {"commandId": f"live-{COUNT[0]}", "requestedBy": "test/driver", "action": action, **fields})
|
||||
result = None
|
||||
if receipt.get("hostResult"):
|
||||
try:
|
||||
result = json.loads(receipt["hostResult"])
|
||||
except ValueError:
|
||||
result = None
|
||||
print("SEND", action, receipt["status"], str(receipt["message"])[:400], flush=True)
|
||||
return receipt, result
|
||||
|
||||
|
||||
def scene_state():
|
||||
return {o.name: (o.parent and o.parent.name, o.type, o.session_uid, np.round(np.array(o.matrix_basis), 6).tolist(), np.round(np.array(o.matrix_parent_inverse), 6).tolist(),
|
||||
{k: repr(o[k]) for k in sorted(o.keys())}, [(m.name, m.type, m.show_viewport) for m in o.modifiers],
|
||||
o.data.name if o.type == "MESH" else None, len(o.data.polygons) if o.type == "MESH" else None,
|
||||
[s.material and s.material.name for s in o.material_slots],
|
||||
np.round(points(o)[:8], 6).tolist() if o.type == "MESH" else None)
|
||||
for o in bpy.data.objects}, sorted(m.name for m in bpy.data.meshes), sorted(c.name for c in bpy.data.collections)
|
||||
|
||||
|
||||
def refused(label, fields, expected):
|
||||
state = scene_state()
|
||||
receipt, _ = send("brokkr_kitbash.plates", **fields)
|
||||
check(f"refused, scene unchanged: {label}", receipt["status"] != "accepted" and expected in str(receipt["message"]) and scene_state() == state,
|
||||
[receipt["status"], receipt["message"]])
|
||||
|
||||
|
||||
def place(name, part, params=""):
|
||||
send("brokkr_kitbash.place_part", part=part, object_name=name, params=params)
|
||||
return bpy.data.objects[name]
|
||||
|
||||
|
||||
def points(obj):
|
||||
out = np.zeros(3 * len(obj.data.vertices))
|
||||
obj.data.vertices.foreach_get("co", out)
|
||||
return out.reshape(-1, 3)
|
||||
|
||||
|
||||
def world(obj):
|
||||
return np.array(obj.matrix_world, dtype=np.float64)
|
||||
|
||||
|
||||
def under(matrix, V):
|
||||
return np.asarray(V) @ matrix[:3, :3].T + matrix[:3, 3]
|
||||
|
||||
|
||||
def joined(parts):
|
||||
"""Meshes (V, faces) as one: the vertices in order, and each face's vertex indices."""
|
||||
offsets = np.cumsum([0] + [len(V) for V, _ in parts[:-1]])
|
||||
return np.vstack([V for V, _ in parts]), [[int(k + offset) for k in face] for (_, faces), offset in zip(parts, offsets) for face in faces]
|
||||
|
||||
|
||||
def written(obj, frame, parts):
|
||||
"""How far the object's mesh stands, in the world, from the meshes (V, faces) under frame; inf when the vertex
|
||||
count, a face or a smooth face differs."""
|
||||
V, faces = joined(parts)
|
||||
if len(obj.data.vertices) != len(V) or [list(p.vertices) for p in obj.data.polygons] != faces or any(p.use_smooth for p in obj.data.polygons):
|
||||
return math.inf
|
||||
return float(np.abs(under(world(obj), points(obj)) - under(frame, V)).max())
|
||||
|
||||
|
||||
def off(V, port):
|
||||
"""Metres along a port's z between the port and the nearest of the vertices within 1.5 hose radii of it; 1 when
|
||||
none stands that near."""
|
||||
near = V[np.linalg.norm(V - port[:3, 3], axis=1) < 1.5 * RADIUS]
|
||||
return abs(float(((near - port[:3, 3]) @ port[:3, 2]).min())) if len(near) else 1.0
|
||||
|
||||
|
||||
def bevel(obj):
|
||||
modifier = obj.modifiers.get("Kit Bevel")
|
||||
return None if modifier is None else (round(modifier.width, 6), round(math.degrees(modifier.angle_limit), 4), modifier.segments, modifier.limit_method)
|
||||
|
||||
|
||||
def fits_of(entry, row):
|
||||
"""{material: [meshes]} of what a built entry's fit children hold: panels, bolts, then the row's fittings."""
|
||||
held = {}
|
||||
if row["clad"]:
|
||||
for material, mesh in ((row["clad"]["mat"], entry["panels"]), (row["clad"]["bolt_mat"], entry["bolts"])):
|
||||
if len(mesh[1]):
|
||||
held.setdefault(material, []).append(mesh)
|
||||
for material, mesh in entry["fits"].items():
|
||||
held.setdefault(material, []).append(mesh)
|
||||
return held
|
||||
|
||||
|
||||
def proven(label, document, side, prefix, host, frame, report):
|
||||
"""Every object one accepted call wrote, against plate.build of the same document: the plates' meshes, parents,
|
||||
bases, bevels and properties, each fit child, each anchor empty, and the report's rows."""
|
||||
table = plate.check(document)
|
||||
built = plate.build(table, side)
|
||||
host_world = world(host) if host else np.eye(4)
|
||||
ok, detail, rows = True, [], []
|
||||
for entry in built:
|
||||
row, name = table["plates"][entry["row"]], prefix + entry["name"]
|
||||
obj = bpy.data.objects.get(name)
|
||||
if obj is None or obj.type != "MESH":
|
||||
ok, detail = False, detail + [f"{name}: not made"]
|
||||
continue
|
||||
apart = reading("written", written(obj, frame, [entry["solid"]]))
|
||||
basis = np.abs(np.array(obj.matrix_basis) - np.linalg.inv(host_world) @ frame).max()
|
||||
facts = {"apart": apart < WRITTEN, "parent": obj.parent == host, "inverse": np.array_equal(np.array(obj.matrix_parent_inverse), np.eye(4)), "basis": basis < WRITTEN,
|
||||
"bevel": bevel(obj) == ((round(row["bevel"], 6), 12.0, 2, "ANGLE") if row["bevel"] > 0 else None), "kind": obj.get("plate_kind") == "hard",
|
||||
"record": json.loads(obj.get("kit_plate", "null")) == {**row, "side": entry["side"], "prefix": prefix},
|
||||
"material": obj.material_slots[0].material.name == row["mat"], "noPart": "kit_part" not in obj}
|
||||
held = fits_of(entry, row)
|
||||
children = sorted(child.name for child in obj.children if child.type == "MESH")
|
||||
facts["children"] = children == sorted(f"{name}.fit.{material}" for material in held)
|
||||
for material, parts in held.items():
|
||||
child = bpy.data.objects.get(f"{name}.fit.{material}")
|
||||
if child is None or child.parent != obj:
|
||||
facts[f"fit {material}"] = False
|
||||
continue
|
||||
panels = bool(row["clad"]) and material == row["clad"]["mat"]
|
||||
facts[f"fit {material}"] = (reading("written", written(child, frame, parts)) < WRITTEN and np.array_equal(np.array(child.matrix_basis), np.eye(4))
|
||||
and np.array_equal(np.array(child.matrix_parent_inverse), np.eye(4)) and [s.material.name for s in child.material_slots] == [material]
|
||||
and bevel(child) == ((round(row["clad"]["bevel"], 6), 20.0, 1, "ANGLE") if panels and row["clad"]["bevel"] > 0 else None))
|
||||
empties = sorted(child.name for child in obj.children if child.type == "EMPTY" and "kit_anchor" in child)
|
||||
names = []
|
||||
for anchor in entry["anchors"]:
|
||||
mark = anchor["kind"] == "mark"
|
||||
names.append(f"{name}.{'mark' if mark else 'port'}.{anchor['name']}")
|
||||
empty = bpy.data.objects.get(names[-1])
|
||||
if empty is None or empty.parent != obj or empty.type != "EMPTY":
|
||||
facts[names[-1]] = False
|
||||
continue
|
||||
record = {"kind": "mark", "id": anchor["name"], "height": anchor["height"]} if mark else {"kind": "hose_port", "name": anchor["name"]}
|
||||
facts[names[-1]] = (reading("anchored", np.abs(world(empty) - frame @ np.array(anchor["matrix"])).max()) < ANCHORED and json.loads(empty.get("kit_anchor", "null")) == record
|
||||
and np.array_equal(np.array(empty.matrix_parent_inverse), np.eye(4)))
|
||||
facts["anchors"] = empties == sorted(names)
|
||||
rows.append({"name": name, **entry["report"], "anchors": names})
|
||||
if not all(facts.values()):
|
||||
ok, detail = False, detail + [f"{name}: {[k for k, v in facts.items() if not v]}"]
|
||||
reported = report and [{k: v for k, v in row.items() if k != "rebuilt"} for row in report["plates"]]
|
||||
check(f"written-is-built: {label}", ok and reported == rows and report["host"] == (host.name if host else None) and report["side"] == side, detail or [reported, rows])
|
||||
return table, built
|
||||
|
||||
|
||||
try:
|
||||
section("knee")
|
||||
for name in ("khaki", "olive_light", "gunmetal", "steel"):
|
||||
bpy.data.materials.new(name)
|
||||
STRUT = "length=0.8;width=0.08;thickness=0.05"
|
||||
thigh = place("Thigh", "strut", STRUT)
|
||||
send("setObjectTransform", targetObjectName="Thigh", location=[0.3, -0.2, 0.1], rotationEuler=[0.2, -0.3, 0.5]) # no frame here is the identity
|
||||
shin = place("Shin", "strut", STRUT)
|
||||
send("brokkr_kitbash.attach", object_name="Shin", socket="end_a", parent_name="Thigh", parent_socket="end_b_back", roll=0.0)
|
||||
send("brokkr_kitbash.joint", object_name="Shin", record=json.dumps({"limits": [-20, 20]}))
|
||||
bpy.context.view_layer.update()
|
||||
_, joints_before = send("brokkr_kitbash.joints", object_name="Thigh")
|
||||
count = len(bpy.data.objects)
|
||||
|
||||
def slab(name, at, port, more=None):
|
||||
"""A plate facing the link's -y, 0.3 by 0.5, with one panel, a hose port on it and a numeral under it."""
|
||||
return {"name": name, "mat": "khaki", "bevel": 0.006,
|
||||
"slab": {"at": at, "normal": [0, -1, 0], "up": [0, 0, 1], "outline": {"w": 0.3, "h": 0.5, "clip": 0.04}, "thick": 0.04},
|
||||
"clad": {"mat": "olive_light", "min_area": 0.01, "lifts": [0.01, 0.015], "inset": 0.03, "gap": 0.02, "split": 99.0, "seed": 7, "bolt_r": 0.008, **(more or {})},
|
||||
"fits": [{"kind": "hose_port", "name": port[0], "at": port[1]}, {"kind": "mark", "id": "num", "at": [0.0, -0.15], "height": 0.08}]}
|
||||
|
||||
def doc(*rows):
|
||||
return {"schema": "brokkr.plates.v0", "plates": [copy.deepcopy(r) for r in rows]}
|
||||
|
||||
THIGH = doc(slab("Guard", [0.0, -0.12, 0.35], ("feed", [0.0, 0.1])))
|
||||
SHIN = doc(slab("Guard", [0.0, -0.115, 0.45], ("return", [0.0, -0.1]), {"bevel": 0.009}))
|
||||
section("on the links")
|
||||
receipt, report = send("brokkr_kitbash.plates", host="Thigh", prefix="Thigh.", table=json.dumps(THIGH))
|
||||
check("plates on the thigh are accepted and none is a rebuild", receipt["status"] == "accepted" and [row["rebuilt"] for row in report["plates"]] == [False], [receipt["status"], receipt["message"]])
|
||||
R["reports"]["thigh"] = report
|
||||
bpy.context.view_layer.update()
|
||||
_, thigh_built = proven("a plate on the thigh, the frame the host's", THIGH, 1, "Thigh.", thigh, world(thigh), report)
|
||||
receipt, report = send("brokkr_kitbash.plates", host="Shin", prefix="Shin.", table=json.dumps(SHIN))
|
||||
bpy.context.view_layer.update()
|
||||
shin_table, shin_built = proven("a plate on the shin, under the pin", SHIN, 1, "Shin.", shin, world(shin), report)
|
||||
guard = bpy.data.objects["Thigh.Guard"]
|
||||
check("a plate with a panel and its bolts has two fit children and two anchors, and the panel's child alone a bevel",
|
||||
sorted(c.name for c in guard.children) == ["Thigh.Guard.fit.gunmetal", "Thigh.Guard.fit.olive_light", "Thigh.Guard.mark.num", "Thigh.Guard.port.feed"]
|
||||
and len(bpy.data.objects["Thigh.Guard.fit.gunmetal"].data.polygons) == len(thigh_built[0]["bolts"][1]) > 0 and bevel(bpy.data.objects["Shin.Guard.fit.olive_light"]) == (0.009, 20.0, 1, "ANGLE")
|
||||
and len(bpy.data.objects) == count + 10, [sorted(c.name for c in guard.children), len(bpy.data.objects["Thigh.Guard.fit.gunmetal"].data.polygons), len(bpy.data.objects) - count])
|
||||
_, joints_after = send("brokkr_kitbash.joints", object_name="Thigh")
|
||||
check("roll-carries: joints lists the same rows with the plates as without", joints_before is not None and joints_after == joints_before, joints_after)
|
||||
_, parts = send("brokkr_kitbash.report")
|
||||
check("a plate is no kit part: report lists the two struts", parts is not None and [row["object"] for row in parts["parts"]] == ["Shin", "Thigh"], parts and [row.get("object") for row in parts["parts"]])
|
||||
|
||||
section("a frame of its own")
|
||||
F = np.array(Matrix.Translation((1.5, 0.4, -0.3)) @ Euler((0.7, 0.2, -1.1)).to_matrix().to_4x4(), dtype=np.float64)
|
||||
TWO = doc({"name": "Wing", "mat": "khaki", "bevel": 0.004, "sides": "both",
|
||||
"slab": {"at": [0.4, 0.1, 0.0], "normal": [1, 0.2, 0.1], "outline": [[-0.2, 0.3], [0.2, 0.3], [0.3, 0.0], [0.2, -0.3], [-0.2, -0.3]], "thick": 0.05},
|
||||
"clad": {"mat": "steel", "bolt_mat": "steel", "min_area": 0.01, "lifts": [0.01, 0.02], "inset": 0.03, "gap": 0.02, "split": 0.1, "seed": [3, 4], "bolt_r": 0.006},
|
||||
"fits": [{"kind": "hose_port", "name": "p", "at": [0.0, 0.0], "lift": 0.01}]},
|
||||
{"name": "Lump", "mat": "gunmetal", "points": [[0, 0, 0], [0.2, 0, 0], [0, 0.2, 0], [0, 0, 0.2], [0.15, 0.15, 0.15]]})
|
||||
for side, prefix in ((1, "F."), (-1, "G.")):
|
||||
receipt, report = send("brokkr_kitbash.plates", host="Thigh", prefix=prefix, frame=json.dumps(F.tolist()), side=side, table=json.dumps(TWO))
|
||||
bpy.context.view_layer.update()
|
||||
check(f"plates under a stated frame are accepted at side {side}", receipt["status"] == "accepted", [receipt["status"], receipt["message"]])
|
||||
proven(f"a two-sided row and a bare one under a stated frame, side {side}: panels and bolts of one material are one child", TWO, side, prefix, thigh, F, report)
|
||||
check("a bare plate has no child and no bevel; a two-sided row is two plates",
|
||||
not bpy.data.objects["F.Lump"].children and bevel(bpy.data.objects["F.Lump"]) is None and all(name in bpy.data.objects for name in ("F.Wing.R", "F.Wing.L", "G.Wing.R", "G.Wing.L")), None)
|
||||
receipt, report = send("brokkr_kitbash.plates", prefix="Free.", table=json.dumps(TWO))
|
||||
bpy.context.view_layer.update()
|
||||
proven("no host and no frame: the table's frame is the world", TWO, 1, "Free.", None, np.eye(4), report)
|
||||
|
||||
section("roll")
|
||||
carried = [o for o in bpy.data.objects if o.name.startswith("Shin.")]
|
||||
stays = [o for o in bpy.data.objects if o.name.startswith(("Thigh.", "F.", "Free."))]
|
||||
before = {o.name: world(o) for o in carried + stays + [shin]}
|
||||
receipt, _ = send("brokkr_kitbash.roll", object_name="Shin", roll=15.0)
|
||||
bpy.context.view_layer.update()
|
||||
motion = world(shin) @ np.linalg.inv(before["Shin"])
|
||||
check("the roll moved the shin", receipt["status"] == "accepted" and np.abs(motion - np.eye(4)).max() > 0.05, receipt["message"])
|
||||
check("roll-carries: every plate, fit child and anchor on the shin stands at the roll @ where it stood", len(carried) == 5
|
||||
and reading("carried", max(np.abs(world(o) - motion @ before[o.name]).max() for o in carried)) < CARRIED, R["readings"])
|
||||
check("what stands on the thigh or on nothing stayed", all(np.array_equal(world(o), before[o.name]) for o in stays), None)
|
||||
send("brokkr_kitbash.roll", object_name="Shin", roll=0.0)
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
section("hose")
|
||||
ports = [bpy.data.objects["Thigh.Guard.port.feed"], bpy.data.objects["Shin.Guard.port.return"]]
|
||||
HOSE = {"object_name": "Feed", "start": ports[0].name, "end": ports[1].name, "radius": RADIUS, "clearance": CLEARANCE, "joint": json.dumps({"socket": "Shin:end_a_back", "standoff": 0.25})}
|
||||
receipt, report = send("brokkr_kitbash.hose", **HOSE)
|
||||
R["reports"]["hose"] = report
|
||||
check("hose-between-ports: a hose routes between the two plates' port empties through the pin point, clear across the pin's range",
|
||||
receipt["status"] == "accepted" and report["hoses"] == 1 and report["nonManifoldEdges"] == 0 and report["rolls"] >= 9 and report["clearance"] >= CLEARANCE
|
||||
and report["worstClearance"] >= CLEARANCE, [receipt["status"], receipt["message"], report])
|
||||
if receipt["status"] == "accepted":
|
||||
feed = bpy.data.objects["Feed"]
|
||||
bpy.context.view_layer.update()
|
||||
V = under(world(feed), points(feed))
|
||||
expected = [world(shin if index else thigh) @ np.array(next(a for a in plate.build(plate.check(SHIN if index else THIGH))[0]["anchors"] if a["kind"] == "hose_port")["matrix"]) for index in (0, 1)]
|
||||
check("hose-between-ports: each end stands on its port, as plate.build places it on the panel's top, and leaves along its z",
|
||||
all(reading("ported", off(V, port)) < PORTED for port in expected) and feed.parent == ports[0], R["readings"])
|
||||
else:
|
||||
reading("ported", 1.0)
|
||||
|
||||
section("rebuild")
|
||||
wing = bpy.data.objects["F.Wing.R"]
|
||||
uid, mesh_uid = wing.session_uid, wing.data.session_uid
|
||||
foreign = bpy.data.objects.new("Foreign", None)
|
||||
bpy.context.scene.collection.objects.link(foreign)
|
||||
foreign.parent = wing
|
||||
later = wing.modifiers.new("Hers", "TRIANGULATE")
|
||||
wing.data.materials.append(bpy.data.materials["gunmetal"])
|
||||
AGAIN = copy.deepcopy(TWO)
|
||||
AGAIN["plates"][0]["slab"]["thick"] = 0.08
|
||||
AGAIN["plates"][0]["fits"] = [{"kind": "hose_port", "name": "p", "at": [0.05, 0.0], "lift": 0.01}, {"kind": "mark", "id": "n", "at": [0.0, 0.1], "height": 0.05}]
|
||||
port_uid = bpy.data.objects["F.Wing.R.port.p"].session_uid
|
||||
count = len(bpy.data.objects)
|
||||
receipt, report = send("brokkr_kitbash.plates", host="Thigh", prefix="F.", frame=json.dumps(F.tolist()), table=json.dumps(AGAIN))
|
||||
bpy.context.view_layer.update()
|
||||
check("rebuild-in-place: a second call on the same names reports every plate rebuilt", receipt["status"] == "accepted" and [row["rebuilt"] for row in report["plates"]] == [True, True, True],
|
||||
[receipt["status"], receipt["message"]])
|
||||
_, again_built = proven("the rebuilt plates are the changed table's", AGAIN, 1, "F.", thigh, F, report)
|
||||
check("rebuild-in-place: the plate is the object it was, on the mesh it had, with her child, her modifier after the Kit Bevel and her second material slot",
|
||||
bpy.data.objects["F.Wing.R"].session_uid == uid and wing.data.session_uid == mesh_uid and foreign.parent == wing and [m.name for m in wing.modifiers] == ["Kit Bevel", "Hers"]
|
||||
and [s.material.name for s in wing.material_slots] == ["khaki", "gunmetal"] and len(bpy.data.objects) == count + 2, [m.name for m in wing.modifiers])
|
||||
port = bpy.data.objects["F.Wing.R.port.p"]
|
||||
check("rebuild-in-place: a kept anchor is the empty it was, moved to the row's new place", port.session_uid == port_uid
|
||||
and reading("moved", np.abs(np.array(port.matrix_basis) - np.array(next(a for a in again_built[0]["anchors"] if a["name"] == "p")["matrix"])).max()) < MOVED, R["readings"])
|
||||
BARE = copy.deepcopy(AGAIN)
|
||||
del BARE["plates"][0]["clad"]
|
||||
BARE["plates"][0]["fits"] = [{"kind": "mark", "id": "n", "at": [0.0, 0.1], "height": 0.05}]
|
||||
receipt, report = send("brokkr_kitbash.plates", host="Thigh", prefix="F.", frame=json.dumps(F.tolist()), table=json.dumps(BARE))
|
||||
bpy.context.view_layer.update()
|
||||
proven("a rebuild without clad removes the fit child, and the anchor the row no longer names", BARE, 1, "F.", thigh, F, report)
|
||||
check("rebuild-in-place: the dropped child and anchor are gone, her child stays, and no mesh is left behind",
|
||||
"F.Wing.R.fit.steel" not in bpy.data.objects and "F.Wing.R.port.p" not in bpy.data.objects and foreign.parent == wing and "F.Wing.R.fit.steel" not in bpy.data.meshes
|
||||
and len(bpy.data.objects) == count + 2 - 4, sorted(o.name for o in bpy.data.objects))
|
||||
receipt, report = send("brokkr_kitbash.plates", host="Shin", prefix="F.", table=json.dumps(AGAIN))
|
||||
bpy.context.view_layer.update()
|
||||
proven("a rebuild onto another host and frame makes the child and anchor again", AGAIN, 1, "F.", shin, world(shin), report)
|
||||
check("rebuild-in-place: still the same object", bpy.data.objects["F.Wing.R"].session_uid == uid and wing.parent == shin, None)
|
||||
|
||||
section("refusals")
|
||||
ONE = doc({"name": "Lump", "mat": "gunmetal", "points": [[0, 0, 0], [0.2, 0, 0], [0, 0.2, 0], [0, 0, 0.2]]})
|
||||
CLAD = slab("Guard", [0.0, -0.12, 0.35], ("feed", [0.0, 0.1]))
|
||||
call = lambda document, **more: {"host": "Thigh", "prefix": "N.", "table": json.dumps(document), **more} # noqa: E731
|
||||
refused("a table the format refuses, by its path", call(doc({**ONE["plates"][0], "colour": "red"})), "table: plates[0].colour: unknown key")
|
||||
refused("a row that bounds no solid", call(doc({"name": "Flat", "mat": "gunmetal", "points": [[0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0]]})), "table: plates[0]")
|
||||
refused("a table that is not JSON", call(ONE, table="{"), "table is not JSON")
|
||||
refused("a row material the file lacks", call(doc({**ONE["plates"][0], "mat": "brass"})), "table.plates[0].mat: no material named 'brass'")
|
||||
refused("a clad material the file lacks", call(doc({**CLAD, "clad": {**CLAD["clad"], "mat": "brass"}})), "table.plates[0].clad.mat: no material named 'brass'")
|
||||
refused("a bolt material the file lacks", call(doc({**CLAD, "clad": {**CLAD["clad"], "bolt_mat": "brass"}})), "table.plates[0].clad.bolt_mat: no material named 'brass'")
|
||||
refused("a second row's missing material, after a first row that would be written", call(doc(ONE["plates"][0], {**ONE["plates"][0], "name": "Other", "mat": "brass"})), "table.plates[1].mat")
|
||||
refused("a host that is not there", call(ONE, host="Hip"), "host: no object named 'Hip'")
|
||||
scaled = bpy.data.objects.new("Scaled", None)
|
||||
bpy.context.scene.collection.objects.link(scaled)
|
||||
scaled.scale = (1.0, 2.0, 1.0)
|
||||
bpy.context.view_layer.update()
|
||||
refused("a host that is scaled", call(ONE, host="Scaled"), "'Scaled' is scaled, mirrored or sheared")
|
||||
eye = np.eye(4)
|
||||
refused("a frame that is not JSON", call(ONE, frame="[[1, 0"), "frame is not JSON")
|
||||
refused("a frame of three rows", call(ONE, frame=json.dumps(eye[:3].tolist())), "frame must be a JSON array of 4 rows of 4 finite numbers")
|
||||
refused("a frame with a number that is not finite", call(ONE, frame=json.dumps(eye.tolist()).replace("1.0", "NaN", 1)), "frame must be a JSON array of 4 rows of 4 finite numbers")
|
||||
refused("a frame that scales", call(ONE, frame=json.dumps((eye * [2, 1, 1, 1]).tolist())), "frame is not rigid")
|
||||
refused("a frame that mirrors", call(ONE, frame=json.dumps((eye * [-1, 1, 1, 1]).tolist())), "frame is not rigid")
|
||||
refused("a frame whose last row is no frame's", call(ONE, frame=json.dumps((eye + np.outer([0, 0, 0, 1], [0.5, 0, 0, 0])).tolist())), "frame is not rigid")
|
||||
refused("side 0", call(ONE, side=0), "side must be 1 or -1")
|
||||
refused("a prefix with a character the names do not take", call(ONE, prefix="a-b"), "prefix 'a-b' must be 0 to 32 characters")
|
||||
refused("a plate's name taken by an object plates did not make", call(ONE, prefix="", table=json.dumps(doc({**ONE["plates"][0], "name": "Shin"}))), "an object named 'Shin' exists and is no plate")
|
||||
stray = bpy.data.objects.new("N.Guard.fit.olive_light", bpy.data.meshes.new("stray"))
|
||||
bpy.context.scene.collection.objects.link(stray)
|
||||
refused("a fit child's name taken, the plate new", call(doc(CLAD)), "an object named 'N.Guard.fit.olive_light' exists and is not this plate's")
|
||||
stray.name = "Thigh.Guard.port.spare"
|
||||
spare = copy.deepcopy(THIGH)
|
||||
spare["plates"][0]["fits"].append({"kind": "hose_port", "name": "spare", "at": [0.05, 0.0]})
|
||||
refused("an anchor's name taken by an object that is no child of the plate, on a rebuild", call(spare, prefix="Thigh."), "an object named 'Thigh.Guard.port.spare' exists and is not this plate's")
|
||||
refused("a row whose name is another row's fit child", call(doc(CLAD, {**ONE["plates"][0], "name": "Guard.fit.gunmetal"})), "the name 'N.Guard.fit.gunmetal' is made twice")
|
||||
refused("a made name over 63 bytes", call(doc({**CLAD, "name": "G" * 40}), prefix="P" * 20), "bytes, over the 63 an object's name holds")
|
||||
refused("a host that is the plate", call(THIGH, host="Thigh.Guard", prefix="Thigh."), "a plate is no host of itself")
|
||||
refused("a host under the plate", call(THIGH, host="Thigh.Guard.port.feed", prefix="Thigh."), "a plate is no host of itself")
|
||||
many = doc(*[{"name": f"a{index:03d}", "mat": "gunmetal", "points": [[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]]} for index in range(256)])
|
||||
refused("a report a receipt does not carry", call(many, table=json.dumps(many, separators=(",", ":"))), "over the 16000 a receipt carries")
|
||||
twin = bpy.data.objects.new("Twin", guard.data)
|
||||
bpy.context.scene.collection.objects.link(twin)
|
||||
refused("a plate that shares its mesh", call(THIGH, prefix="Thigh."), "'Thigh.Guard' shares its mesh")
|
||||
bpy.data.objects.remove(twin)
|
||||
receipt, _ = send("brokkr_kitbash.freeze", object_name="Thigh.Guard")
|
||||
refused("a frozen plate", call(THIGH, prefix="Thigh."), "'Thigh.Guard' is frozen")
|
||||
send("brokkr_kitbash.thaw", object_name="Thigh.Guard")
|
||||
receipt, report = send("brokkr_kitbash.plates", host="Thigh", prefix="Thigh.", table=json.dumps(THIGH))
|
||||
bpy.context.view_layer.update()
|
||||
check("thawed, the plate is rebuilt", receipt["status"] == "accepted" and report["plates"][0]["rebuilt"], [receipt["status"], receipt["message"]])
|
||||
proven("the thawed plate", THIGH, 1, "Thigh.", thigh, world(thigh), report)
|
||||
|
||||
section("fittings")
|
||||
for name in ("pit", "machine"):
|
||||
bpy.data.materials.new(name)
|
||||
KIT = slab("Kit", [0.0, -0.3, 0.3], ("feed", [0.0, 0.1]))
|
||||
KIT["sides"] = "both"
|
||||
KIT["fits"] += [{"kind": "bolts", "inset": 0.012, "spacing": 0.08, "params": "r=0.006", "mat": "gunmetal"},
|
||||
{"kind": "part", "part": "slot", "at": [0.0, 0.18], "params": "w=0.08; h=0.02", "mat": "khaki"},
|
||||
{"kind": "part", "part": "pit", "at": [0.0, 0.18], "params": "w=0.08; h=0.02", "mat": "pit"},
|
||||
{"kind": "part", "part": "vents", "at": [-0.06, 0.03], "params": "w=0.06; h=0.012; count=3", "mat": "khaki"},
|
||||
{"kind": "part", "part": "pit", "at": [-0.06, 0.03], "params": "w=0.06; h=0.012; depth=0.01; count=3; pitch=0.0324", "mat": "pit"},
|
||||
{"kind": "part", "part": "access_port", "at": [0.07, -0.1], "params": "r=0.03", "mat": "machine"},
|
||||
{"kind": "part", "part": "port_bolts", "at": [0.07, -0.1], "params": "r=0.03", "mat": "gunmetal"},
|
||||
{"kind": "part", "part": "handle", "at": [-0.07, -0.1], "roll": 90.0, "params": "length=0.1; lift=0.04; r=0.004", "mat": "gunmetal"},
|
||||
{"kind": "part", "part": "eye", "at": [0.08, 0.12], "lift": 0.002, "params": "size=0.03", "mat": "gunmetal"},
|
||||
{"kind": "part", "part": "louvres", "at": [0.0, -0.18], "params": "w=0.1; h=0.1; n=3; depth=0.02; frame=0.02", "mat": "steel"},
|
||||
{"kind": "step", "outline": [[-0.1, -0.06], [0.1, -0.06], [0.1, 0.06], [-0.1, 0.06]], "at": [0.0, 0.0], "lift": 0.012, "mat": "olive_light", "bolt_mat": "steel"}]
|
||||
FITS = doc(KIT)
|
||||
before = scene_state()
|
||||
refused("a fit whose material is not in the file", call(doc({**KIT, "fits": KIT["fits"] + [{"kind": "part", "part": "bolt", "at": [0, 0], "mat": "brass"}]}), prefix="Fit."), "table.plates[0].fits[13].mat: no material named 'brass'")
|
||||
refused("a step whose bolts' material is not in the file", call(doc({**KIT, "fits": [{**KIT["fits"][-1], "bolt_mat": "brass"}]}), prefix="Fit."), "table.plates[0].fits[0].bolt_mat: no material named 'brass'")
|
||||
refused("a part the fittings kit does not have", call(doc({**KIT, "fits": [{"kind": "part", "part": "rivet", "at": [0, 0], "mat": "steel"}]}), prefix="Fit."), "table: plates[0].fits[0].part: 'rivet' is no part of the fittings kit")
|
||||
check("refused, the fittings call left the scene as it was", scene_state() == before)
|
||||
receipt, report = send("brokkr_kitbash.plates", host="Thigh", prefix="Fit.", table=json.dumps(FITS))
|
||||
bpy.context.view_layer.update()
|
||||
check("a slab with a fit row of every kind is accepted", receipt["status"] == "accepted", [receipt["status"], receipt["message"]])
|
||||
R["reports"]["fittings"] = report
|
||||
_, fit_built = proven("a row of every fit kind, on both sides", FITS, 1, "Fit.", thigh, world(thigh), report)
|
||||
mats = ["gunmetal", "khaki", "machine", "olive_light", "pit", "steel"]
|
||||
for side in "RL":
|
||||
kit_plate = bpy.data.objects.get(f"Fit.Kit.{side}")
|
||||
check(f"fits-written: Kit.{side} has a fit child per material, the fittings beside the panels and their bolts",
|
||||
kit_plate is not None and sorted(c.name for c in kit_plate.children if c.type == "MESH") == [f"Fit.Kit.{side}.fit.{m}" for m in mats]
|
||||
and bevel(bpy.data.objects[f"Fit.Kit.{side}.fit.olive_light"]) == (0.012, 20.0, 1, "ANGLE") and bevel(bpy.data.objects[f"Fit.Kit.{side}.fit.pit"]) is None,
|
||||
kit_plate and sorted(c.name for c in kit_plate.children))
|
||||
check("the report counts what stands: the rim's bolts, nine parts and a step", report is not None and [row["fits"] for row in report["plates"]] == [fit_built[0]["report"]["fits"]] * 2
|
||||
and fit_built[0]["report"]["fits"] > 11, report and [row.get("fits") for row in report["plates"]])
|
||||
BARE = doc({**KIT, "fits": KIT["fits"][:3]})
|
||||
receipt, report = send("brokkr_kitbash.plates", host="Thigh", prefix="Fit.", table=json.dumps(BARE))
|
||||
bpy.context.view_layer.update()
|
||||
proven("rebuilt with the rim's bolts alone", BARE, 1, "Fit.", thigh, world(thigh), report)
|
||||
check("a rebuild removes the fit children it no longer makes", sorted(c.name for c in bpy.data.objects["Fit.Kit.R"].children if c.type == "MESH") == ["Fit.Kit.R.fit.gunmetal", "Fit.Kit.R.fit.olive_light"]
|
||||
and "Fit.Kit.R.fit.pit" not in bpy.data.objects, sorted(c.name for c in bpy.data.objects["Fit.Kit.R"].children))
|
||||
except Exception: # noqa: BLE001 whatever it was, it is a failed check with a name, not a missing result file
|
||||
check(f"no uncaught error in section: {SECTION[0]}", False, traceback.format_exc().splitlines()[-6:])
|
||||
finally:
|
||||
R["ok"] = all(c["ok"] for c in R["checks"])
|
||||
R["readings"] = {name: float(f"{value:.2g}") for name, value in sorted(R["readings"].items())}
|
||||
Path(OUT + ".result.json").write_text(json.dumps(R, indent=1, default=str), encoding="utf-8")
|
||||
for c in R["checks"]:
|
||||
print("CHECK", "ok " if c["ok"] else "FAIL", c["name"], "" if c["ok"] else c["detail"], flush=True)
|
||||
print("READINGS", R["readings"], flush=True)
|
||||
sys.exit(0 if R["ok"] else 1)
|
||||
435
surfaces/blender/tests/live/kitbash_plates.result.json
Normal file
435
surfaces/blender/tests/live/kitbash_plates.result.json
Normal file
|
|
@ -0,0 +1,435 @@
|
|||
{
|
||||
"blender": "5.3.0",
|
||||
"checks": [
|
||||
{
|
||||
"name": "plates on the thigh are accepted and none is a rebuild",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "written-is-built: a plate on the thigh, the frame the host's",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "written-is-built: a plate on the shin, under the pin",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a plate with a panel and its bolts has two fit children and two anchors, and the panel's child alone a bevel",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "roll-carries: joints lists the same rows with the plates as without",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a plate is no kit part: report lists the two struts",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "plates under a stated frame are accepted at side 1",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "written-is-built: a two-sided row and a bare one under a stated frame, side 1: panels and bolts of one material are one child",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "plates under a stated frame are accepted at side -1",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "written-is-built: a two-sided row and a bare one under a stated frame, side -1: panels and bolts of one material are one child",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a bare plate has no child and no bevel; a two-sided row is two plates",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "written-is-built: no host and no frame: the table's frame is the world",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "the roll moved the shin",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "roll-carries: every plate, fit child and anchor on the shin stands at the roll @ where it stood",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "what stands on the thigh or on nothing stayed",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "hose-between-ports: a hose routes between the two plates' port empties through the pin point, clear across the pin's range",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "hose-between-ports: each end stands on its port, as plate.build places it on the panel's top, and leaves along its z",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rebuild-in-place: a second call on the same names reports every plate rebuilt",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "written-is-built: the rebuilt plates are the changed table's",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rebuild-in-place: the plate is the object it was, on the mesh it had, with her child, her modifier after the Kit Bevel and her second material slot",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rebuild-in-place: a kept anchor is the empty it was, moved to the row's new place",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "written-is-built: a rebuild without clad removes the fit child, and the anchor the row no longer names",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rebuild-in-place: the dropped child and anchor are gone, her child stays, and no mesh is left behind",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "written-is-built: a rebuild onto another host and frame makes the child and anchor again",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "rebuild-in-place: still the same object",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a table the format refuses, by its path",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a row that bounds no solid",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a table that is not JSON",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a row material the file lacks",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a clad material the file lacks",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a bolt material the file lacks",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a second row's missing material, after a first row that would be written",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a host that is not there",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a host that is scaled",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a frame that is not JSON",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a frame of three rows",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a frame with a number that is not finite",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a frame that scales",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a frame that mirrors",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a frame whose last row is no frame's",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: side 0",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a prefix with a character the names do not take",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a plate's name taken by an object plates did not make",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a fit child's name taken, the plate new",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: an anchor's name taken by an object that is no child of the plate, on a rebuild",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a row whose name is another row's fit child",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a made name over 63 bytes",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a host that is the plate",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a host under the plate",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a report a receipt does not carry",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a plate that shares its mesh",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a frozen plate",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "thawed, the plate is rebuilt",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "written-is-built: the thawed plate",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a fit whose material is not in the file",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a step whose bolts' material is not in the file",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, scene unchanged: a part the fittings kit does not have",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "refused, the fittings call left the scene as it was",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a slab with a fit row of every kind is accepted",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "written-is-built: a row of every fit kind, on both sides",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "fits-written: Kit.R has a fit child per material, the fittings beside the panels and their bolts",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "fits-written: Kit.L has a fit child per material, the fittings beside the panels and their bolts",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "the report counts what stands: the rim's bolts, nine parts and a step",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "written-is-built: rebuilt with the rim's bolts alone",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a rebuild removes the fit children it no longer makes",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
}
|
||||
],
|
||||
"hostErrors": [],
|
||||
"readings": {
|
||||
"anchored": 2.2e-07,
|
||||
"carried": 1e-07,
|
||||
"moved": 2.1e-07,
|
||||
"ported": 3.9e-08,
|
||||
"written": 8.4e-08
|
||||
},
|
||||
"reports": {
|
||||
"thigh": {
|
||||
"plates": [
|
||||
{
|
||||
"name": "Thigh.Guard",
|
||||
"rebuilt": false,
|
||||
"corners": 16,
|
||||
"facets": 10,
|
||||
"panels": 1,
|
||||
"bolts": 4,
|
||||
"fits": 0,
|
||||
"anchors": [
|
||||
"Thigh.Guard.port.feed",
|
||||
"Thigh.Guard.mark.num"
|
||||
]
|
||||
}
|
||||
],
|
||||
"host": "Thigh",
|
||||
"side": 1
|
||||
},
|
||||
"hose": {
|
||||
"object": "Feed",
|
||||
"rebuilt": false,
|
||||
"hoses": 1,
|
||||
"length": 0.834382,
|
||||
"lengthChange": 0.002158,
|
||||
"floor": 0.048,
|
||||
"clearance": 0.042341,
|
||||
"capped": 0.121,
|
||||
"voxels": [
|
||||
42560,
|
||||
36456
|
||||
],
|
||||
"seed": {
|
||||
"step": 0.02,
|
||||
"offset": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"refined": false
|
||||
},
|
||||
"sag": [
|
||||
0.007788,
|
||||
0.003557
|
||||
],
|
||||
"rolls": 9,
|
||||
"worstRoll": -20.0,
|
||||
"worstClearance": 0.043363,
|
||||
"faces": 1078,
|
||||
"volume": 0.000105174,
|
||||
"nonManifoldEdges": 0,
|
||||
"radii": {
|
||||
"least": 0.056641,
|
||||
"corners": [
|
||||
0.071927,
|
||||
1.931459,
|
||||
0.258593,
|
||||
3.432944,
|
||||
0.056641
|
||||
]
|
||||
}
|
||||
},
|
||||
"fittings": {
|
||||
"plates": [
|
||||
{
|
||||
"name": "Fit.Kit.R",
|
||||
"rebuilt": false,
|
||||
"corners": 16,
|
||||
"facets": 10,
|
||||
"panels": 1,
|
||||
"bolts": 4,
|
||||
"fits": 26,
|
||||
"anchors": [
|
||||
"Fit.Kit.R.port.feed",
|
||||
"Fit.Kit.R.mark.num"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Fit.Kit.L",
|
||||
"rebuilt": false,
|
||||
"corners": 16,
|
||||
"facets": 10,
|
||||
"panels": 1,
|
||||
"bolts": 4,
|
||||
"fits": 26,
|
||||
"anchors": [
|
||||
"Fit.Kit.L.port.feed",
|
||||
"Fit.Kit.L.mark.num"
|
||||
]
|
||||
}
|
||||
],
|
||||
"host": "Thigh",
|
||||
"side": 1
|
||||
}
|
||||
},
|
||||
"ok": true
|
||||
}
|
||||
|
|
@ -445,7 +445,8 @@ try:
|
|||
R["joints"] = joints
|
||||
table = {row["id"]: row for row in (joints or {}).get("joints", [])}
|
||||
check("joints reports the tree under the tank: schema, the root's frame, a row per DOF connection depth first with children by name, parents first, rigid ones counted",
|
||||
receipt["status"] == "accepted" and {k: v for k, v in joints.items() if k != "joints"} == {"schema": "brokkr.joints", "version": 1, "root": "Tank", "frame": "the root object's: Blender axes (+Z up), metres", "rigid": 2}
|
||||
receipt["status"] == "accepted" and {k: v for k, v in joints.items() if k != "joints"} == {"schema": "brokkr.joints", "version": 2, "root": "Tank", "frame": "the root object's: Blender axes (+Z up), metres", "rigid": 2,
|
||||
"unlimited": ["Barrel", "Toe", "Ram"], "manyDrivers": [], "next": None}
|
||||
and [row["id"] for row in joints["joints"]] == ["Strut", "Barrel", "Rod", "Hinge", "Toe", "Ram"], [receipt["message"], joints])
|
||||
check("a joint's parent is the nearest DOF connection above it, not the object it hangs from: the toe's is the hinge, through the rigid foot; the rod's is the barrel",
|
||||
{name: row["parent"] for name, row in table.items()} == {"Strut": None, "Barrel": "Strut", "Rod": "Barrel", "Hinge": "Strut", "Toe": "Hinge", "Ram": "Strut"} and toe.parent == foot,
|
||||
|
|
@ -466,8 +467,9 @@ try:
|
|||
and table["Strut"] == {**table["Strut"], "value": round(value, 6), "min": round(round(near + 2.0, 3) - value, 6), "max": round(round(far - 2.0, 3) - value, 6), "mechanism": "knee"}
|
||||
and table["Ram"] == {**table["Ram"], "value": -36.0, "limits": None, "min": None, "max": None, "mechanism": None, "compliance": None}, table)
|
||||
receipt, below = send("brokkr_kitbash.joints", object_name="Hinge")
|
||||
check("under another root the rows are in its frame and begin below it", receipt["status"] == "accepted" and [(row["id"], row["parent"]) for row in below["joints"]] == [("Toe", None)] and below["rigid"] == 1
|
||||
and float(np.abs((np.linalg.inv(np.array(hinge.matrix_world, dtype=np.float64)) @ frame(foot, "pivot"))[:3, 3] - below["joints"][0]["origin"]).max()) < JOINT_FRAME, below)
|
||||
check("under another root the rows are in its frame and begin with the root's own joint, parent null", receipt["status"] == "accepted"
|
||||
and [(row["id"], row["parent"]) for row in below["joints"]] == [("Hinge", None), ("Toe", "Hinge")] and below["rigid"] == 1 and below["unlimited"] == ["Toe"]
|
||||
and float(np.abs((np.linalg.inv(np.array(hinge.matrix_world, dtype=np.float64)) @ frame(foot, "pivot"))[:3, 3] - below["joints"][1]["origin"]).max()) < JOINT_FRAME, below)
|
||||
refused("joints of a mesh that is not a kit part", "brokkr_kitbash.joints", {"object_name": "Plain"}, "'Plain' is not a kit part")
|
||||
|
||||
# --- detach clears the record -------------------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@
|
|||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "under another root the rows are in its frame and begin below it",
|
||||
"name": "under another root the rows are in its frame and begin with the root's own joint, parent null",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
|
|
@ -494,10 +494,17 @@
|
|||
},
|
||||
"joints": {
|
||||
"schema": "brokkr.joints",
|
||||
"version": 1,
|
||||
"version": 2,
|
||||
"root": "Tank",
|
||||
"frame": "the root object's: Blender axes (+Z up), metres",
|
||||
"rigid": 2,
|
||||
"unlimited": [
|
||||
"Barrel",
|
||||
"Toe",
|
||||
"Ram"
|
||||
],
|
||||
"manyDrivers": [],
|
||||
"next": null,
|
||||
"joints": [
|
||||
{
|
||||
"id": "Strut",
|
||||
|
|
@ -522,8 +529,10 @@
|
|||
],
|
||||
"min": -3.000003,
|
||||
"max": 72.999997,
|
||||
"held": false,
|
||||
"mechanism": "knee",
|
||||
"compliance": null
|
||||
"compliance": null,
|
||||
"driven": null
|
||||
},
|
||||
{
|
||||
"id": "Barrel",
|
||||
|
|
@ -545,8 +554,10 @@
|
|||
"limits": null,
|
||||
"min": null,
|
||||
"max": null,
|
||||
"held": false,
|
||||
"mechanism": null,
|
||||
"compliance": null
|
||||
"compliance": null,
|
||||
"driven": null
|
||||
},
|
||||
{
|
||||
"id": "Rod",
|
||||
|
|
@ -571,11 +582,13 @@
|
|||
],
|
||||
"min": -0.12,
|
||||
"max": 0.18,
|
||||
"held": false,
|
||||
"mechanism": "shock",
|
||||
"compliance": {
|
||||
"damping_ratio": 0.7,
|
||||
"hertz": 4.0
|
||||
}
|
||||
},
|
||||
"driven": null
|
||||
},
|
||||
{
|
||||
"id": "Hinge",
|
||||
|
|
@ -600,8 +613,10 @@
|
|||
],
|
||||
"min": -75.0,
|
||||
"max": 35.0,
|
||||
"held": false,
|
||||
"mechanism": "ankle",
|
||||
"compliance": null
|
||||
"compliance": null,
|
||||
"driven": null
|
||||
},
|
||||
{
|
||||
"id": "Toe",
|
||||
|
|
@ -623,8 +638,10 @@
|
|||
"limits": null,
|
||||
"min": null,
|
||||
"max": null,
|
||||
"held": false,
|
||||
"mechanism": null,
|
||||
"compliance": null
|
||||
"compliance": null,
|
||||
"driven": null
|
||||
},
|
||||
{
|
||||
"id": "Ram",
|
||||
|
|
@ -646,8 +663,10 @@
|
|||
"limits": null,
|
||||
"min": null,
|
||||
"max": null,
|
||||
"held": false,
|
||||
"mechanism": null,
|
||||
"compliance": null
|
||||
"compliance": null,
|
||||
"driven": null
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,9 +9,12 @@ Run it with private BLENDER_USER_CONFIG, BLENDER_USER_EXTENSIONS and BLENDER_USE
|
|||
without them). <out> is an absolute path; writes <out>.result.json and <out>.r3_<angle>.png (the bell crank at 0,
|
||||
-62.5 and -125) and exits 1 when a check failed.
|
||||
|
||||
The oracle is ram.Signed, three rays by majority. Its ray count is held by tests/fixtures/ram_rays.json: the rocker
|
||||
plates as Imagination's jointlib builds them and points between the plates that stand on the first ray short of an
|
||||
edge or a vertex. One ray reads them inside a plate they stand clear of; the oracle as it is made reads none inside.
|
||||
The oracle is ram.Signed: a point is inside a part where the winding number of the part's faces about it is 0.5 or
|
||||
more. tests/fixtures/ram_plates.json holds the rocker plates as Imagination's jointlib builds them, four closed bars
|
||||
joined into one mesh, a side's two overlapping, and 29 points inside them: none reads outside. Nor does a point where
|
||||
two welded boxes overlap. A part that is open, wound inside out or crossing itself is refused when the oracle is made, a
|
||||
hollow mass and a part mirrored by its matrix are read, and the depth is to the part's surface: a face buried in another of the
|
||||
part's solids is not read, and outside the distance is to the nearest face of all.
|
||||
|
||||
A clearance verdict is a sign, the gate's own. FLAT follows lodur:ruling:deterministic-bound-margin. The checks run
|
||||
inside one try: an uncaught error is a failed check that names its section, and the result file is always written.
|
||||
|
|
@ -304,32 +307,116 @@ try:
|
|||
# plates and none is inside; where the plate is under the point the reading is the 0.0225
|
||||
ys, zs = np.meshgrid(np.linspace(0.1, 0.9, 96), np.linspace(0.1, 0.7, 72))
|
||||
plane = np.stack([np.full(ys.size, X_C), ys.ravel(), zs.ravel()], axis=1)
|
||||
three, one = Signed(shells)("rocker.plate", plane), Signed(shells, rays=1)("rocker.plate", plane)
|
||||
off_plates = Signed(shells)("rocker.plate", plane)
|
||||
def off(a, b): # each grid point's distance from the segment a -> b, across the axis
|
||||
a, b = np.array(a), np.array(b)
|
||||
t = np.clip(((plane[:, 1:] - a) @ (b - a)) / ((b - a) @ (b - a)), 0.0, 1.0)
|
||||
return np.linalg.norm(plane[:, 1:] - a - t[:, None] * (b - a), axis=1)
|
||||
under = (off(CRANK["rocker"], CRANK["p"]) < W_ROCKER - 0.005) | (off(CRANK["rocker"], CRANK["d"]) < W_ARM - 0.005)
|
||||
RES["readings"]["FLAT"] = float(np.abs(three[under] - (SLAB_R[0] - X_C)).max())
|
||||
RES["readings"]["one ray: samples signed inside, of %d" % len(plane)] = int((one < 0).sum())
|
||||
check("three-rays: on a plane 0.0225 off the rocker plates no sample reads inside or nearer, and under a plate each reads the 0.0225",
|
||||
(three >= SLAB_R[0] - X_C - FLAT).all() and under.sum() > 500 and RES["readings"]["FLAT"] < FLAT, [float(three.min()), int(under.sum()), RES["readings"]["FLAT"]])
|
||||
# against shells whose inside is known in closed form: a box and a disc, random points, each ray's edges and vertices among them
|
||||
RES["readings"]["FLAT"] = float(np.abs(off_plates[under] - (SLAB_R[0] - X_C)).max())
|
||||
check("off-the-plates: on a plane 0.0225 off the rocker plates no sample reads inside or nearer, and under a plate each reads the 0.0225",
|
||||
(off_plates >= SLAB_R[0] - X_C - FLAT).all() and under.sum() > 500 and RES["readings"]["FLAT"] < FLAT, [float(off_plates.min()), int(under.sum()), RES["readings"]["FLAT"]])
|
||||
# against a shell whose inside is known in closed form: a box, random points
|
||||
rng = np.random.default_rng(7)
|
||||
cloud = rng.uniform((-0.2, -0.2, 0.2), (0.2, 0.2, 1.25), (4000, 3))
|
||||
core = Signed({"core": [box((0, 0, 0.725), (0.26, 0.28, 0.85))]})("core", cloud)
|
||||
exact = np.maximum.reduce([np.abs(cloud[:, 0]) - 0.13, np.abs(cloud[:, 1]) - 0.14, np.abs(cloud[:, 2] - 0.725) - 0.425])
|
||||
check("three-rays: 4000 random points about a box are signed as the box signs them", ((core < 0) == (exact < 0)).all(), int(((core < 0) != (exact < 0)).sum()))
|
||||
check("box: 4000 random points about a box are signed as the box signs them", ((core < 0) == (exact < 0)).all(), int(((core < 0) != (exact < 0)).sum()))
|
||||
|
||||
# the ray count: the jointlib rocker plates, and points between them aimed along the first ray at an edge or a vertex
|
||||
fixture = json.loads((SURFACE / "tests" / "fixtures" / "ram_rays.json").read_text(encoding="utf-8"))
|
||||
plates, aimed = {"plates": [(np.array(fixture["verts"]), fixture["faces"])]}, np.array(fixture["points"])
|
||||
made, single = Signed(plates)("plates", aimed), Signed(plates, rays=1)("plates", aimed)
|
||||
RES["readings"]["jointlib plates: points one ray signs inside, of %d" % len(aimed)] = int((single < 0).sum())
|
||||
RES["readings"]["jointlib plates: points the oracle signs inside"] = int((made < 0).sum())
|
||||
# one ray reads all 24 inside; the oracle as made reads none. The bound on one ray's count is the geometric mean of 1 and 24
|
||||
check("ray-count: between the jointlib rocker plates, points on the first ray short of an edge or a vertex read outside by the oracle as it is made, inside by one ray",
|
||||
(np.abs(aimed[:, 0]) < 0.349).all() and (made > 0).all() and (single < 0).sum() >= 5, [int((made < 0).sum()), int((single < 0).sum())])
|
||||
# what the gate's proof between samples leans on: no point inside a part reads outside. The jointlib rocker plates
|
||||
# are four closed bars in one mesh, a side's two overlapping about the pivot (crossing parity read the overlap
|
||||
# outside); the fixture's 29 points are 0.001 or more inside a bar, 13 of them inside two. A count of points
|
||||
fixture = json.loads((SURFACE / "tests" / "fixtures" / "ram_plates.json").read_text(encoding="utf-8"))
|
||||
plates = Signed({"plates": [(np.array(fixture["verts"]), fixture["faces"])]})("plates", np.array(fixture["inside"]))
|
||||
# two boxes cut through one another and welded at the corner they share
|
||||
def wound(lo, hi):
|
||||
verts = np.array([[x, y, z] for x in (lo[0], hi[0]) for y in (lo[1], hi[1]) for z in (lo[2], hi[2])], float)
|
||||
return verts, [(0, 1, 3, 2), (4, 6, 7, 5), (0, 4, 5, 1), (2, 3, 7, 6), (0, 2, 6, 4), (1, 5, 7, 3)]
|
||||
(v1, f1), (v2, f2) = wound((0, 0, 0), (1, 1, 1)), wound((0, 0, 0), (2, 0.5, 0.5))
|
||||
welded = (np.concatenate([v1, v2[1:]]), f1 + [tuple(i + 7 if i else 0 for i in face) for face in f2])
|
||||
cloud = rng.uniform(-0.2, 2.2, (6000, 3))
|
||||
truth = ((cloud >= 0) & (cloud <= 1)).all(axis=1) | ((cloud >= 0) & (cloud <= (2, 0.5, 0.5))).all(axis=1)
|
||||
both = ((cloud >= 0) & (cloud <= (1, 0.5, 0.5))).all(axis=1)
|
||||
got = Signed({"welded": [welded]})("welded", cloud) < 0
|
||||
RES["readings"]["jointlib plates: inside points read outside, of %d" % len(plates)] = int((plates >= 0).sum())
|
||||
RES["readings"]["welded boxes: points missigned, of %d (%d in the overlap)" % (len(cloud), int(both.sum()))] = int((got != truth).sum())
|
||||
check("inside-reads-inside: no point inside the jointlib rocker plates' bars or in two welded boxes' overlap reads outside, and none outside the boxes reads inside",
|
||||
len(plates) == 29 and int((plates >= 0).sum()) == 0 and int(both.sum()) > 50 and int((got != truth).sum()) == 0,
|
||||
[int((plates >= 0).sum()), int(both.sum()), int((got != truth).sum())])
|
||||
|
||||
# a part with no inside to sign is refused when the oracle is made, by its reason: a cube with its top off, or
|
||||
# two adjacent faces off, is open; a cube turned over or mirrored with its winding kept, or a turned-over bar beside
|
||||
# a whole cube, is a solid of negative volume and wound inside out; the bar welded to the cube along an edge (one
|
||||
# solid, a positive volume in all) crosses itself, and is told where. What has an inside is read: a mirrored cube handed as its own mesh and its matrix, and a hollow mass, its cavity an inward shell
|
||||
def one(*meshes):
|
||||
at, faces = {}, []
|
||||
for v, f in meshes:
|
||||
index = [at.setdefault(tuple(float(x) for x in q), len(at)) for q in v]
|
||||
faces += [tuple(index[i] for i in face) for face in f]
|
||||
return np.array(list(at)), faces
|
||||
|
||||
turned = [face[::-1] for face in f1]
|
||||
rail = wound((1, 0, -0.2), (1.2, 1, 0))
|
||||
said = {}
|
||||
for name, made in (("top off", [(v1, [face for face in f1 if face != (1, 5, 7, 3)])]), ("two faces off", [(v1, [face for face in f1 if face not in ((1, 5, 7, 3), (2, 3, 7, 6))])]),
|
||||
("turned over", [(v1, turned)]), ("mirrored", [(v1 * (-1, 1, 1), f1)]), ("a turned-over bar beside a cube", [(v1, f1), (v2 + (0, 2, 0), [face[::-1] for face in f2])]),
|
||||
("a turned-over bar welded to a cube", [one((v1, f1), (rail[0], [face[::-1] for face in rail[1]]))])):
|
||||
try:
|
||||
Signed({"cube": made})
|
||||
said[name] = None
|
||||
except R.RamError as error:
|
||||
said[name] = str(error)
|
||||
RES["refusals"] = said
|
||||
want = {"top off": "is open: solid 0 of 1 has 4 edges", "two faces off": "is open: solid 0 of 1 has 6 edges", "turned over": "is wound inside out: solid 0 of 1 has a volume of -0.192 of the part's extent cubed, and 6 of its faces, from face 0, stand before a region that winds -1",
|
||||
"mirrored": "is wound inside out: solid 0 of 1 has a volume of -0.192 of the part's extent cubed, and 6 of its faces, from face 0, stand before a region that winds -1",
|
||||
"a turned-over bar beside a cube": "is wound inside out: solid 1 of 2 has a volume of -0.0133 of the part's extent cubed, and 6 of its faces, from face 6, stand before a region that winds -1",
|
||||
"a turned-over bar welded to a cube": "crosses itself: 6 faces, from face 6 of solid 0 of 1, stand before a region that winds -1"}
|
||||
check("no-inside-is-refused: an open part is refused by its solid and edge count, an inside-out one by its solid's negative volume, and a turned-over bar welded to a whole cube as crossing itself about (1.1, 0.5, -0.1), never as inside out",
|
||||
len(one((v1, f1), rail)[0]) == 14 and all(said[name] is not None and "part 'cube' " + text in said[name] for name, text in want.items())
|
||||
and "about (1.1, 0.5, -0.1) and within 0.5 of it" in said["a turned-over bar welded to a cube"] and "inside out" not in said["a turned-over bar welded to a cube"], said)
|
||||
hollow = [wound((-1, -1, -1), (1, 1, 1)), (lambda v, f: (v, [face[::-1] for face in f]))(*wound((0.4, 0.4, 0.4), (0.6, 0.6, 0.6)))]
|
||||
at = np.array([(0.5, 0.5, 0.5), (0.0, 0.0, 0.0), (0.5, 0.5, 0.95), (1.2, 0.0, 0.0)])
|
||||
left = np.array([(-0.5, 0.5, 0.5), (0.5, 0.5, 0.5), (-0.5, 0.5, 0.9)])
|
||||
cavity, mirrored = Signed({"p": hollow})("p", at), Signed({"p": [(v1, f1, np.diag((-1.0, 1.0, 1.0, 1.0)))]})("p", left)
|
||||
RES["readings"]["hollow mass: in the cavity, in the wall by it, under the outer face, outside"] = cavity.tolist()
|
||||
RES["readings"]["mirrored cube by its matrix: inside, across the mirror, under its top"] = mirrored.tolist()
|
||||
check("an-inside-is-read: a cavity reads outside and the wall about it by its depth to the cavity; a cube mirrored by its matrix reads as the cube it is",
|
||||
float(np.abs(cavity - (0.1, -0.4 * math.sqrt(3.0), -0.05, 0.2)).max()) < FLAT and float(np.abs(mirrored - (-0.5, 0.5, -0.1)).max()) < FLAT, [cavity.tolist(), mirrored.tolist()])
|
||||
|
||||
# the exposed faces, where a reading turns on them. Outside, the distance is to the nearest face of all: a slab
|
||||
# with a boss through its middle has its two great faces left out (their centroids are in the boss), and points
|
||||
# off them read 0.05 and 0.02, not the 0.206 and 0.4 to the nearest exposed face. Two plates stacked 1e-5 of the
|
||||
# extent apart are two surfaces: under the lower one's top the depth is 0.02, where a nudge of 1e-4 reads that
|
||||
# face buried in the upper plate and the depth 0.08 to the bottom. A cube turned 0.3, 0.5 and 0.7 radians about
|
||||
# x, y and z has no face along an axis: its six sides are held at 1e-6 and to 1e-8 (the corners' offsets are
|
||||
# single precision), and at 1e-9 four read buried
|
||||
slab = [wound((-1, -1, -0.1), (1, 1, 0.1)), wound((-0.2, -0.2, -0.5), (0.2, 0.2, 0.5))]
|
||||
off = Signed({"p": slab})("p", np.array([(0.8, 0.0, 0.15), (0.6, 0.6, 0.12), (0.0, 0.0, 0.7), (0.5, 0.0, -0.3)]))
|
||||
gap = 1e-5 * math.sqrt(2.0 + 0.2 ** 2)
|
||||
stacked = Signed({"p": [wound((0, 0, 0), (1, 1, 0.1)), wound((0, 0, 0.1 + gap), (1, 1, 0.2 + gap))]})("p", np.array([(0.5, 0.5, 0.08), (0.5, 0.5, 0.12 + gap), (0.5, 0.5, 0.1 + 0.5 * gap)]))
|
||||
(ca, sa), (cb, sb), (cc, sc) = ((math.cos(t), math.sin(t)) for t in (0.3, 0.5, 0.7))
|
||||
spin = np.array([[1, 0, 0], [0, ca, -sa], [0, sa, ca]]) @ np.array([[cb, 0, sb], [0, 1, 0], [-sb, 0, cb]]) @ np.array([[cc, -sc, 0], [sc, cc, 0], [0, 0, 1]])
|
||||
under = 0.9 * np.array([(1, 0, 0), (-1, 0, 0), (0, 1, 0), (0, -1, 0), (0, 0, 1), (0, 0, -1)], float)
|
||||
spun = Signed({"p": [(cube_v @ spin.T, cube_f) for cube_v, cube_f in [wound((-1, -1, -1), (1, 1, 1))]]})("p", under @ spin.T)
|
||||
RES["readings"]["slab with a boss through it: off its faces (0.05, 0.02), off the boss's end (0.2), under it (0.2)"] = off.tolist()
|
||||
RES["readings"]["plates stacked 1e-5 of the extent apart: under the lower's top (0.02), over the upper's bottom (0.02), between them"] = stacked.tolist()
|
||||
RES["readings"]["a turned cube: 0.1 under each face"] = spun.tolist()
|
||||
check("exposed-faces-are-read-where-they-are: outside is to the nearest face of all, plates 1e-5 of the extent apart are two surfaces, and a turned cube's six faces are all its surface",
|
||||
float(np.abs(off - (0.05, 0.02, 0.2, 0.2)).max()) < FLAT and float(np.abs(stacked - (-0.02, -0.02, 0.5 * gap)).max()) < FLAT and float(np.abs(spun + 0.1).max()) < FLAT, [off.tolist(), stacked.tolist(), spun.tolist()])
|
||||
|
||||
# the depth is to the part's surface, not to a face buried in another of its solids: a cube of half side 1 with a
|
||||
# box of side 0.2 buried about (0.5, 0.5, 0.5) reads its own depth by the box and at its centre (the nearest face
|
||||
# of all is the buried box's: 0.05 and 0.693). A boss through a wall is read, not checked: its side faces cross the
|
||||
# wall and are kept whole by their centroids, so in the wall by the boss the depth reads to their buried stretch
|
||||
cube, small = wound((-1, -1, -1), (1, 1, 1)), wound((0.4, 0.4, 0.4), (0.6, 0.6, 0.6))
|
||||
boss = wound((0.9, -0.5, -0.5), (1.5, 0.5, 0.5))
|
||||
at = np.array([(0.5, 0.5, 0.55), (0.0, 0.0, 0.0), (0.5, 0.5, 0.95), (0.5, 0.5, 0.5), (1.2, 0.0, 0.0)])
|
||||
alone, buried, bossed = Signed({"p": [cube]})("p", at), Signed({"p": [cube, small]})("p", at), Signed({"p": [cube, boss]})("p", np.array([(0.95, 0.0, 0.0), (0.7, 0.0, 0.0), (1.2, 0.0, 0.0), (1.6, 0.0, 0.0)]))
|
||||
RES["readings"]["buried box: depth by it, at the cube's centre, under the cube's face, at the box's centre; outside"] = buried.tolist()
|
||||
RES["readings"]["boss through a wall (faces that cross a solid are kept or left whole): in both (the surface is 0.502 off), in the wall (0.583), in the boss (0.2), off it (0.1)"] = bossed.tolist()
|
||||
check("depth-is-to-the-surface: a face buried in another solid of the part is not read: by a buried box the cube reads as the cube alone",
|
||||
float(np.abs(buried - (-0.45, -1.0, -0.05, -0.5, 0.2)).max()) < FLAT and float(np.abs(buried - alone).max()) < FLAT,
|
||||
[buried.tolist(), alone.tolist()])
|
||||
|
||||
SECTION[0] = "seat"
|
||||
seat = np.concatenate([v for v, _ in shells["parent.seat"]])
|
||||
|
|
|
|||
|
|
@ -7,17 +7,37 @@
|
|||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "three-rays: on a plane 0.0225 off the rocker plates no sample reads inside or nearer, and under a plate each reads the 0.0225",
|
||||
"name": "off-the-plates: on a plane 0.0225 off the rocker plates no sample reads inside or nearer, and under a plate each reads the 0.0225",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "three-rays: 4000 random points about a box are signed as the box signs them",
|
||||
"name": "box: 4000 random points about a box are signed as the box signs them",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "ray-count: between the jointlib rocker plates, points on the first ray short of an edge or a vertex read outside by the oracle as it is made, inside by one ray",
|
||||
"name": "inside-reads-inside: no point inside the jointlib rocker plates' bars or in two welded boxes' overlap reads outside, and none outside the boxes reads inside",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "no-inside-is-refused: an open part is refused by its solid and edge count, an inside-out one by its solid's negative volume, and a turned-over bar welded to a whole cube as crossing itself about (1.1, 0.5, -0.1), never as inside out",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "an-inside-is-read: a cavity reads outside and the wall about it by its depth to the cavity; a cube mirrored by its matrix reads as the cube it is",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "exposed-faces-are-read-where-they-are: outside is to the nearest face of all, plates 1e-5 of the extent apart are two surfaces, and a turned cube's six faces are all its surface",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "depth-is-to-the-surface: a face buried in another solid of the part is not read: by a buried box the cube reads as the cube alone",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
|
|
@ -104,25 +124,75 @@
|
|||
],
|
||||
"readings": {
|
||||
"FLAT": 8.34e-09,
|
||||
"a turned cube: 0.1 under each face": [
|
||||
-0.09999994188547134,
|
||||
-0.09999997913837433,
|
||||
-0.09999998658895493,
|
||||
-0.09999998658895493,
|
||||
-0.10000001639127731,
|
||||
-0.10000001639127731
|
||||
],
|
||||
"bell crank: least margin of a pair with no zone, 251 steps uncapped": 0.0336,
|
||||
"bell crank: least margin of a zoned pair, 251 steps uncapped": 0.000118,
|
||||
"bell crank: pairs": 60,
|
||||
"bell crank: pairs refused with nothing let": 19,
|
||||
"bell crank: seconds, 49 steps capped": 2.12,
|
||||
"bell crank: seconds, 49 steps capped": 1.87,
|
||||
"bell crank: zoned pairs": 20,
|
||||
"boss through a wall (faces that cross a solid are kept or left whole): in both (the surface is 0.502 off), in the wall (0.583), in the boss (0.2), off it (0.1)": [
|
||||
-0.5,
|
||||
-0.5385164618492126,
|
||||
-0.2999999523162842,
|
||||
0.10000002384185791
|
||||
],
|
||||
"buried box: depth by it, at the cube's centre, under the cube's face, at the box's centre; outside": [
|
||||
-0.44999998807907104,
|
||||
-1.0,
|
||||
-0.050000011920928955,
|
||||
-0.5,
|
||||
0.20000004768371582
|
||||
],
|
||||
"four bar: barrel inside the shin's clearance": -0.122,
|
||||
"jointlib plates: points one ray signs inside, of 24": 24,
|
||||
"jointlib plates: points the oracle signs inside": 0,
|
||||
"hollow mass: in the cavity, in the wall by it, under the outer face, outside": [
|
||||
0.09999999403953552,
|
||||
-0.6928203105926514,
|
||||
-0.050000011920928955,
|
||||
0.20000004768371582
|
||||
],
|
||||
"jointlib plates: inside points read outside, of 29": 0,
|
||||
"mirrored cube by its matrix: inside, across the mirror, under its top": [
|
||||
-0.5,
|
||||
0.5,
|
||||
-0.10000002384185791
|
||||
],
|
||||
"moved x: both": -0.0543,
|
||||
"moved x: the coupler at x 0.25, inside the horn's 0.23..0.31": -0.02,
|
||||
"moved x: the rocker at x 0.25, inside the bracket's 0.13..0.35": -0.0543,
|
||||
"one ray: samples signed inside, of 6912": 0,
|
||||
"plates stacked 1e-5 of the extent apart: under the lower's top (0.02), over the upper's bottom (0.02), between them": [
|
||||
-0.020000003278255463,
|
||||
-0.019999995827674866,
|
||||
7.137656211853027e-06
|
||||
],
|
||||
"search: candidates": 13824,
|
||||
"search: pass the gates before clearance": 78,
|
||||
"search: refused on their own parts": 21,
|
||||
"search: seconds": 43.3,
|
||||
"search: seconds": 45.2,
|
||||
"search: worlds built": 22,
|
||||
"the base clevis's foot inside the thigh": -0.01
|
||||
"slab with a boss through it: off its faces (0.05, 0.02), off the boss's end (0.2), under it (0.2)": [
|
||||
0.05000000447034836,
|
||||
0.019999995827674866,
|
||||
0.19999998807907104,
|
||||
0.20000001788139343
|
||||
],
|
||||
"the base clevis's foot inside the thigh": -0.01,
|
||||
"welded boxes: points missigned, of 6000 (91 in the overlap)": 0
|
||||
},
|
||||
"refusals": {
|
||||
"top off": "mesh ram: signed: part 'cube' is open: solid 0 of 1 has 4 edges no face runs the other way",
|
||||
"two faces off": "mesh ram: signed: part 'cube' is open: solid 0 of 1 has 6 edges no face runs the other way",
|
||||
"turned over": "mesh ram: signed: part 'cube' is wound inside out: solid 0 of 1 has a volume of -0.192 of the part's extent cubed, and 6 of its faces, from face 0, stand before a region that winds -1.01",
|
||||
"mirrored": "mesh ram: signed: part 'cube' is wound inside out: solid 0 of 1 has a volume of -0.192 of the part's extent cubed, and 6 of its faces, from face 0, stand before a region that winds -1.01",
|
||||
"a turned-over bar beside a cube": "mesh ram: signed: part 'cube' is wound inside out: solid 1 of 2 has a volume of -0.0133 of the part's extent cubed, and 6 of its faces, from face 6, stand before a region that winds -1",
|
||||
"a turned-over bar welded to a cube": "mesh ram: signed: part 'cube' crosses itself: 6 faces, from face 6 of solid 0 of 1, stand before a region that winds -1 and holds 0.0271 of the part's extent cubed, about (1.1, 0.5, -0.1) and within 0.5 of it, and no solid there has a negative volume: its surfaces cut through one another (cutters never joined, a fold), or a turned piece is welded into a whole one"
|
||||
},
|
||||
"zones": {
|
||||
"barrel[0] | parent.seat": {
|
||||
|
|
@ -496,9 +566,9 @@
|
|||
}
|
||||
},
|
||||
"renders": [
|
||||
"F:/aeth-wt/fable-ramcore/scratch/h4/out/live_h4.r3_0.png",
|
||||
"F:/aeth-wt/fable-ramcore/scratch/h4/out/live_h4.r3_62p5.png",
|
||||
"F:/aeth-wt/fable-ramcore/scratch/h4/out/live_h4.r3_125.png"
|
||||
"F:/aeth-wt/hands-ramlows6-scratch/out/live/knee.r3_0.png",
|
||||
"F:/aeth-wt/hands-ramlows6-scratch/out/live/knee.r3_62p5.png",
|
||||
"F:/aeth-wt/hands-ramlows6-scratch/out/live/knee.r3_125.png"
|
||||
],
|
||||
"ok": true
|
||||
}
|
||||
245
surfaces/blender/tests/live/reference_block.py
Normal file
245
surfaces/blender/tests/live/reference_block.py
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
"""Live proof, in a background Blender, of brokkr_reference.block_plate through run_intent.
|
||||
|
||||
A plate stands in a frame turned and moved in the world: an empty, "Frame". Its truth is a five-sided crown with
|
||||
bowed sides, built by brokkr_kitbash.shell from core.plate_sheet, and two cameras 60 degrees apart look at it. Each
|
||||
side is traced in both views where Blender's own projection draws the side as core.crease_run builds it. Then:
|
||||
|
||||
block_plate from the frame, the corner names and the ten traces, no blocking: a sheet with every trace
|
||||
explained, each corner decided by the views, nothing written to the scene
|
||||
built brokkr_kitbash.shell takes the sheet without refusal, and at one level Blender builds each crown
|
||||
side where core.crease_run says
|
||||
fit_shell with the returned fit_traces on the built plate: accepted, every trace explained, and no point
|
||||
moved over MOVED (fairness holds a bowed side in and fit_shell's own prior lets it out:
|
||||
tests/test_reference.py test_the_blocking_goes_to_the_parser_and_to_fit_shell reads 74 mm of
|
||||
it where a pixel is 27 mm; here a pixel is 5 mm). MOVED, GAP and GAP_MIRRORED each stand between
|
||||
this scene's reading and a mutant's
|
||||
mirrored a mirrored plate with two seam corners, traced the same way: the seam stays on x = 0,
|
||||
brokkr_kitbash.shell builds both halves, and Blender builds the seam's side and a free side where
|
||||
core.crease_run says
|
||||
refusals a scaled frame, an unknown camera and a side nobody traced, each a failed receipt naming its cause
|
||||
|
||||
blender --background --factory-startup --python-exit-code 1 --python surfaces/blender/tests/live/reference_block.py -- <out>
|
||||
|
||||
Run it with private BLENDER_USER_CONFIG, BLENDER_USER_EXTENSIONS and BLENDER_USER_SCRIPTS directories (it refuses
|
||||
without them). <out> is an absolute path: it writes <out>.result.json and exits 1 when a check failed. Not part
|
||||
of the unittest run: it needs Blender.
|
||||
"""
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import traceback
|
||||
import types
|
||||
from pathlib import Path
|
||||
|
||||
import bpy
|
||||
import numpy as np
|
||||
from bpy_extras.object_utils import world_to_camera_view
|
||||
from mathutils import Euler, Matrix, Vector
|
||||
|
||||
SURFACE = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(SURFACE / "tools"))
|
||||
import private_dirs # noqa: E402
|
||||
|
||||
_refused = private_dirs.refusal(os.environ, os.path.expanduser("~"), lambda kind: bpy.utils.user_resource(kind))
|
||||
if _refused:
|
||||
raise SystemExit(_refused)
|
||||
OUT = sys.argv[sys.argv.index("--") + 1]
|
||||
if not os.path.isabs(OUT):
|
||||
raise SystemExit(f"<out> must be an absolute path, not {OUT!r}: a relative one lands in Blender's start directory")
|
||||
package = types.ModuleType("brokkr_bridge")
|
||||
package.__path__ = [str(SURFACE / "brokkr_bridge")]
|
||||
sys.modules["brokkr_bridge"] = package
|
||||
from brokkr_bridge import blender_target as bt # noqa: E402
|
||||
|
||||
import addon_utils # noqa: E402
|
||||
|
||||
sys.path.append(str(SURFACE))
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
for module in ("brokkr_mesh_polish", "brokkr_kitbash", "brokkr_reference"):
|
||||
addon_utils.enable(module, default_set=True)
|
||||
from brokkr_reference import core # noqa: E402
|
||||
|
||||
target = bt.BrokkrBlenderTarget(bpy)
|
||||
target.configure_action_dirs("", tempfile.mkdtemp(prefix="brokkr-reference-block-live-"))
|
||||
target.reload_host_actions()
|
||||
R = {"blender": bpy.app.version_string, "checks": [], "hostErrors": target.host_actions()[1],
|
||||
"hostRows": [row["name"] for row in target.host_actions()[0]]}
|
||||
COUNT = [0]
|
||||
T0 = time.time()
|
||||
WIDTH, HEIGHT = 1000, 800
|
||||
MOVED, GAP, GAP_MIRRORED = 0.0165, 0.0088, 0.0273 # metres, each the geometric mean of this scene's reading and its least mutant's (lodur:ruling:deterministic-bound-margin), the mutants run through this script on a copy of the surface: fit_shell moves a point of the blocked plate 0.0048 (FAIR 0.05: 0.0565), the blocked crown stands 0.0027 from its truth (FAIR 0.05: 0.0288), the mirrored crown 0.0140 (FAIR 0.05: 0.0534; no end terms: 0.0646). Separations 3.4, 3.3 and 1.95 each side. A pixel is 5 mm here and the traces are exact, where weaker fairness reads nearer (FAIR 0.5: 0.0011, 0.0018, 0.0054): tests/test_reference.py test_fairness_is_set_by_the_rendered_roof says why 0.2 stands
|
||||
|
||||
|
||||
def check(name, ok, detail=None):
|
||||
R["checks"].append({"name": name, "ok": bool(ok), "detail": detail})
|
||||
|
||||
|
||||
def send(action, **fields):
|
||||
COUNT[0] += 1
|
||||
receipt = target.run_intent(bpy.context, {"commandId": f"live-{COUNT[0]}", "requestedBy": "test/driver", "action": action, **fields})
|
||||
result = json.loads(receipt["hostResult"]) if receipt.get("hostResult") else None
|
||||
print("SEND", f"{time.time() - T0:.1f}s", action, receipt["status"], str(receipt["message"])[:400], flush=True)
|
||||
return receipt, result
|
||||
|
||||
|
||||
def built(chain):
|
||||
return core.crease_run(core.crease_run(np.asarray(chain, float)))
|
||||
|
||||
|
||||
def pentagon():
|
||||
"""Five sides as five-point cage chains: a plate 1.2 m across facing -y, its corners up to 0.15 m off the plane
|
||||
y = 0, each side bowed 8% of its length toward -y and 35% outward in the plate."""
|
||||
angles = [2 * math.pi * i / 5 + 0.3 for i in range(5)]
|
||||
P = np.array([[0.6 * math.cos(t), 0.15 * math.cos(2 * t), 0.6 * math.sin(t)] for t in angles])
|
||||
s, sides = np.linspace(0, 1, 5)[:, None], []
|
||||
for a, b in zip(P, np.roll(P, -1, axis=0)):
|
||||
sides.append(a + s * (b - a) + np.sin(math.pi * s) * np.linalg.norm(b - a) * (0.08 * np.array([0, -1.0, 0]) + 0.35 * (a + b) / np.linalg.norm(a + b)))
|
||||
return sides
|
||||
|
||||
|
||||
def half():
|
||||
"""A mirrored plate's authored half as chains: the seam's side on x = 0, bowed in the plane, and three free sides."""
|
||||
P = np.array([[0.0, 0.0, 0.5], [0.0, 0.0, -0.5], [0.5, 0.1, -0.4], [0.3, 0.1, 0.4]])
|
||||
s, sides = np.linspace(0, 1, 5)[:, None], []
|
||||
for i, (a, b) in enumerate(zip(P, np.roll(P, -1, axis=0))):
|
||||
bow = np.array([0.0, -0.3, 0.0]) if i == 0 else np.array([0.25, -0.1, 0.0]) if i == 1 else np.zeros(3)
|
||||
sides.append(a + s * (b - a) + np.sin(math.pi * s) * np.linalg.norm(b - a) * bow)
|
||||
return sides
|
||||
|
||||
|
||||
def pixels(camera, frame, points, side=1):
|
||||
out = []
|
||||
for p in np.asarray(points, float) * [side, 1, 1]:
|
||||
x, y, _ = world_to_camera_view(bpy.context.scene, camera, frame.matrix_world @ Vector(p))
|
||||
out.append([round(x * WIDTH, 3), round((1.0 - y) * HEIGHT, 3)])
|
||||
return out
|
||||
|
||||
|
||||
def chains_of(out):
|
||||
n, first, chains = sum(side["points"] - 1 for side in out["sides"]), 0, []
|
||||
for side in out["sides"]:
|
||||
chains.append([(first + m) % n for m in range(side["points"])])
|
||||
first += side["points"] - 1
|
||||
return chains
|
||||
|
||||
|
||||
def at_one_level(name, sheet, chains, mirror=False):
|
||||
"""The furthest a crown side as core.crease_run builds it at one level stands from a vertex Blender built."""
|
||||
send("brokkr_kitbash.shell", object_name=name, sheet=json.dumps(sheet), thickness=0.03, levels=1)
|
||||
shell = bpy.data.objects[name]
|
||||
wall = shell.modifiers["Kit Solidify"]
|
||||
wall.show_viewport = False
|
||||
mesh = np.array([v.co for v in shell.evaluated_get(bpy.context.evaluated_depsgraph_get()).to_mesh().vertices])
|
||||
wall.show_viewport = True
|
||||
verts = np.array(sheet["verts"])
|
||||
return max(float(np.linalg.norm(mesh - p * [side, 1, 1], axis=1).min()) for chain in chains for side in ((1, -1) if mirror else (1,)) for p in core.crease_run(verts[chain]))
|
||||
|
||||
|
||||
def snapshot():
|
||||
return sorted((o.name, o.type, tuple(round(c, 6) for row in o.matrix_world for c in row), o.get("kit_shell")) for o in bpy.data.objects)
|
||||
|
||||
|
||||
try:
|
||||
check("host files admitted with the block_plate row", not R["hostErrors"] and "brokkr_reference.block_plate" in R["hostRows"], R["hostErrors"] or R["hostRows"][-4:])
|
||||
scene = bpy.context.scene
|
||||
scene.render.resolution_x, scene.render.resolution_y, scene.render.resolution_percentage = WIDTH, HEIGHT, 100
|
||||
frame = bpy.data.objects.new("Frame", None)
|
||||
scene.collection.objects.link(frame)
|
||||
frame.matrix_world = Matrix.Translation((0.3, -0.2, 1.0)) @ Euler((0.0, 0.0, math.radians(15.0))).to_matrix().to_4x4()
|
||||
cameras = []
|
||||
for name, azimuth in (("A", 15.0), ("B", 75.0)):
|
||||
camera = bpy.data.objects.new(name, bpy.data.cameras.new(name))
|
||||
scene.collection.objects.link(camera)
|
||||
camera.data.lens, camera.data.sensor_fit = 50.0, "HORIZONTAL"
|
||||
a = math.radians(azimuth)
|
||||
camera.location = Vector((0.3, -0.2, 1.0)) + 7.0 * Vector((math.sin(a), -math.cos(a), 0.15))
|
||||
camera.rotation_euler = (Vector((0.3, -0.2, 1.0)) - camera.location).to_track_quat("-Z", "Y").to_euler()
|
||||
cameras.append(camera)
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
# --- the truth, built by brokkr_kitbash.shell, and its sides traced in both views -------------------------------
|
||||
names = [f"c{i}" for i in range(5)]
|
||||
sides = pentagon()
|
||||
crown = np.concatenate([side[:-1] for side in sides])
|
||||
truth = core.plate_sheet(crown, [0, 4, 8, 12, 16], facing=[0.0, -1.0, 0.0])
|
||||
made, _ = send("brokkr_kitbash.shell", object_name="Truth", sheet=json.dumps(truth), thickness=0.03, levels=2)
|
||||
bpy.data.objects["Truth"].matrix_world = frame.matrix_world
|
||||
bpy.context.view_layer.update()
|
||||
traces = [{"camera": camera.name, "from": names[i], "to": names[(i + 1) % 5], "side": 1, "line": pixels(camera, frame, core.resampled(built(side), 24))} for i, side in enumerate(sides) for camera in cameras]
|
||||
inside = all(0 <= u <= WIDTH and 0 <= v <= HEIGHT for trace in traces for u, v in trace["line"])
|
||||
check("brokkr_kitbash.shell builds the truth from core.plate_sheet, and both cameras frame every side", made["status"] == "accepted" and inside, made["message"])
|
||||
|
||||
# --- block_plate ------------------------------------------------------------------------------------------------------
|
||||
before = snapshot()
|
||||
receipt, out = send("brokkr_reference.block_plate", frame_object="Frame", plate=json.dumps({"corners": names}), traces=json.dumps(traces, separators=(",", ":")))
|
||||
ok = receipt["status"] == "accepted" and out is not None
|
||||
check(f"block_plate returns a sheet with every trace explained within {core.TOL:g} px and each corner decided by the views",
|
||||
ok and max(row["unexplained_px"] for side in out["sides"] for row in side["traces"]) <= core.TOL and {corner["decided_by"] for corner in out["corners"]} == {"views"}
|
||||
and len(receipt["hostResult"]) < 16000,
|
||||
out and {"sides": [side["points"] for side in out["sides"]], "corners": [[corner["parallax_deg"], corner["m_per_px"], corner["prior_share"]] for corner in out["corners"]],
|
||||
"rounds": out["rounds"], "seconds": out["seconds"], "chars": len(receipt["hostResult"])} or receipt["message"])
|
||||
check("block_plate wrote nothing: every object is as it was", snapshot() == before)
|
||||
if ok:
|
||||
chains = chains_of(out)
|
||||
verts = np.array(out["sheet"]["verts"])
|
||||
gap = max(float(core._off(built(verts[chain]), core.resampled(built(side), 400)).max()) for chain, side in zip(chains, sides))
|
||||
check(f"the blocked crown as built stands within {GAP:g} m of the truth's", gap < GAP, gap)
|
||||
worst = at_one_level("Blocked", out["sheet"], chains)
|
||||
check("brokkr_kitbash.shell takes the blocked sheet, and at one level Blender builds every crown side where core.crease_run says, within 1e-4 m",
|
||||
"Blocked" in bpy.data.objects and worst < 1e-4, worst)
|
||||
applied, _ = send("brokkr_kitbash.shell", object_name="Blocked", sheet=json.dumps(out["sheet"]), thickness=0.03, levels=2)
|
||||
bpy.data.objects["Blocked"].matrix_world = frame.matrix_world
|
||||
bpy.context.view_layer.update()
|
||||
receipt, fit = send("brokkr_reference.fit_shell", object_name="Blocked", traces=json.dumps(out["fit_traces"], separators=(",", ":")))
|
||||
moved = fit and max(point["moved_m"] for point in fit["points"])
|
||||
check(f"fit_shell takes the returned fit_traces on the built plate: accepted, every trace explained, no point moved over {MOVED:g} m",
|
||||
applied["status"] == "accepted" and receipt["status"] == "accepted" and len(out["fit_traces"]) == 10 and out["left_out"] == [] and moved < MOVED
|
||||
and max(row["unexplained_px"] for row in fit["traces"]) <= core.TOL, {"moved_m": moved} if fit else receipt["message"])
|
||||
|
||||
# --- a mirrored plate ---------------------------------------------------------------------------------------------------
|
||||
names = ["top", "bottom", "low", "high"]
|
||||
sides = half()
|
||||
traces = [{"camera": camera.name, "from": names[i], "to": names[(i + 1) % 4], "side": side_, "line": pixels(camera, frame, core.resampled(built(side), 24), side_)}
|
||||
for i, side in enumerate(sides) for camera, side_ in ((cameras[0], 1), (cameras[1], 1), (cameras[0], -1))]
|
||||
traces = [trace for trace in traces if not (trace["from"] == "top" and trace["side"] == -1)] # the seam's side is its own reflection
|
||||
receipt, out = send("brokkr_reference.block_plate", frame_object="Frame", plate=json.dumps({"corners": names, "mirror": True, "seam": ["top", "bottom"]}),
|
||||
traces=json.dumps(traces, separators=(",", ":")))
|
||||
ok = receipt["status"] == "accepted" and out is not None
|
||||
if ok:
|
||||
chains = chains_of(out)
|
||||
verts = np.array(out["sheet"]["verts"])
|
||||
gap = max(float(core._off(built(verts[chain]), core.resampled(built(side), 400)).max()) for chain, side in zip(chains, sides))
|
||||
check(f"a mirrored plate: the seam's corners are decided by the mirror plane, its side stays on x = 0, and the crown as built stands within {GAP_MIRRORED:g} m of the truth's",
|
||||
[corner["decided_by"] for corner in out["corners"]][:2] == ["mirror", "mirror"] and float(np.abs(verts[chains[0], 0]).max()) == 0.0 and gap < GAP_MIRRORED,
|
||||
{"gap": gap, "sides": [side["points"] for side in out["sides"]], "corners": [corner["decided_by"] for corner in out["corners"]], "poles": out["sheet"]["poles"]})
|
||||
worst = at_one_level("Mirrored", out["sheet"], chains, mirror=True)
|
||||
check("brokkr_kitbash.shell builds both halves of the mirrored sheet, and at one level Blender builds the seam's side and the free sides, on both halves, where core.crease_run says, within 1e-4 m",
|
||||
"Mirrored" in bpy.data.objects and worst < 1e-4, worst)
|
||||
else:
|
||||
check("block_plate blocks a mirrored plate", False, receipt["message"])
|
||||
|
||||
# --- refusals ---------------------------------------------------------------------------------------------------------
|
||||
before = snapshot()
|
||||
plate, text = json.dumps({"corners": names, "mirror": True, "seam": ["top", "bottom"]}), json.dumps(traces, separators=(",", ":"))
|
||||
receipt, _ = send("brokkr_reference.block_plate", frame_object="Frame", plate=plate, traces=json.dumps([dict(traces[0], camera="Nobody")] + traces[1:], separators=(",", ":")))
|
||||
check("an unknown camera is refused naming the trace", receipt["status"] == "failed" and "traces[0]" in receipt["message"] and "Nobody" in receipt["message"], receipt["message"])
|
||||
receipt, _ = send("brokkr_reference.block_plate", frame_object="Frame", plate=plate, traces=json.dumps([trace for trace in traces if trace["from"] != "low"], separators=(",", ":")))
|
||||
check("a side nobody traced is refused by its corners' names", receipt["status"] == "failed" and "the side from 'low' to 'high' is traced in no view" in receipt["message"], receipt["message"])
|
||||
receipt, _ = send("brokkr_reference.block_plate", frame_object="Frame", plate=plate, traces=text, plane="0,0,0; 0,0")
|
||||
check("a plane that is not a point and a normal is refused", receipt["status"] == "failed" and "plane" in receipt["message"], receipt["message"])
|
||||
check("no refusal changed the scene", snapshot() == before)
|
||||
frame.scale = (2.0, 2.0, 2.0)
|
||||
bpy.context.view_layer.update()
|
||||
receipt, _ = send("brokkr_reference.block_plate", frame_object="Frame", plate=plate, traces=text)
|
||||
check("a scaled frame is refused", receipt["status"] == "failed" and "scaled" in receipt["message"], receipt["message"])
|
||||
except Exception: # noqa: BLE001 whatever it was, it is a failed check with a name, printed and written, not a missing result file
|
||||
check(f"no uncaught error after: {R['checks'][-1]['name'] if R['checks'] else 'the start'}", False, traceback.format_exc().splitlines()[-6:])
|
||||
|
||||
R["ok"] = all(c["ok"] for c in R["checks"])
|
||||
for c in R["checks"]:
|
||||
print("CHECK", "ok " if c["ok"] else "FAIL", c["name"], "" if c["ok"] else c["detail"], flush=True)
|
||||
Path(OUT + ".result.json").write_text(json.dumps(R, indent=1, default=str), encoding="utf-8")
|
||||
sys.exit(0 if R["ok"] else 1)
|
||||
175
surfaces/blender/tests/live/reference_block.result.json
Normal file
175
surfaces/blender/tests/live/reference_block.result.json
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
{
|
||||
"blender": "5.3.0",
|
||||
"checks": [
|
||||
{
|
||||
"name": "host files admitted with the block_plate row",
|
||||
"ok": true,
|
||||
"detail": [
|
||||
"brokkr_reference.solve_camera",
|
||||
"brokkr_reference.flow_score",
|
||||
"brokkr_reference.fit_shell",
|
||||
"brokkr_reference.block_plate"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.shell builds the truth from core.plate_sheet, and both cameras frame every side",
|
||||
"ok": true,
|
||||
"detail": "Operator brokkr_kitbash.shell finished."
|
||||
},
|
||||
{
|
||||
"name": "block_plate returns a sheet with every trace explained within 5.2 px and each corner decided by the views",
|
||||
"ok": true,
|
||||
"detail": {
|
||||
"sides": [
|
||||
3,
|
||||
3,
|
||||
3,
|
||||
3,
|
||||
3
|
||||
],
|
||||
"corners": [
|
||||
[
|
||||
60.6,
|
||||
0.0031,
|
||||
0.019
|
||||
],
|
||||
[
|
||||
61.0,
|
||||
0.0042,
|
||||
0.026
|
||||
],
|
||||
[
|
||||
56.4,
|
||||
0.0035,
|
||||
0.022
|
||||
],
|
||||
[
|
||||
57.3,
|
||||
0.0036,
|
||||
0.022
|
||||
],
|
||||
[
|
||||
60.1,
|
||||
0.0037,
|
||||
0.023
|
||||
]
|
||||
],
|
||||
"rounds": 2,
|
||||
"seconds": 0.137,
|
||||
"chars": 7703
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "block_plate wrote nothing: every object is as it was",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "the blocked crown as built stands within 0.0088 m of the truth's",
|
||||
"ok": true,
|
||||
"detail": 0.002711610846938251
|
||||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.shell takes the blocked sheet, and at one level Blender builds every crown side where core.crease_run says, within 1e-4 m",
|
||||
"ok": true,
|
||||
"detail": 1.1421151381392388e-07
|
||||
},
|
||||
{
|
||||
"name": "fit_shell takes the returned fit_traces on the built plate: accepted, every trace explained, no point moved over 0.0165 m",
|
||||
"ok": true,
|
||||
"detail": {
|
||||
"moved_m": 0.0048
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "a mirrored plate: the seam's corners are decided by the mirror plane, its side stays on x = 0, and the crown as built stands within 0.0273 m of the truth's",
|
||||
"ok": true,
|
||||
"detail": {
|
||||
"gap": 0.013972102623404082,
|
||||
"sides": [
|
||||
3,
|
||||
3,
|
||||
2,
|
||||
2
|
||||
],
|
||||
"corners": [
|
||||
"mirror",
|
||||
"mirror",
|
||||
"views",
|
||||
"views"
|
||||
],
|
||||
"poles": [
|
||||
0,
|
||||
2,
|
||||
11
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "brokkr_kitbash.shell builds both halves of the mirrored sheet, and at one level Blender builds the seam's side and the free sides, on both halves, where core.crease_run says, within 1e-4 m",
|
||||
"ok": true,
|
||||
"detail": 8.42242114374928e-08
|
||||
},
|
||||
{
|
||||
"name": "an unknown camera is refused naming the trace",
|
||||
"ok": true,
|
||||
"detail": "Error: traces[0]: 'Nobody' is not a camera object."
|
||||
},
|
||||
{
|
||||
"name": "a side nobody traced is refused by its corners' names",
|
||||
"ok": true,
|
||||
"detail": "Error: the side from 'low' to 'high' is traced in no view: every side of the outline is traced, or the plate is given fewer corners. Nothing changed."
|
||||
},
|
||||
{
|
||||
"name": "a plane that is not a point and a normal is refused",
|
||||
"ok": true,
|
||||
"detail": "Error: plane's normal '0,0' is not 3 finite numbers with commas between."
|
||||
},
|
||||
{
|
||||
"name": "no refusal changed the scene",
|
||||
"ok": true,
|
||||
"detail": null
|
||||
},
|
||||
{
|
||||
"name": "a scaled frame is refused",
|
||||
"ok": true,
|
||||
"detail": "Error: frame_object 'Frame' is scaled (2.0, 2.0, 2.0): a plate is in metres of its frame. Apply or clear the scale."
|
||||
}
|
||||
],
|
||||
"hostErrors": [],
|
||||
"hostRows": [
|
||||
"brokkr_mesh_polish.audit",
|
||||
"brokkr_mesh_polish.repair",
|
||||
"brokkr_mesh_polish.orient",
|
||||
"brokkr_mesh_polish.delight",
|
||||
"brokkr_mesh_polish.scrub_markings",
|
||||
"brokkr_mesh_polish.cut_parts",
|
||||
"brokkr_mesh_polish.pick",
|
||||
"brokkr_kitbash.place_part",
|
||||
"brokkr_kitbash.set_params",
|
||||
"brokkr_kitbash.describe",
|
||||
"brokkr_kitbash.report",
|
||||
"brokkr_kitbash.attach",
|
||||
"brokkr_kitbash.detach",
|
||||
"brokkr_kitbash.roll",
|
||||
"brokkr_kitbash.aim",
|
||||
"brokkr_kitbash.reach",
|
||||
"brokkr_kitbash.joint",
|
||||
"brokkr_kitbash.slide",
|
||||
"brokkr_kitbash.joints",
|
||||
"brokkr_kitbash.close",
|
||||
"brokkr_kitbash.boolean",
|
||||
"brokkr_kitbash.cut",
|
||||
"brokkr_kitbash.cut_many",
|
||||
"brokkr_kitbash.freeze",
|
||||
"brokkr_kitbash.thaw",
|
||||
"brokkr_kitbash.ribs",
|
||||
"brokkr_kitbash.shell",
|
||||
"brokkr_kitbash.hose",
|
||||
"brokkr_reference.solve_camera",
|
||||
"brokkr_reference.flow_score",
|
||||
"brokkr_reference.fit_shell",
|
||||
"brokkr_reference.block_plate"
|
||||
],
|
||||
"ok": true
|
||||
}
|
||||
|
|
@ -245,7 +245,7 @@ class CheckKitTests(unittest.TestCase):
|
|||
for name in ("../x", "mechanical.v0", "Mechanical", "", "a/b", "x" * 33, 3):
|
||||
with self.assertRaisesRegex(core.KitError, "must be 1 to 32 of"):
|
||||
core.load_kit(name)
|
||||
with self.assertRaisesRegex(core.KitError, "no kit named 'absent'; kits: cutters, frame, mechanical"):
|
||||
with self.assertRaisesRegex(core.KitError, "no kit named 'absent'; kits: cutters, fittings, frame, mechanical"):
|
||||
core.load_kit("absent")
|
||||
with self.assertRaisesRegex(core.KitError, "has no part 'wing'; its parts: nozzle, tank"):
|
||||
core.part(core.load_kit("mechanical"), "wing")
|
||||
|
|
@ -923,6 +923,157 @@ class FrameKitTests(unittest.TestCase):
|
|||
|
||||
|
||||
@unittest.skipIf(np is None, "numpy is not installed")
|
||||
class FittingsKitTests(unittest.TestCase):
|
||||
"""kits/fittings.v0.json: what brokkr_kitbash.plate stands on a face."""
|
||||
PARTS = ["bolt", "slot", "pit", "vents", "access_port", "port_bolts", "handle", "eye", "louvres"]
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.kit = core.load_kit("fittings")
|
||||
|
||||
def shells(self, built):
|
||||
"""Each shape's faces as a Built of their own: a part's shells stand through each other, and each is held closed."""
|
||||
counts = built.counts.tolist()
|
||||
starts = np.concatenate([[0], np.cumsum(counts)[:-1]])
|
||||
for index in sorted(set(built.shape.tolist())):
|
||||
own = [k for k in range(len(counts)) if built.shape[k] == index]
|
||||
yield built._replace(faces=np.concatenate([built.faces[starts[k]:starts[k] + counts[k]] for k in own]), counts=np.array([counts[k] for k in own]))
|
||||
|
||||
def test_the_kit_is_its_nine_parts_and_no_sockets(self):
|
||||
self.assertEqual(list(self.kit["parts"]), self.PARTS)
|
||||
self.assertEqual(self.kit["socketTypes"], {})
|
||||
self.assertEqual([part["sockets"] for part in self.kit["parts"].values()], [[]] * 9)
|
||||
|
||||
def test_the_defaults_are_the_kits_doc(self):
|
||||
"""What a row that names no params gets, part by part."""
|
||||
self.assertEqual({name: {p["name"]: p["default"] for p in part["params"]} for name, part in self.kit["parts"].items()}, {
|
||||
"bolt": {"r": 0.017}, "slot": {"w": 0.2, "h": 0.04}, "pit": {"w": 0.2, "h": 0.04, "depth": 0.012, "count": 1, "pitch": 0},
|
||||
"vents": {"w": 0.3, "h": 0.03, "count": 4}, "access_port": {"r": 0.12}, "port_bolts": {"r": 0.12}, "handle": {"length": 0.3, "lift": 0.065, "r": 0.016},
|
||||
"eye": {"size": 0.1}, "louvres": {"w": 0.6, "h": 0.72, "n": 6, "depth": 0.05, "frame": 0.07, "slant": 25}})
|
||||
|
||||
def test_every_part_builds_closed_and_wound_out_from_the_face(self):
|
||||
for name, part in self.kit["parts"].items():
|
||||
rng = random.Random(f"fittings.{name}")
|
||||
draws = [{}] + [{p["name"]: rng.randint(p["min"], p["max"]) if p["type"] == "integer" else rng.uniform(p["min"], p["max"]) for p in part["params"]} for _ in range(16)]
|
||||
for draw in draws:
|
||||
if name == "louvres" and draw and draw["frame"] >= min(draw["w"], draw["h"]):
|
||||
with self.assertRaises(core.KitError):
|
||||
core.build(part, draw)
|
||||
continue
|
||||
if name == "handle" and draw and draw["r"] > 0.25 * min(0.4 * draw["lift"], 0.2 * draw["length"]):
|
||||
try: # a bar thick against its bend may fold on the inside of a turn: core refuses it by name
|
||||
core.build(part, draw)
|
||||
except core.KitError as error:
|
||||
self.assertIn("the section folds there", str(error))
|
||||
continue
|
||||
built = core.build(part, draw)
|
||||
self.assertTrue(closed_and_oriented(built), (name, draw))
|
||||
for shell in self.shells(built):
|
||||
self.assertGreater(signed_volume(shell), 0, (name, draw))
|
||||
self.assertGreater(float(built.V[:, 2].max()), 0.0, (name, draw))
|
||||
floor = float(core.build(part).V[:, 2].min())
|
||||
self.assertGreaterEqual(floor, {"bolt": -0.0005, "handle": -0.004, "eye": -0.002, "louvres": -0.008}.get(name, 0.0), name) # what a part sinks into the face at its defaults
|
||||
|
||||
def test_the_bolt_is_the_tracks_washer_and_head(self):
|
||||
built = core.build(self.kit["parts"]["bolt"], {"r": 0.017})
|
||||
washer, head = built.V[:28], built.V[28:]
|
||||
self.assertLess(float(np.abs(np.linalg.norm(washer[:, :2], axis=1) - 1.55 * 0.017).max()), 1e-15)
|
||||
self.assertLess(float(np.abs(np.linalg.norm(head[:, :2], axis=1) - 0.017).max()), 1e-15)
|
||||
self.assertEqual(sorted(set(np.round(built.V[:, 2], 12).tolist())), [-0.0005, 0.0035, 0.0035 + 0.7 * 0.017])
|
||||
self.assertLess(abs(float(head[0, 0])), 1e-15) # a corner on +y, as the tracks' heads stand
|
||||
|
||||
|
||||
# Shapes: each part at params off its defaults, every shell's place and size from the kit's doc. A reading is how
|
||||
# far a built point or extent stands from the stated one (metres). Shipped: float rounding, held as 2.2e-16 a metre.
|
||||
# Least claimed mutants: port_bolts' heads on 0.9 r (0.91 shipped) at r 0.1, a slot bar 0.001 off, the port's heads
|
||||
# 0.001 up: each reads 1e-3. The bound is the geometric mean, 4.7e-10 (lodur:ruling:deterministic-bound-margin).
|
||||
SHAPED = 4.7e-10
|
||||
TOPOLOGY = {"slot": (32, 24, 4), "pit": (24, 18, 3), "vents": (24, 18, 3), "access_port": (170, 196, 1), "port_bolts": (96, 64, 8),
|
||||
"handle": (112, 82, 5), "eye": (200, 188, 5), "louvres": (64, 48, 8)}
|
||||
|
||||
def pieces(self, built, each=None):
|
||||
"""Each shape's points; a repeat's copies apart, `each` points a copy."""
|
||||
counts = built.counts.tolist()
|
||||
starts = np.concatenate([[0], np.cumsum(counts)[:-1]]).astype(int)
|
||||
out = []
|
||||
for index in sorted(set(built.shape.tolist())):
|
||||
points = built.V[sorted({int(v) for k in range(len(counts)) if built.shape[k] == index for v in built.faces[starts[k]:starts[k] + counts[k]]})]
|
||||
out += [points[i:i + each] for i in range(0, len(points), each)] if each else [points]
|
||||
return out
|
||||
|
||||
def box(self, points, centre, size, slant=0.0):
|
||||
"""How far a box's extents stand from a box of size about centre, turned slant degrees about x."""
|
||||
c, s = math.cos(math.radians(slant)), abs(math.sin(math.radians(slant)))
|
||||
half = np.array([size[0] / 2, size[1] / 2 * c + size[2] / 2 * s, size[1] / 2 * s + size[2] / 2 * c])
|
||||
return float(np.abs(np.array([points.min(axis=0), points.max(axis=0)]) - [np.array(centre) - half, np.array(centre) + half]).max())
|
||||
|
||||
def tube(self, points, axis, radius, low, high):
|
||||
"""How far a tube's points stand from radius about the vertical through axis (x, y), from low to high."""
|
||||
return max(float(np.abs(np.linalg.norm(points[:, :2] - axis, axis=1) - radius).max()), abs(float(points[:, 2].min()) - low), abs(float(points[:, 2].max()) - high))
|
||||
|
||||
def built(self, name, params):
|
||||
b = core.build(self.kit["parts"][name], core.parse_params(params))
|
||||
self.assertEqual((len(b.V), len(b.counts), b.shell_count), self.TOPOLOGY[name], name)
|
||||
self.assertTrue(closed_and_oriented(b), name)
|
||||
return b
|
||||
|
||||
def test_slot_and_pit_are_their_boxes(self):
|
||||
"""The slot's four bars around a w by h opening, 0.032 wide and 0.028 tall; the pit's count boxes pitch apart."""
|
||||
w, h = 0.3, 0.1
|
||||
bars = self.pieces(self.built("slot", "w=0.3; h=0.1"))
|
||||
for points, centre, size in zip(bars, ([0, h / 2 + 0.016, 0.014], [0, -h / 2 - 0.016, 0.014], [w / 2 + 0.016, 0, 0.014], [-w / 2 - 0.016, 0, 0.014]),
|
||||
([w + 0.06, 0.032, 0.028],) * 2 + ([0.032, h, 0.028],) * 2):
|
||||
self.assertLess(self.box(points, centre, size), self.SHAPED, centre)
|
||||
for k, points in enumerate(self.pieces(self.built("pit", "w=0.1; h=0.03; depth=0.02; count=3; pitch=0.08"), 8)):
|
||||
self.assertLess(self.box(points, [0, -0.08 + 0.08 * k, 0.01], [0.1, 0.03, 0.02]), self.SHAPED, k)
|
||||
|
||||
def test_vents_and_louvres_lean_their_own_ways(self):
|
||||
"""A vents lip is tilted 28 degrees with its upper edge down to the face; a louvre slat is turned slant
|
||||
degrees with its upper edge up off it."""
|
||||
h = 0.04
|
||||
for k, points in enumerate(self.pieces(self.built("vents", "w=0.2; h=0.04; count=3"), 8)):
|
||||
self.assertLess(self.box(points, [0, 0.75 * h - 2.7 * h + 2.7 * h * k, 0.014], [0.24, 0.9 * h, 0.012], 28), self.SHAPED, k)
|
||||
self.assertLess(float(points[np.argmax(points[:, 1]), 2]), 0.014, k)
|
||||
w, h, n, depth, frame = 0.5, 0.4, 4, 0.06, 0.05
|
||||
louvres = self.built("louvres", "w=0.5; h=0.4; n=4; depth=0.06; frame=0.05; slant=30")
|
||||
for points, centre, size in zip(self.pieces(louvres)[:4], ([0, -h / 2, depth / 2], [0, h / 2, depth / 2], [-w / 2, 0, depth / 2], [w / 2, 0, depth / 2]),
|
||||
([w + frame, frame, depth],) * 2 + ([frame, h + frame, depth],) * 2):
|
||||
self.assertLess(self.box(points, centre, size), self.SHAPED, centre)
|
||||
pitch = (h - frame) / n
|
||||
for k, points in enumerate(self.pieces(louvres, 8)[4:]):
|
||||
self.assertLess(self.box(points, [0, -0.5 * (h - frame) + 0.5 * pitch + pitch * k, 0.3 * depth], [w - frame, 0.75 * pitch, 0.25 * depth], 30), self.SHAPED, k)
|
||||
self.assertGreater(float(points[np.argmax(points[:, 1]), 2]), 0.3 * depth, k)
|
||||
|
||||
def test_access_port_is_its_profile_turned_and_its_heads_on_the_rim(self):
|
||||
"""The port's 28 turns of its eight profile points; eight hex heads of 0.07 r on 0.91 r at 45 degree steps,
|
||||
from the shoulder (0.035) up 0.012."""
|
||||
r = 0.1
|
||||
port = self.built("access_port", "r=0.1")
|
||||
turned = {(round(float(np.hypot(x, y)) / r, 9), round(float(z), 9)) for x, y, z in port.V}
|
||||
self.assertEqual(turned, {(0.0, 0.0), (1.0, 0.0), (1.0, 0.035), (0.82, 0.05), (0.82, 0.022), (0.34, 0.022), (0.34, 0.045), (0.0, 0.045)})
|
||||
for k, points in enumerate(self.pieces(self.built("port_bolts", "r=0.1"))):
|
||||
turn = math.radians(45 * k)
|
||||
self.assertLess(self.tube(points, 0.91 * r * np.array([math.cos(turn), math.sin(turn)]), 0.07 * r, 0.035, 0.047), self.SHAPED, k)
|
||||
|
||||
def test_handle_and_eye_stand_their_shells(self):
|
||||
"""The handle's bar 2 r square from 0.004 under the face to lift + r, its posts length apart on a washer of
|
||||
2.3 r and a hex foot of 1.5 r; the eye's pad, two heads 0.72 size off its middle, a neck, and a ring of 0.29
|
||||
to 0.55 size about 0.012 + 0.62 size, 0.26 size thick across x."""
|
||||
length, lift, r = 0.4, 0.08, 0.012
|
||||
bar, *feet = self.pieces(self.built("handle", "length=0.4; lift=0.08; r=0.012"))
|
||||
self.assertLess(float(np.abs(np.array([bar.min(axis=0), bar.max(axis=0)]) - [[-r, -length / 2 - r, -0.004], [r, length / 2 + r, lift + r]]).max()), self.SHAPED)
|
||||
for points, y, radius, low in zip(feet, (-1, 1, -1, 1), (2.3 * r, 2.3 * r, 1.5 * r, 1.5 * r), (0.0, 0.0, 0.008, 0.008)):
|
||||
self.assertLess(self.tube(points, [0, y * length / 2], radius, low, low + 0.008), self.SHAPED, (y, radius))
|
||||
size = 0.12
|
||||
pad, *heads, neck, ring = self.pieces(self.built("eye", "size=0.12"))
|
||||
self.assertLess(self.box(pad, [0, 0, 0.004], [1.1 * size, 2 * size, 0.012]), self.SHAPED)
|
||||
for points, y in zip(heads, (-1, 1)):
|
||||
self.assertLess(self.tube(points, [0, y * 0.72 * size], 0.11 * size, 0.01, 0.018), self.SHAPED, y)
|
||||
self.assertLess(self.box(neck, [0, 0, 0.012 + 0.1 * size], [0.34 * size, 0.5 * size, 0.24 * size]), self.SHAPED)
|
||||
across = np.hypot(ring[:, 1], ring[:, 2] - (0.012 + 0.62 * size))
|
||||
self.assertLess(max(abs(float(across.min()) - 0.29 * size), abs(float(across.max()) - 0.55 * size), abs(float(np.abs(ring[:, 0]).max()) - 0.13 * size)), self.SHAPED)
|
||||
|
||||
|
||||
class SurfaceFrameTests(unittest.TestCase):
|
||||
"""surface-frame: the frame brokkr_kitbash.cut gives a cutter. Bounds: a shipped reading is float rounding (worst
|
||||
4.4e-16 over the draws) and the least mutant's is 0.31 (S4, the roll dropped, at roll 18); 1e-9 separates them by
|
||||
|
|
@ -1594,6 +1745,241 @@ class JointRecordTests(unittest.TestCase):
|
|||
with self.assertRaisesRegex(core.KitError, "it reaches -1.000000 m to 1.000000 m"):
|
||||
core.reach_roll(np.eye(4), ident, ident, (0.0, 1.0, 0.0), (1.0, 0.0, 0.0), 1.5, 0.0, (0.0, 90.0))
|
||||
|
||||
def test_joint_rows_are_the_tree_s_dof_connections_in_the_root_s_frame(self):
|
||||
"""core.joint_rows, what brokkr_kitbash.joints reports: a barrel on a strut's pin (revolute), its rod (prismatic)
|
||||
and, on a root turned and moved in the world, a rigid part between two joints. Mutants J7 (a row's parent the
|
||||
part's parent, not the nearest joint above: 'Plate'), J8 (min and max the limits themselves: -20 and 60 for
|
||||
-50 and 30) and J11 (axis and origin in the world's frame: the origin stands 5.4 m off)."""
|
||||
parts = self.kit["parts"]
|
||||
strut, barrel, rod = (core.build(parts[name], {}) for name in ("strut", "ram_barrel", "ram_rod"))
|
||||
socket = lambda built, name: next(s for s in built.sockets if s["name"] == name) # noqa: E731
|
||||
root = np.eye(4)
|
||||
root[:3, :3] = core._rotation((20.0, -35.0, 50.0))
|
||||
root[:3, 3] = (1.0, -2.0, 5.0)
|
||||
barrel_world = root @ core.mate(socket(strut, "end_b"), socket(barrel, "base"), 30.0)
|
||||
record = {"limits": (-20.0, 60.0), "mechanism": "elbow", "compliance": None}
|
||||
free = {"limits": None, "mechanism": None, "compliance": None}
|
||||
rows, rigid = core.joint_rows(root, [
|
||||
("Barrel", "Root", "ram_barrel", socket(strut, "end_b"), root, "revolute", 30.0, record, None),
|
||||
("Plate", "Barrel", "bracket", socket(barrel, "port_cap"), barrel_world, None, 0.0, free, None),
|
||||
("Rod", "Plate", "ram_rod", socket(barrel, "bore"), barrel_world, "prismatic", 0.125, free, {"by": "Barrel", "kind": "ratio", "k": 0.001, "offset": 0.095})])
|
||||
self.assertEqual(rigid, 1)
|
||||
self.assertEqual([(row["id"], row["parent"], row["kind"], row["socket"]) for row in rows],
|
||||
[("Barrel", None, "revolute", "Root:end_b"), ("Rod", "Barrel", "prismatic", "Plate:bore")])
|
||||
self.assertEqual((rows[0]["value"], rows[0]["limits"], rows[0]["min"], rows[0]["max"], rows[0]["mechanism"], rows[0]["driven"]), (30.0, [-20.0, 60.0], -50.0, 30.0, "elbow", None))
|
||||
self.assertEqual((rows[1]["value"], rows[1]["limits"], rows[1]["min"], rows[1]["max"], rows[1]["driven"]["by"]), (0.125, None, None, None, "Barrel"))
|
||||
self.assertEqual([row["held"] for row in rows], [False, False])
|
||||
(held,), _ = core.joint_rows(root, [("Lug", "Root", "strut", socket(strut, "end_b"), root, "revolute", 90.0, {**free, "limits": (90.0, 90.0)}, None)])
|
||||
self.assertEqual((held["limits"], held["min"], held["max"], held["held"]), ([90.0, 90.0], 0.0, 0.0, True)) # limits of one value: no travel, and the row says so
|
||||
pin = socket(strut, "end_b")["matrix"]
|
||||
self.assertEqual((rows[0]["axis"], rows[0]["origin"]), ([round(float(v), 6) for v in pin[:3, 2]], [round(float(v), 6) for v in pin[:3, 3]])) # in the root's frame: the socket as the part has it
|
||||
bore = core.mate(socket(strut, "end_b"), socket(barrel, "base"), 30.0) @ socket(barrel, "bore")["matrix"]
|
||||
self.assertEqual((rows[1]["axis"], rows[1]["origin"]), ([round(float(v), 6) for v in bore[:3, 2]], [round(float(v), 6) for v in bore[:3, 3]]))
|
||||
self.assertGreater(float(np.linalg.norm((root @ pin)[:3, 3] - pin[:3, 3])), 5.0) # the world's frame is not the root's here
|
||||
|
||||
def test_limit_slack_sits_between_a_typed_end_and_the_least_refused(self):
|
||||
"""joint-records-lows. core.LIMIT_SLACK at the midpoint of its readings (2.4e-07), read 1.2 either side: a
|
||||
slack of 1.9e-08 loses float32(-20.1) and the value 2e-07 off; one of 2e-06 or 2.9e-06 (or the 1e-06 there
|
||||
was) takes the value 2.9e-07 off."""
|
||||
typed = float(np.float32(-20.1))
|
||||
self.assertAlmostEqual(abs(typed + 20.1) / 20.1, 1.9e-8, delta=1e-9)
|
||||
for revolute in (False, True):
|
||||
self.assertEqual(core.within(typed, -20.1, 5.0, revolute), -20.1)
|
||||
self.assertEqual(core.within(-20.1 * (1 + 2.0e-7), -20.1, 5.0, revolute), -20.1)
|
||||
self.assertIsNone(core.within(5.0 + 20.1 * 2.9e-7, -20.1, 5.0, revolute))
|
||||
self.assertIsNone(core.within(-20.1 * (1 + 2.9e-7), -20.1, 5.0, False))
|
||||
|
||||
|
||||
@unittest.skipIf(np is None, "numpy is not installed")
|
||||
class FollowTests(unittest.TestCase):
|
||||
"""core.close_loop: a driven pair of joints solved from the kit's socket frames and one closure. The four-bar is
|
||||
three mechanical struts, crank (the driver, on a ground pin), rocker and coupler, the coupler's end_b closing on the
|
||||
crank's end_b, against ram.pose's analytic four-bar; the ram is a ram_barrel on a ground pin and a ram_rod in its
|
||||
bore, rod_end closing on the crank's end_b_back. Bounds by lodur:ruling:deterministic-bound-margin; T1 is
|
||||
core.FOLLOW_TOLERANCE at core.HELD."""
|
||||
D0, REST, RAM_REST = 30.0, (-40.0, 70.0), (200.0, 0.1)
|
||||
PHI = 2.8e-7 # degrees between the rocker's roll change and ram.pose's phi. shipped 1.9e-10; least mutant 4.0e-4 (T1); separation 1.4e3 each side
|
||||
SLID = 5.6e-10 # metres between the rod's slide and |pin - base| less the closed length. shipped 5.4e-13; least mutant 5.9e-7 (T1); separation 1.0e3 each side
|
||||
BRANCH = 1e-6 # degrees between one solve across a jump and the stepped answer. shipped 4e-12 (both converge to FOLLOW_TOLERANCE); a rule: the other branch stands tens of degrees off
|
||||
CLOSED = 1.0e-10 # metres an accepted solve's closing origin stands from the pin, read from the frames. shipped worst 4.1e-11; a FOLLOW_TOLERANCE of 3e-10 reads 2.5e-10; separation 2.5 each side
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
spec = importlib.util.spec_from_file_location("brokkr_kitbash_ram_reference", SURFACE / "brokkr_kitbash" / "ram.py")
|
||||
cls.ram = importlib.util.module_from_spec(spec)
|
||||
sys.modules[spec.name] = cls.ram
|
||||
spec.loader.exec_module(cls.ram)
|
||||
kit = core.load_kit("mechanical")
|
||||
sockets = lambda name, **params: {s["name"]: s for s in core.build(core.part(kit, name), params).sockets} # noqa: E731
|
||||
cls.crank, cls.rocker, cls.coupler = sockets("strut", length=0.5), sockets("strut", length=0.9), sockets("strut", length=0.7)
|
||||
cls.barrel, cls.rod = sockets("ram_barrel"), sockets("ram_rod")
|
||||
cls.ground = cls.pin((0.0, 0.0, 0.0))
|
||||
cls.rocker_pin = cls.pin(cls.crank_pin(cls.D0)[:3, 3] - cls.coupler_end(cls.ground, cls.REST)[:3, 3]) # where the loop closes at rest
|
||||
cls.four_bar = [(cls.rocker_pin, cls.rocker["end_a"], "revolute"), (cls.rocker["end_b"], cls.coupler["end_a"], "revolute")]
|
||||
cls.barrel_pin = cls.pin(cls.crank_pin(cls.D0, "end_b_back")[:3, 3] - cls.rod_end(cls.ground, cls.RAM_REST)[:3, 3])
|
||||
cls.ram_loop = [(cls.barrel_pin, cls.barrel["base"], "revolute"), (cls.barrel["bore"], cls.rod["piston"], "prismatic")]
|
||||
|
||||
@staticmethod
|
||||
def pin(origin, z=(0.0, 1.0, 0.0), y=(0.0, 0.0, 1.0)):
|
||||
z, y, frame = np.array(z, dtype=np.float64), np.array(y, dtype=np.float64), np.eye(4)
|
||||
frame[:3, 0], frame[:3, 1], frame[:3, 2], frame[:3, 3] = np.cross(y, z), y, z, origin
|
||||
return {"name": "ground", "type": "pivot", "matrix": frame}
|
||||
|
||||
@classmethod
|
||||
def crank_pin(cls, driver, socket="end_b"):
|
||||
return core.mate(cls.ground, cls.crank["end_a"], driver) @ cls.crank[socket]["matrix"]
|
||||
|
||||
@classmethod
|
||||
def coupler_end(cls, pin, values):
|
||||
return core.mate(pin, cls.rocker["end_a"], values[0]) @ core.mate(cls.rocker["end_b"], cls.coupler["end_a"], values[1]) @ cls.coupler["end_b"]["matrix"]
|
||||
|
||||
@classmethod
|
||||
def rod_end(cls, pin, values):
|
||||
return core.mate(pin, cls.barrel["base"], values[0]) @ core.mate(cls.barrel["bore"], cls.rod["piston"], 0.0, values[1]) @ cls.rod["rod_end"]["matrix"]
|
||||
|
||||
def solve(self, driver, seed):
|
||||
return core.close_loop(np.eye(4), self.four_bar, self.coupler["end_b"], self.crank_pin(driver), seed)
|
||||
|
||||
def conditioning(self, values):
|
||||
"""The reading core.FOLLOW_SINGULAR bounds, by this file's own route: the two unit Jacobian columns' smaller singular value."""
|
||||
first = core.mate(self.rocker_pin, self.rocker["end_a"], values[0])
|
||||
q, columns = self.coupler_end(self.rocker_pin, values)[:3, 3], []
|
||||
for at in (self.rocker_pin["matrix"], first @ self.rocker["end_b"]["matrix"]):
|
||||
column = np.cross(at[:3, 2], q - at[:3, 3])
|
||||
columns.append(column / np.linalg.norm(column))
|
||||
return float(np.linalg.svd(np.stack(columns, axis=1), compute_uv=False)[-1])
|
||||
|
||||
def stepped(self, deltas):
|
||||
seed, worst = self.REST, {"phi": 0.0, "iterations": 0, "conditioning": math.inf, "closed": 0.0}
|
||||
rest = (core.mate(self.rocker_pin, self.rocker["end_a"], self.REST[0]) @ self.rocker["end_b"]["matrix"])[:3, 3]
|
||||
four_bar = self.ram.Mechanism("four_bar", pivot=self.ground["matrix"][:3, 3], axis=self.ground["matrix"][:3, 2], lo=-90, hi=130, a=np.array([0.3, 0.0, -0.4]),
|
||||
rocker=self.rocker_pin["matrix"][:3, 3], p=rest, c=self.crank_pin(self.D0)[:3, 3], d=rest)
|
||||
for delta in deltas:
|
||||
seed, iterations = self.solve(self.D0 + delta, seed)
|
||||
worst["phi"] = max(worst["phi"], abs(seed[0] - self.REST[0] - math.degrees(self.ram.pose(four_bar, delta).phi[0])))
|
||||
worst["iterations"], worst["conditioning"] = max(worst["iterations"], iterations), min(worst["conditioning"], self.conditioning(seed))
|
||||
worst["closed"] = max(worst["closed"], float(np.linalg.norm(self.crank_pin(self.D0 + delta)[:3, 3] - self.coupler_end(self.rocker_pin, seed)[:3, 3])))
|
||||
return seed, worst
|
||||
|
||||
def test_a_four_bar_loop_matches_ram_pose(self):
|
||||
"""loop-matches-ram-pose. 56 driver steps of 5 degrees, +120 and back to -30. Mutant F1 (a revolute Jacobian
|
||||
column's sign flipped: no solve converges). The readings here are the shipped side of core's three bounds:
|
||||
conditioning least 0.184 (at -30), iterations at most 4 (the step to -30), and the closing origin 4.1e-11 m
|
||||
from the pin at worst: a FOLLOW_TOLERANCE of 3e-10 stops one step short on 2.5e-10. FOLLOW_ITERATIONS is its
|
||||
rule, four times the worst."""
|
||||
_, worst = self.stepped([*np.arange(0.0, 121.0, 5.0), *np.arange(120.0, -31.0, -5.0)])
|
||||
self.assertLess(worst["phi"], self.PHI)
|
||||
self.assertEqual(worst["iterations"], 4)
|
||||
self.assertEqual(core.FOLLOW_ITERATIONS, 4 * worst["iterations"])
|
||||
self.assertLess(worst["closed"], self.CLOSED)
|
||||
self.assertLess(worst["closed"], core.FOLLOW_TOLERANCE)
|
||||
self.assertAlmostEqual(worst["conditioning"], 0.184, delta=0.001)
|
||||
self.assertGreater(worst["conditioning"], 1.2 * core.FOLLOW_SINGULAR)
|
||||
|
||||
def test_a_ram_loop_slides_to_the_pin(self):
|
||||
"""loop-matches-ram-pose, a revolute and a prismatic unknown: the slide is the distance from the barrel's base
|
||||
pin to the pin the rod closes on, less that distance closed."""
|
||||
seed, base, worst = self.RAM_REST, self.barrel_pin["matrix"][:3, 3], 0.0
|
||||
closed = float(np.linalg.norm(self.rod_end(self.barrel_pin, (self.RAM_REST[0], 0.0))[:3, 3] - base))
|
||||
for delta in np.arange(0.0, 121.0, 5.0):
|
||||
target = self.crank_pin(self.D0 + delta, "end_b_back")
|
||||
seed, iterations = core.close_loop(np.eye(4), self.ram_loop, self.rod["rod_end"], target, seed)
|
||||
worst = max(worst, abs(seed[1] - (float(np.linalg.norm(target[:3, 3] - base)) - closed)))
|
||||
self.assertLessEqual(iterations, 3)
|
||||
self.assertLess(worst, self.SLID)
|
||||
self.assertGreater(seed[1] - self.RAM_REST[1], 0.2) # the rod moved
|
||||
|
||||
def test_a_ram_s_dead_centre_is_its_rod_end_on_the_barrel_pin(self):
|
||||
"""A ram's conditioning is its lever over its lever closed, and its dead centre the rod's end on the barrel's
|
||||
pin: drawn in along its own line the ram is accepted at 0.184 of the closed lever and refused at 0.047, the two
|
||||
readings core.FOLLOW_SINGULAR sits between; and one solve to a pin on the far side of the barrel's, which
|
||||
Newton answers in one step with the rod's end through the pin, is refused as past the dead centre and not
|
||||
answered. Mutants C1 (the ram's revolute column scaled to unit length as a four-bar's: it reads 1 at 0.047)
|
||||
and C2 (the side not read: the far pin is answered at a slide of -1.2 closed levers)."""
|
||||
base, rest = self.barrel_pin["matrix"][:3, 3], self.crank_pin(self.D0, "end_b_back")
|
||||
closed = float(np.linalg.norm(self.rod_end(self.barrel_pin, (self.RAM_REST[0], 0.0))[:3, 3] - base))
|
||||
along = (rest[:3, 3] - base) / np.linalg.norm(rest[:3, 3] - base)
|
||||
|
||||
def pin(lever):
|
||||
target = rest.copy()
|
||||
target[:3, 3] = base + along * lever * closed
|
||||
return target
|
||||
|
||||
seed = self.RAM_REST
|
||||
for lever in (1.0, 0.8, 0.6, 0.4, 0.3, 0.184):
|
||||
seed, _ = core.close_loop(np.eye(4), self.ram_loop, self.rod["rod_end"], pin(lever), seed)
|
||||
self.assertAlmostEqual(seed[1], (lever - 1.0) * closed, delta=self.SLID)
|
||||
self.assertAlmostEqual(seed[0], self.RAM_REST[0], delta=self.BRANCH)
|
||||
self.assertGreater(0.184, 1.2 * core.FOLLOW_SINGULAR)
|
||||
self.assertLess(0.047, core.FOLLOW_SINGULAR / 1.2)
|
||||
with self.assertRaisesRegex(core.KitError, r"^the loop is at a dead centre \(its two joints move closing socket 'rod_end' along one line: conditioning 0\.047, under 0\.093\)$"):
|
||||
core.close_loop(np.eye(4), self.ram_loop, self.rod["rod_end"], pin(0.047), seed)
|
||||
with self.assertRaisesRegex(core.KitError, r"^the loop is past a dead centre \(the step takes the two joints that move closing socket 'rod_end' to their other assembly: "
|
||||
r"conditioning 0\.184 on that side\)$"):
|
||||
core.close_loop(np.eye(4), self.ram_loop, self.rod["rod_end"], pin(-0.184), seed)
|
||||
|
||||
def test_a_dead_centre_is_refused(self):
|
||||
"""loop-refusals. Stepping the crank back, rocker and coupler straighten: the step to -35 stands 6.7 degrees
|
||||
from straight, conditioning 0.047, the refused side of core.FOLLOW_SINGULAR; past it no pose closes the loop,
|
||||
and at -60 Newton's first step bends the pair the other way, which is refused as past the dead centre."""
|
||||
seed, _ = self.stepped(np.arange(0.0, -31.0, -5.0))
|
||||
self.assertLess(0.047, core.FOLLOW_SINGULAR / 1.2)
|
||||
for delta in (-35.0, -40.0):
|
||||
with self.assertRaisesRegex(core.KitError, r"^the loop is at a dead centre \(its two joints move closing socket 'end_b' along one line"):
|
||||
self.solve(self.D0 + delta, seed)
|
||||
with self.assertRaisesRegex(core.KitError, r"^the loop is past a dead centre \(the step takes the two joints that move closing socket 'end_b' to their other assembly"):
|
||||
self.solve(self.D0 - 60.0, seed)
|
||||
near, _ = self.stepped(np.arange(0.0, -34.0, -1.0)) # by single degrees it is accepted to -33, and -34 reads 0.092
|
||||
self.assertAlmostEqual(self.conditioning(near), 0.1212, delta=0.001)
|
||||
with self.assertRaisesRegex(core.KitError, r"conditioning 0\.0919, under 0\.093\)$"):
|
||||
self.solve(self.D0 - 34.0, near)
|
||||
|
||||
def test_a_loop_that_is_not_planar_is_refused(self):
|
||||
"""loop-refusals. Mutant F8 (the parallel check dropped). A pin a degree off the closure's, a slide a degree out
|
||||
of the plane, a closing socket facing the wrong way, and a loop that closes in the plane and misses along the pin."""
|
||||
tilted = self.pin(self.rocker_pin["matrix"][:3, 3], z=(math.sin(math.radians(1.0)), math.cos(math.radians(1.0)), 0.0))
|
||||
with self.assertRaisesRegex(core.KitError, r"^the loop is not planar: the revolute joint on socket 'ground' turns about a pin that is not parallel to the pin it closes on \(off by 0\.0174"):
|
||||
core.close_loop(np.eye(4), [(tilted, self.rocker["end_a"], "revolute"), self.four_bar[1]], self.coupler["end_b"], self.crank_pin(self.D0), self.REST)
|
||||
lean = np.eye(4)
|
||||
lean[:3, :3] = core._rotation((1.0, 0.0, 0.0))
|
||||
bore = {**self.barrel["bore"], "matrix": self.barrel["bore"]["matrix"] @ lean}
|
||||
with self.assertRaisesRegex(core.KitError, r"the prismatic joint on socket 'bore' slides along a line that is not across the pin it closes on"):
|
||||
core.close_loop(np.eye(4), [self.ram_loop[0], (bore, self.rod["piston"], "prismatic")], self.rod["rod_end"], self.crank_pin(self.D0, "end_b_back"), self.RAM_REST)
|
||||
with self.assertRaisesRegex(core.KitError, r"closing socket 'end_b_back' does not face the pin it closes on"):
|
||||
core.close_loop(np.eye(4), self.four_bar, self.coupler["end_b_back"], self.crank_pin(self.D0), self.REST)
|
||||
missed = self.crank_pin(self.D0)
|
||||
missed[:3, 3] += 0.001 * missed[:3, 2]
|
||||
with self.assertRaisesRegex(core.KitError, r"^the loop closes in its plane and closing socket 'end_b' misses along the pin by 0\.001 m$"):
|
||||
core.close_loop(np.eye(4), self.four_bar, self.coupler["end_b"], missed, self.REST)
|
||||
self.assertEqual(self.solve(self.D0, self.REST), (self.REST, 0)) # at rest it holds: no step is taken
|
||||
|
||||
def test_a_loop_that_does_not_converge_is_refused(self):
|
||||
"""loop-refusals. A pin 3.9 m out of the reach of a 0.9 and a 0.7 strut, where Newton from rest neither
|
||||
straightens the pair nor bends it the other way in FOLLOW_ITERATIONS steps: refused by its own name, with
|
||||
how far off it stands."""
|
||||
target = self.crank_pin(self.D0)
|
||||
target[:3, 3] += (-1.2, 0.0, 3.8)
|
||||
with self.assertRaisesRegex(core.KitError, r"^the loop did not close in 16 steps \(closing socket 'end_b' stands 3\.94584 m off in the plane\)$"):
|
||||
core.close_loop(np.eye(4), self.four_bar, self.coupler["end_b"], target, self.REST)
|
||||
|
||||
def test_stepping_keeps_the_assembly_branch(self):
|
||||
"""branch-kept. One solve across a 40 degree jump lands on the stepped answer; one solve from near the toggle
|
||||
(-32) across 49 degrees does not: Newton's first step throws the pair through the dead centre, where it is
|
||||
refused instead of landing on the other branch, and the same jump stepped by 5 arrives. Mutant F2 is the
|
||||
add-on's (pose solving once from the stated value): tests/live/kitbash_follows.py kills it."""
|
||||
stepped, _ = self.stepped(np.arange(0.0, 41.0, 5.0))
|
||||
jumped, iterations = self.solve(self.D0 + 40.0, self.REST)
|
||||
self.assertLess(max(abs(a - b) for a, b in zip(stepped, jumped)), self.BRANCH)
|
||||
self.assertEqual(iterations, 4)
|
||||
toggle, _ = self.stepped(np.arange(0.0, -33.0, -1.0))
|
||||
with self.assertRaisesRegex(core.KitError, "dead centre"):
|
||||
self.solve(self.D0 + 17.0, toggle)
|
||||
seed = toggle
|
||||
for delta in (-27.0, -22.0, -17.0, -12.0, -7.0, -2.0, 3.0, 8.0, 13.0, 17.0):
|
||||
seed, _ = self.solve(self.D0 + delta, seed)
|
||||
direct, _ = self.stepped([17.0])
|
||||
self.assertLess(max(abs(a - b) for a, b in zip(seed, direct)), self.BRANCH)
|
||||
|
||||
|
||||
@unittest.skipIf(np is None, "numpy is not installed")
|
||||
class StructureTests(unittest.TestCase):
|
||||
|
|
@ -1998,9 +2384,9 @@ class SheetTests(unittest.TestCase):
|
|||
|
||||
ROWS = ["brokkr_kitbash.place_part", "brokkr_kitbash.set_params", "brokkr_kitbash.describe", "brokkr_kitbash.report",
|
||||
"brokkr_kitbash.attach", "brokkr_kitbash.detach", "brokkr_kitbash.roll", "brokkr_kitbash.aim", "brokkr_kitbash.reach",
|
||||
"brokkr_kitbash.joint", "brokkr_kitbash.slide", "brokkr_kitbash.joints", "brokkr_kitbash.close",
|
||||
"brokkr_kitbash.joint", "brokkr_kitbash.slide", "brokkr_kitbash.joints", "brokkr_kitbash.follow", "brokkr_kitbash.close",
|
||||
"brokkr_kitbash.boolean", "brokkr_kitbash.cut", "brokkr_kitbash.cut_many", "brokkr_kitbash.freeze", "brokkr_kitbash.thaw", "brokkr_kitbash.ribs",
|
||||
"brokkr_kitbash.shell", "brokkr_kitbash.hose"]
|
||||
"brokkr_kitbash.shell", "brokkr_kitbash.hose", "brokkr_kitbash.plates"]
|
||||
|
||||
|
||||
class CageTests(unittest.TestCase):
|
||||
|
|
@ -2208,7 +2594,14 @@ class HostFileTests(unittest.TestCase):
|
|||
self.assertEqual([(row["name"], field["name"], field["default"]) for row in self.document["actions"] for field in row["fields"] if field["type"] == "boolean"],
|
||||
[("brokkr_kitbash.shell", "count_folds", False)]) # the one evaluation shell makes is asked for, never the default
|
||||
self.assertEqual([(row["name"], field["name"]) for row in self.document["actions"] for field in row["fields"] if field["type"] == "integer"],
|
||||
[("brokkr_kitbash.shell", "levels"), ("brokkr_kitbash.hose", "count")])
|
||||
[("brokkr_kitbash.shell", "levels"), ("brokkr_kitbash.hose", "count"), ("brokkr_kitbash.plates", "side")])
|
||||
plates = {**envelope, "action": "brokkr_kitbash.plates", "table": '{"schema": "brokkr.plates.v0", "plates": []}'}
|
||||
self.assertEqual([at.validate(plates, host)[k] for k in ("host", "frame", "side", "prefix")], ["", "", 1, ""])
|
||||
self.assertEqual(at.validate({**plates, "side": -1, "prefix": "Shin.", "table": "{" + " " * 31999, "frame": "[" + " " * 999}, host)["side"], -1)
|
||||
for bad in ({**plates, "side": 2}, {**plates, "side": -2}, {**plates, "side": 0.5}, {**plates, "table": "{" + " " * 32000}, {**plates, "table": ""}, {**plates, "frame": "[" + " " * 1000},
|
||||
{**plates, "prefix": "a b"}, {**plates, "prefix": "p" * 33}, {**plates, "host": "h" * 64}, {k: v for k, v in plates.items() if k != "table"}, {**plates, "object_name": "P"}):
|
||||
with self.assertRaises(at.IntentInvalid, msg=str(bad)[:200]):
|
||||
at.validate(bad, host)
|
||||
sheet = json.dumps({"rings": [[[0, 0, 0], [1, 0, 0]], [[0, 0, 1], [1, 0, 1]]]})
|
||||
shell = {**envelope, "action": "brokkr_kitbash.shell", "object_name": "Plate", "sheet": sheet}
|
||||
self.assertEqual([at.validate(shell, host)[k] for k in ("thickness", "offset", "levels", "bevel", "count_folds")], [0.05, -1, 3, 0, False])
|
||||
|
|
@ -2267,7 +2660,7 @@ class OwnershipTests(unittest.TestCase):
|
|||
return {p.name: p.read_text(encoding="utf-8") for p in sorted((SURFACE / "brokkr_kitbash").rglob("*")) if p.suffix in (".py", ".json")}
|
||||
|
||||
def test_no_pattern_matches(self):
|
||||
self.assertEqual(sorted(self.sources()), ["__init__.py", "brokkr_actions.json", "core.py", "cutters.v0.json", "frame.v0.json", "mechanical.v0.json", "ram.py", "route.py"])
|
||||
self.assertEqual(sorted(self.sources()), ["__init__.py", "brokkr_actions.json", "core.py", "cutters.v0.json", "fittings.v0.json", "frame.v0.json", "mechanical.v0.json", "plate.py", "ram.py", "route.py"])
|
||||
for pattern in self.PACKAGE:
|
||||
for name, text in self.sources().items():
|
||||
if pattern is self.PACKAGE[2] and name == "__init__.py":
|
||||
|
|
@ -2279,11 +2672,74 @@ class OwnershipTests(unittest.TestCase):
|
|||
self.assertIn('modifier.solver = "MANIFOLD"', source.split("class BROKKR_KITBASH_OT_ribs(")[1].split("class BROKKR_KITBASH_OT_")[0])
|
||||
self.assertIn('"COLLECTION", "EXACT", True', source.split("def operation_collection(")[1].split("\n\n\n")[0])
|
||||
self.assertIsNone(re.search(self.CORE, self.sources()["core.py"], re.M))
|
||||
# plate.py is core's kind: no Blender, no experiment module, and no random source but a seeded one
|
||||
self.assertIsNone(re.search(self.CORE, self.sources()["plate.py"], re.M))
|
||||
self.assertIsNone(re.search(r"Random\(\)|^\s*(import|from)\s+(massing|mechlib|surface|mathutils)", self.sources()["plate.py"], re.M))
|
||||
schemas = [p for p in (SURFACE.parents[1] / "schemas").rglob("*") if p.is_file()]
|
||||
self.assertTrue(schemas)
|
||||
for path in schemas:
|
||||
self.assertIsNone(re.search(self.SCHEMAS, path.read_text(encoding="utf-8", errors="replace")), path.name)
|
||||
|
||||
def test_a_follower_has_one_writer_and_one_place_it_is_derived(self):
|
||||
"""The negative patterns of cut kit-follows-2: kit_follows and its driver pointer are written only inside
|
||||
write_connections; set_params seats through it, its checks before the mesh is rebuilt; no linkage record is
|
||||
stored and no Blender driver or constraint is made; close_loop is called from driven alone."""
|
||||
source = self.sources()["__init__.py"]
|
||||
writer = source.split("\ndef write_connections(")[1].split("\n\n\n")[0]
|
||||
writes = r"\[FOLLOWS(?:_DRIVER)?\] ="
|
||||
self.assertEqual(re.findall(writes, source), re.findall(writes, writer))
|
||||
self.assertEqual(len(re.findall(writes, writer)), 2)
|
||||
for name, text in self.sources().items():
|
||||
self.assertIsNone(re.search("kit_" "drive" r"\b", text), name)
|
||||
self.assertIsNone(re.search(r"seat\(seated|driver_add\(|constraints\.new\(", source))
|
||||
self.assertEqual(source.count("seat("), 6) # its def, write_connections, and a cutter's, a ribs' and a hose's own frames, and a plate's own frame
|
||||
body = source.split("class BROKKR_KITBASH_OT_set_params(")[1].split("class BROKKR_KITBASH_OT_")[0]
|
||||
self.assertLess(body.index("write_checks(entries)"), body.index("clear_geometry()")) # the writer's own checks, the one-driver rule with them (live: 'set_params of the part a two-driver loop closes on')
|
||||
self.assertLess(body.index("write_checks(entries)"), body.index("obj[PARAMS] ="))
|
||||
self.assertLess(body.index("clear_geometry()"), body.index("write_connections(entries)"))
|
||||
self.assertEqual(source.count("core.close_loop("), 1)
|
||||
self.assertIn("core.close_loop(", source.split("\ndef driven(")[1].split("\n\n\n")[0])
|
||||
self.assertEqual(source.count("write_connections(["), 2) # write_connection, and follow clearing a statement
|
||||
# every entry is checked before one is written (mutant J5, a refusal raised after the writes; F5 is its live twin): the writer's loop runs over the
|
||||
# checks' whole answer and raises nothing itself, and the checks write nothing
|
||||
self.assertIn(" for child, parent, sockets, socket, parent_socket, roll, slide, kind, record in write_checks(entries):\n child.parent = parent\n", writer)
|
||||
asked = source.split("\ndef write_checks(")[1].split("\n\n\n")[0]
|
||||
self.assertIn(" checked = connection_checks(entries)\n one_driver({child: (parent, kind, record) for child, parent, _, _, _, _, _, kind, record in checked})\n return checked", asked)
|
||||
self.assertNotIn("raise ", writer)
|
||||
# the one-driver rule has one owner, asked by write_checks (the one writer, and set_params before its mesh), by detach and by
|
||||
# brokkr_parent_refusal (Brokkr's setObjectParent) before any writes, and it writes nothing: no action states its own copy (live: an attach, a
|
||||
# clear, widened limits, a pose, a set_params, a detach and a new parent after the loop is stated are each refused)
|
||||
rule = source.split("\ndef one_driver(")[1].split("\n\n\n")[0]
|
||||
self.assertEqual((source.count("one_driver("), source.count("depend on more than one driver")), (4, 1))
|
||||
# which joints are a loop's drivers is read in one place, loop_drivers: the rule refuses by it and the reads tell by it (finding
|
||||
# two-driver-loop-reported-nowhere), so a second driver no write made is in a follower's follows row and the joints report's manyDrivers
|
||||
# (live: 'a loop given a second driver by hand reads follows.holds false' and 'the joints report lists a loop with a second driver')
|
||||
self.assertEqual((source.count("loop_drivers("), source.count("it follows nothing and its joint has travel"), rule.count("loop_drivers(closing, parent, joint)")), (4, 1, 1))
|
||||
teller = source.split("\ndef follows_report(")[1].split("\n\n\n")[0]
|
||||
self.assertLess(teller.index("loop_drivers(pair[1])"), teller.index("elif others:"))
|
||||
self.assertLess(teller.index("elif others:"), teller.index('elif not found["holds"]:')) # a second driver is told before an open closure: 'pose the driver' is not its remedy
|
||||
joints = source.split("class BROKKR_KITBASH_OT_joints(")[1].split("class BROKKR_KITBASH_OT_")[0]
|
||||
self.assertIn('report["manyDrivers"].append({"loop": closing.name, "drivers": [driver.name, *(o.name for o in others)]})', joints)
|
||||
self.assertIsNone(re.search(r"\.parent\s*=(?!=)|\bseat\(|\w+\[[A-Z_]+\]\s*=(?!=)|\bdel ", source.split("\ndef loop_drivers(")[1].split("\n\n\n")[0]))
|
||||
asker = source.split("\ndef brokkr_parent_refusal(")[1].split("\n\n\n")[0]
|
||||
self.assertIn("one_driver({obj: (parent, kind,", asker)
|
||||
self.assertIsNone(re.search(r"\.parent\s*=(?!=)|\bseat\(|\w+\[\w+\]\s*=(?!=)|\bdel ", asker + asked))
|
||||
self.assertIsNone(re.search(r"\.parent\s*=(?!=)|\bseat\(|\w+\[[A-Z_]+\]\s*=(?!=)|\bdel ", rule))
|
||||
detach = source.split("class BROKKR_KITBASH_OT_detach(")[1].split("class BROKKR_KITBASH_OT_")[0]
|
||||
self.assertLess(detach.index("one_driver("), detach.index("obj.parent = None"))
|
||||
self.assertLess(detach.index("one_driver("), detach.index("del obj[key]"))
|
||||
checks = source.split("\ndef connection_checks(")[1].split("\n\n\n")[0]
|
||||
self.assertIsNone(re.search(r"\.parent\s*=(?!=)|\bseat\(|\w+\[\w+\]\s*=(?!=)|\bdel ", checks))
|
||||
self.assertEqual(checks.count("raise Refused("), 1)
|
||||
# a hose keeps no roll range of its own (mutant J9, a default range for a pin that states no limits; live it dies in kitbash_hose.py, 'a pin with no limits'): it reads the record's limits and refuses without them
|
||||
hose = source.split("class BROKKR_KITBASH_OT_hose(")[1].split("\n\n\n")[0]
|
||||
self.assertEqual(re.findall(r"[^\n]*\blimits\s*=(?!=)[^\n]*", hose), [' limits = joint_record(child)["limits"] # the roll range the hose is proven over is the pin\'s own: its connection\'s limits'])
|
||||
self.assertIn(' if limits is None:\n raise Refused(f"{child.name!r} on {child.parent.name!r}: the pin the hose crosses states no limits', hose)
|
||||
pose = source.split("\ndef pose(")[1].split("\n\n\n")[0]
|
||||
self.assertLess(pose.index("if follows is not None and not keeps:"), pose.index("= solve(child"))
|
||||
self.assertEqual(source.count("keeps=True"), 1)
|
||||
self.assertIn("keeps=True", source.split("class BROKKR_KITBASH_OT_joint(")[1].split("class BROKKR_KITBASH_OT_")[0])
|
||||
|
||||
def test_only_cut_boolean_and_ribs_evaluate_a_modifier_stack(self):
|
||||
"""An Exact Boolean costs from tenths of a second to seconds: report, attach, detach and set_params read stored
|
||||
state only, and cut evaluates its target with the Booleans off."""
|
||||
|
|
@ -2308,9 +2764,9 @@ class OwnershipTests(unittest.TestCase):
|
|||
self.assertNotIn(call, bodies["thaw"])
|
||||
for body, first_write in ((place, "bpy.data.meshes.new("), (bodies["boolean"], ".objects.link("), (bodies["freeze"], "bpy.data.meshes.new_from_object("),
|
||||
(bodies["ribs"], "show_viewport = False"), (bodies["shell"], "clear_geometry()"), (bodies["set_params"], "write_mesh("),
|
||||
(bodies["hose"], "write_mesh(")):
|
||||
(bodies["hose"], "write_mesh("), (bodies["plates"], "clear_geometry()")):
|
||||
self.assertLess(body.index("live("), body.index(first_write))
|
||||
self.assertEqual(source.count("live("), 8) # its def and the seven callers above
|
||||
self.assertEqual(source.count("live("), 10) # its def, the seven callers above and plates' two: a plate and a fit child
|
||||
# the frozen state has one writer: every write of kit_frozen, kit_kept and a fake user is in hold, which swaps the meshes too
|
||||
hold = source.split("\ndef hold(")[1].split("\n\n\n")[0]
|
||||
writes = r"\[(?:FROZEN|KEPT)\](?:, obj\.data)? =(?!=)|del \w+\[(?:FROZEN|KEPT)\]|use_fake_user = "
|
||||
|
|
@ -2419,23 +2875,26 @@ class OwnershipTests(unittest.TestCase):
|
|||
its own, and no DOF kind is read from a socket type's name."""
|
||||
source = self.sources()["__init__.py"]
|
||||
writes = re.findall(r'[^\n]*(?:\[ROLL\]|\["kit_roll"\])\s*=(?!=)[^\n]*', source)
|
||||
self.assertEqual(writes, [" child[SOCKET], child[PARENT_SOCKET], child[ROLL] = socket, parent_socket, roll"])
|
||||
writer = source.split("def write_connection(")[1].split("\n\n\n")[0]
|
||||
self.assertEqual(writes, [" child[SOCKET], child[PARENT_SOCKET], child[ROLL] = socket, parent_socket, roll"])
|
||||
writer = source.split("def write_connections(")[1].split("\n\n\n")[0]
|
||||
self.assertIn(writes[0], writer)
|
||||
record = r"SLIDE|LIMIT_MIN|LIMIT_MAX|MECHANISM|COMPLIANCE|RECORD"
|
||||
written = rf'\[(?:{record})\](?:, \w+\[\w+\])*\s*=(?!=)|\["kit_(?:slide|min|max|mechanism|compliance)"\]'
|
||||
self.assertIsNone(re.search(written, source))
|
||||
self.assertEqual(re.findall(r"[^\n]*\[key\] = [^\n]*", source), [" child[key] = value"])
|
||||
self.assertIn(" child[key] = value", writer)
|
||||
self.assertEqual(re.findall(r"[^\n]*\[key\] = [^\n]*", source), [" child[key] = value"])
|
||||
self.assertIn(" child[key] = value", writer)
|
||||
named = [body.split("(")[0] for body in re.split(r"\n(?:def|class) ", source)[1:] if re.search(rf"\b(?:{record})\b", body)]
|
||||
self.assertEqual(named, ["link", "joint_record", "mated", "write_connection", "BROKKR_KITBASH_OT_detach"])
|
||||
self.assertEqual(named, ["link", "joint_record", "mated", "write_connections", "BROKKR_KITBASH_OT_detach"])
|
||||
for text in ("child[SLIDE] = slide", "obj[LIMIT_MIN], obj[LIMIT_MAX] = limits", 'obj["kit_compliance"] = text'):
|
||||
self.assertIsNotNone(re.search(written, text))
|
||||
self.assertNotIn('"range"', source)
|
||||
self.assertNotIn('"pivot"', source)
|
||||
bodies = {body.split("(")[0]: body.split("\n\n\n")[0] for body in source.split("class BROKKR_KITBASH_OT_")[1:]}
|
||||
callers = [name for name, body in bodies.items() if "write_connection(" in body]
|
||||
self.assertEqual((callers, source.count("write_connection("), source.split("def pose(")[1].split("\n\n\n")[0].count("write_connection(")), (["attach"], 3, 1))
|
||||
self.assertEqual((callers, source.count("write_connection(")), (["attach"], 2)) # its def, which is write_connections for one, and attach
|
||||
callers = [name for name, body in bodies.items() if "write_connections(" in body]
|
||||
self.assertEqual((callers, source.count("write_connections("), source.split("def pose(")[1].split("\n\n\n")[0].count("write_connections(entries)")),
|
||||
(["set_params", "follow"], 6, 1)) # its def, write_connection, set_params, pose, and follow stating and clearing
|
||||
for name in ("roll", "aim", "reach", "slide", "joint"):
|
||||
self.assertEqual((bodies[name].count("pose(context, self.object_name, "), bool(re.search(r"\.parent\s*=(?!=)|\bseat\(|matrix_basis", bodies[name]))), (1, False), name)
|
||||
self.assertIsNone(re.search(r"\.parent\s*=(?!=)|\bseat\(|matrix_basis", bodies["attach"]))
|
||||
|
|
@ -2456,13 +2915,15 @@ class OwnershipTests(unittest.TestCase):
|
|||
self.assertEqual(assigned, [" obj[CLOSE], obj[CLOSE_TO], obj[CLOSE_TO_SOCKET] = self.socket, other, self.other_socket"])
|
||||
self.assertIn(assigned[0], bodies["close"])
|
||||
deleted = re.findall(r"[^\n]*\(SOCKET, PARENT_SOCKET, ROLL, \*RECORD, CLOSE, CLOSE_TO, CLOSE_TO_SOCKET\)[^\n]*\n[^\n]*\n\s*del obj\[key\]", source)
|
||||
self.assertEqual((len(deleted), source.count("del obj["), "del obj[key]" in bodies["detach"]), (1, 2, True)) # detach's keys, and hold's kit_frozen
|
||||
self.assertEqual((len(deleted), source.count("del obj["), "del obj[key]" in bodies["detach"]), (1, 2, True)) # detach's keys, and hold's kit_frozen; mutant J10 (detach's keys without kit_min) dies on the first, and live in kitbash_pose.py, 'detach leaves none of the eight connection keys'
|
||||
record = re.search(r"^RECORD = \((.*)\)$", source, re.M).group(1).split(", ")
|
||||
self.assertEqual(record, ["SLIDE", "LIMIT_MIN", "LIMIT_MAX", "MECHANISM", "COMPLIANCE", "FOLLOWS", "FOLLOWS_DRIVER"]) # the whole joint record: what detach clears
|
||||
self.assertEqual(source.count("CLOSE_TO]"), 1) # the one subscript write above; every read goes through .get
|
||||
placing = r"matrix_basis|matrix_world\s*=(?!=)|matrix_parent_inverse|\.parent\s*=(?!=)|\bseat\(|\.location|\.rotation"
|
||||
self.assertIsNone(re.search(placing, bodies["close"]))
|
||||
for text in ("child.matrix_basis = basis", "obj.matrix_world = world", "obj.parent = other", "seat(obj, basis)"):
|
||||
self.assertIsNotNone(re.search(placing, text))
|
||||
self.assertIsNotNone(re.search(placing, source.split("def write_connection(")[1].split("\n\n\n")[0]))
|
||||
self.assertIsNotNone(re.search(placing, source.split("def write_connections(")[1].split("\n\n\n")[0]))
|
||||
|
||||
def test_the_patterns_bite(self):
|
||||
planted = ("value = eval(text)", "from brokkr_bridge import x", 'modifier.solver = "MANIFOLD"', "cutter.hide_render = True", 'obj["kit_parent"] = parent.name',
|
||||
|
|
|
|||
1286
surfaces/blender/tests/test_plate.py
Normal file
1286
surfaces/blender/tests/test_plate.py
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -9,6 +9,7 @@ import importlib.util
|
|||
import json
|
||||
import math
|
||||
import sys
|
||||
import types
|
||||
import unittest
|
||||
from dataclasses import replace
|
||||
from pathlib import Path
|
||||
|
|
@ -83,6 +84,40 @@ def yz(p, x=0.0):
|
|||
return (x, float(p[0]), float(p[1]))
|
||||
|
||||
|
||||
def block(lo, hi):
|
||||
"""A box as a mesh: 8 vertices and 12 triangles wound counterclockwise seen from outside."""
|
||||
lo, hi = np.asarray(lo, float), np.asarray(hi, float)
|
||||
verts = np.array([[x, y, z] for x in (lo[0], hi[0]) for y in (lo[1], hi[1]) for z in (lo[2], hi[2])])
|
||||
quads = ((0, 1, 3, 2), (4, 6, 7, 5), (0, 4, 5, 1), (2, 3, 7, 6), (0, 2, 6, 4), (1, 5, 7, 3))
|
||||
return verts, np.array([t for a, b, c, d in quads for t in ((a, b, c), (a, c, d))])
|
||||
|
||||
|
||||
def joined(first, second, weld):
|
||||
"""Two meshes as one; with `weld`, vertices of the second that stand on one of the first take its index."""
|
||||
(v1, t1), (v2, t2) = first, second
|
||||
verts, index = [tuple(p) for p in v1], []
|
||||
for p in map(tuple, v2):
|
||||
if weld and p in verts:
|
||||
index.append(verts.index(p))
|
||||
else:
|
||||
index.append(len(verts))
|
||||
verts.append(p)
|
||||
return np.array(verts), np.concatenate([t1, np.array(index)[t2]])
|
||||
|
||||
|
||||
def staircase():
|
||||
"""A prism of three steps along y from 0 to 1: under z = 1 for x in 0..1, z = 2 for 1..2, z = 3 for 2..3."""
|
||||
profile = ((0, 0), (3, 0), (3, 3), (2, 3), (2, 2), (1, 2), (1, 1), (0, 1)) # (x, z)
|
||||
verts = np.array([(x, y, z) for y in (0.0, 1.0) for x, z in profile], float)
|
||||
tris = []
|
||||
for k in range(8):
|
||||
n = (k + 1) % 8
|
||||
tris += [(k, n + 8, n), (k, k + 8, n + 8)]
|
||||
for a, b, c in ((0, 1, 6), (0, 6, 7), (1, 4, 5), (1, 5, 6), (1, 2, 3), (1, 3, 4)): # the cap at y = 0, and at y = 1 turned over
|
||||
tris += [(a, b, c), (a + 8, c + 8, b + 8)]
|
||||
return verts, np.array(tris)
|
||||
|
||||
|
||||
def grid(lo, hi, counts):
|
||||
lo, hi = np.asarray(lo, float), np.asarray(hi, float)
|
||||
axes = [np.linspace(lo[k], hi[k], n) if n > 1 else np.array([(lo[k] + hi[k]) / 2]) for k, n in enumerate(counts)]
|
||||
|
|
@ -499,6 +534,21 @@ SWING_BOUND = 0.81
|
|||
TOGGLE_ARM = 0.0386
|
||||
|
||||
|
||||
# The clearance gate's zones on the R-3 bell crank. A reading a hand value states is bounded by its deviation from it;
|
||||
# a shipped deviation of 0 counts as half an ulp of the value (lodur:ruling:deterministic-bound-zero-reading).
|
||||
ZONED = 2.2e-10 # a rocker sample against its own plates: shipped 0 (half an ulp of link_r, 1.7e-18), W1..W3 (a zone's edge strict, the first zone only, the last zone overriding) 0.0294 and 0.0914 off, separation 1.3e8 each side
|
||||
BESIDE = 1.2e-10 # a wall 0.02 beside the coupler, read at the nearest sample: shipped 0 (half an ulp of 0.0242, 1.7e-18), B1 (the proof by the nearer end's reading less the span, which halves and reads beside the wall) 0.00423 off, separation 4.9e7 each side
|
||||
FLOOR_UNDER = 0.319 # how near the axis a wall held outside reads as touched, in spacing / 64: shipped under 0.451, FINE 128 under 0.2255, separation 1.41 each side
|
||||
FLOOR_OVER = 0.638 # shipped under 0.451, FINE 32 under 0.902, separation 1.41 each side
|
||||
WHOLE = 3.8e-4 # a winding number against the count or share a hand value states: shipped 6.3e-6 at most (the plates; the angles are single precision), W1 (the denominator's a.b term without the third length) 0.0224 off on the open cube's axis, separation 60 each side
|
||||
SPAN_RAM = 0.848 # the ram's span with its base 0.1 from the rocker's pivot: shipped 0.5390 (about that pivot), the span about the knee's pivot 1.3347, separation 1.57 each side
|
||||
|
||||
|
||||
SMALL = (0.009, 0.015) # the sides of a turned-over bar welded along a unit cube's edge whose regions hold 6.75e-5 and 1.93e-4 of the extent cubed: THIN, 1.1e-4, is 1.63 and 1.75 from them
|
||||
MECH_SAMPLE = (17, 4, 3, 89, 12) # the mech sample's rows: inside out, crossing, open, pass; and the mirrored among them
|
||||
KIT_VARIANTS = 386 # kit parts built over the corners of their params
|
||||
|
||||
|
||||
@unittest.skipIf(np is None, "numpy is not installed")
|
||||
class DeepKnee(unittest.TestCase):
|
||||
"""The R-3 knee over 0..-125 (probes P1 to P3)."""
|
||||
|
|
@ -562,8 +612,9 @@ class DeepKnee(unittest.TestCase):
|
|||
|
||||
def test_a_part_in_the_rams_way_on_each_link(self):
|
||||
# a lug on the rocker, then on the coupler, on the rod's axis 0.12 from the eye at -60: refused naming the part
|
||||
# and its body. A zone about the eye lets the rod and the barrel by it only if it reaches the lug and is as
|
||||
# deep as the lug; a zone of another member's changes nothing
|
||||
# and its body. A zone about the eye lets the rod and the barrel by the rocker's only if it reaches the lug and
|
||||
# is as deep as the lug; a zone of another member's changes nothing. The coupler's lug is let by no zone of
|
||||
# the ram's: the eye's pin does not join the coupler
|
||||
m, ram = r3("bell_crank", CRANK), R.Ram(BORE)
|
||||
at = R.pose(m, -60.0)
|
||||
on_rod = (at.eye - 0.12 * at.u)[:, None, :]
|
||||
|
|
@ -574,13 +625,20 @@ class DeepKnee(unittest.TestCase):
|
|||
|
||||
def zones(radius, depth, members=("rod", "barrel")):
|
||||
return {**touch, **{member: touch[member] + [("lug", "d" if member != "coupler" else "p", radius, depth)] for member in members}}
|
||||
for label, given in (("nothing let", touch), ("the coupler's zone", zones(0.4, 0.02, ("coupler",))), ("a zone short of the lug", zones(0.1, 0.02)),
|
||||
("a zone too shallow", zones(0.4, 0.01))):
|
||||
if body == "coupler": # d joins the rocker alone: no zone of the ram's names a part of the coupler
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
dressed(m, bodies, zones(0.4, 0.02))
|
||||
self.assertEqual((caught.exception.gate, caught.exception.pin), ("record", "barrel lug pin"))
|
||||
self.assertIn("a body the pin joins (rocker); 'lug' turns with coupler", str(caught.exception))
|
||||
for label, given in (("nothing let", touch), ("the coupler's zone", zones(0.4, 0.02, ("coupler",))),
|
||||
*((("a zone short of the lug", zones(0.1, 0.02)), ("a zone too shallow", zones(0.4, 0.01))) if body == "rocker" else ())):
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
R.fit(dressed(m, bodies, given), ram, steps=49, distance=bodies)
|
||||
self.assertEqual((caught.exception.gate, caught.exception.fit.clear_at[2]), ("clash", "lug"), (body, label))
|
||||
self.assertIn(caught.exception.fit.clear_at[1], ("rod[0]", "barrel[0]"))
|
||||
self.assertIn(f"part 'lug' ({body})", str(caught.exception))
|
||||
if body == "coupler":
|
||||
continue
|
||||
f = R.fit(dressed(m, bodies, zones(0.4, 0.02)), ram, steps=49, distance=bodies)
|
||||
self.assertIn(("rod[0]", "lug"), f.allowed)
|
||||
self.assertNotIn(("rocker arm", "lug"), f.allowed)
|
||||
|
|
@ -645,16 +703,26 @@ class DeepKnee(unittest.TestCase):
|
|||
self.assertAlmostEqual(R._span(m, "rocker arm"), 0.24, places=9)
|
||||
self.assertGreaterEqual(R._span(m, "rod"), float(R.pose(m, np.linspace(-125.0, 0.0, 126)).L.max()))
|
||||
self.assertEqual([ram.eye(*of) for of in (("barrel", "a"), ("rod", "a"), ("rod", "d"), ("coupler", "c"))], [ram.e_a, ram.e_a, ram.e_b, ram.link_r])
|
||||
for member, pin in (("barrel", "a"), ("rod", "d"), ("rocker", "p"), ("coupler", "c"), ("rocker arm", "rocker")):
|
||||
# a linkage's ram spans from the rocker's pivot, which its eye turns about, not the knee's: a base seated 0.1
|
||||
# from the rocker's pivot makes a ram of 0.539 at the most, and a zone between that and the 1.335 the knee's
|
||||
# pivot would give is refused
|
||||
seated = replace(m, a=m.rocker + (0.0, 0.0, 0.1), parts=bodies.parts)
|
||||
self.assertAlmostEqual(R._span(seated, "rod"), 0.1 + math.hypot(X_ROCKER, 0.24), places=12)
|
||||
for member in ("barrel", "rod"):
|
||||
replace(seated, touch={member: [("thigh", "a", 0.53, 0.0)]})
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
replace(seated, touch={member: [("thigh", "a", SPAN_RAM, 0.0)]})
|
||||
self.assertEqual((caught.exception.gate, caught.exception.pin), ("record", f"{member} thigh radius"))
|
||||
for member, pin, part in (("barrel", "a", "thigh"), ("rod", "d", "pin d"), ("rocker", "p", "coupler plates"), ("coupler", "c", "horn"), ("rocker arm", "rocker", "bracket")):
|
||||
span, eye = R._span(m, member), ram.eye(member, pin)
|
||||
|
||||
def zoned(radius, depth):
|
||||
return dressed(m, bodies, {member: [("thigh", pin, radius, depth)]})
|
||||
return dressed(m, bodies, {member: [(part, pin, radius, depth)]})
|
||||
zoned(span, 0.0)
|
||||
for radius, depth, field in ((1.2 * span, 0.0, "radius"), (1e308, 0.0, "radius"), (1e9, 1e9, "radius"), (0.1, 1.2 * span, "depth"), (0.1, 1e308, "depth")):
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
zoned(radius, depth)
|
||||
self.assertEqual((caught.exception.gate, caught.exception.pin), ("record", f"{member} thigh {field}"))
|
||||
self.assertEqual((caught.exception.gate, caught.exception.pin), ("record", f"{member} {part} {field}"))
|
||||
self.assertIn(f"{member} is at most {span:.4f} from pin to pin", str(caught.exception))
|
||||
R.clearance(zoned(0.1, eye), ram, [-60.0], bodies)
|
||||
wrote = R.record(zoned(0.1, eye), ram)
|
||||
|
|
@ -664,19 +732,66 @@ class DeepKnee(unittest.TestCase):
|
|||
lambda: R.from_record(wrote)):
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
read()
|
||||
self.assertEqual((caught.exception.gate, caught.exception.pin), ("record", f"{member} thigh depth"))
|
||||
self.assertEqual((caught.exception.gate, caught.exception.pin), ("record", f"{member} {part} depth"))
|
||||
self.assertIn(f"{member}'s on {pin} is {eye:.4f}", str(caught.exception))
|
||||
|
||||
def test_a_zone_names_a_part_of_a_body_its_pin_joins(self):
|
||||
# Soul's whole-member zones: two of 0.51 of its length about p and c covered the coupler and let its axis
|
||||
# 0.0294 into a capsule of the thigh. No bound on a radius stops that; the record says which bodies a pin
|
||||
# joins, and a part of any other is zoned about it by no member, whatever the radius and depth
|
||||
joins = {"a": ("parent",), "b": ("child",), "rocker": ("parent", "rocker"), "p": ("rocker", "coupler"), "c": ("coupler", "child"), "d": ("rocker",)}
|
||||
for m in (R.Mechanism("direct", O, X, -62, 0, a=(0.05, -0.3, 0.8), b=(0.05, -0.3, -0.6)), r3("four_bar", DEEP), r3("bell_crank", CRANK)):
|
||||
parts = {"of " + body: body for body in R.BODIES[m.kind]}
|
||||
for member in R.MEMBERS[m.kind]:
|
||||
for pin in R.RIDES[m.kind][member]:
|
||||
for part, body in parts.items():
|
||||
zone = {member: [(part, pin, 0.01, 0.0)]}
|
||||
if body in joins[pin]:
|
||||
self.assertEqual(replace(m, parts=parts, touch=zone).touch[member], ((part, pin, 0.01, 0.0),))
|
||||
continue
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
replace(m, parts=parts, touch=zone)
|
||||
self.assertEqual((caught.exception.gate, caught.exception.pin), ("record", f"{member} {part} pin"), (m.kind, member, pin, body))
|
||||
self.assertIn(f"{member} may touch about {pin} a part of a body the pin joins ({', '.join(joins[pin])}); "
|
||||
f"'{part}' turns with {body}", str(caught.exception))
|
||||
# Soul's capsule of the parent under the coupler, zoned as the probe zoned it: refused by the record, by
|
||||
# from_record and as a world's answer; the shipped zones, each a part of a body its pin joins, are read
|
||||
m, ram = r3("bell_crank", CRANK), R.Ram(BORE)
|
||||
bodies, touch = r3_bodies(m, ram)
|
||||
wire = json.loads(json.dumps(R.record(dressed(m, bodies, touch), ram)))
|
||||
self.assertEqual(R.from_record(wire)[0].touch, dressed(m, bodies, touch).touch)
|
||||
bodies.parts["under"], bodies.shapes["under"] = "parent", [("capsule", (X_COUPLER, 0.5, 0.2), (X_COUPLER, 0.6, 0.3), 0.08)]
|
||||
halves = [("under", "p", 0.51 * m.lc, ram.link_r), ("under", "c", 0.51 * m.lc, ram.link_r)]
|
||||
wire["parts"]["under"] = "parent"
|
||||
for k, zone in enumerate(halves):
|
||||
given = {**touch, "coupler": touch["coupler"] + halves[k:]}
|
||||
wrote = {**wire, "touch": {**wire["touch"], "coupler": wire["touch"]["coupler"] + [dict(zip(R.ZONE, zone))]}}
|
||||
hinge, seat = {"pivot": O, "axis": X, "lo": -125, "hi": 0}, {name: [getattr(m, name)] for name in ("a", "rocker", "c")}
|
||||
for read in (lambda: dressed(m, bodies, given), lambda: R.from_record(wrote),
|
||||
lambda: R.search("bell_crank", hinge, ram, {**seat, "link": (m.lr, m.lr, 1), "d": (0.24, 0.24, 1)}, world=lambda made: (bodies.parts, given, bodies))):
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
read()
|
||||
self.assertEqual((caught.exception.gate, caught.exception.pin), ("record", "coupler under pin"))
|
||||
self.assertIn(f"about {zone[1]} a part of a body the pin joins", str(caught.exception))
|
||||
# the body is refused before the zone is measured: a zone both foreign and wider than its member names the pin
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
dressed(m, bodies, {"coupler": [("under", "p", 1e9, 0.0)]})
|
||||
self.assertEqual(caught.exception.pin, "coupler under pin")
|
||||
|
||||
def test_a_wall_the_axis_crosses_in_a_zone_is_read_whatever_its_thickness(self):
|
||||
# Soul's tunnel: a wall of the thigh across the coupler, midway between two of its samples, inside a zone
|
||||
# about p of depth 0. Every sample stands outside it; the segment between them is what crosses
|
||||
# Soul's tunnel: a wall of the rocker across the coupler, midway between two of its samples, inside a zone
|
||||
# about p of depth 0. Every sample stands outside it; the segment between them is what crosses. The wall is
|
||||
# the rocker's, which p joins, and stands in the rocker's frame, where the coupler's samples at -60 are `samples`
|
||||
m, ram = r3("bell_crank", CRANK), R.Ram(BORE)
|
||||
at = R.pose(m, -60.0)
|
||||
start = at.P[0] - np.array(X) * ((at.P[0] - at.C[0]) @ np.array(X))
|
||||
count = int(math.ceil(m.lc / ram.spacing())) + 1
|
||||
samples = start + (at.C[0] - start) * np.linspace(0.0, 1.0, count)[:, None]
|
||||
|
||||
def seen(n, body="rocker"):
|
||||
return R._into(m, at, body, (start + (at.C[0] - start) * np.linspace(0.0, 1.0, n)[:, None])[None])[0]
|
||||
samples = seen(count)
|
||||
spot = 0.5 * (samples[2] + samples[3])
|
||||
along = (at.C[0] - start) / m.lc
|
||||
along = (samples[-1] - samples[0]) / m.lc
|
||||
k = 1 if abs(along[1]) > abs(along[2]) else 2
|
||||
|
||||
def reading(half, shift=0.0):
|
||||
|
|
@ -684,26 +799,41 @@ class DeepKnee(unittest.TestCase):
|
|||
lo[k], hi[k] = spot[k] - half, spot[k] + half
|
||||
lo[0], hi[0] = X_COUPLER - 0.05 + shift, X_COUPLER + 0.05 + shift
|
||||
bodies = r3_parts(m, ram)
|
||||
bodies.parts["wall"], bodies.shapes["wall"] = "parent", [("box", lo, hi)]
|
||||
self.assertGreater(float(bodies("wall", samples).min()), 0.0)
|
||||
bodies.parts["wall"], bodies.shapes["wall"] = "rocker", [("box", lo, hi)]
|
||||
reading.sampled = float(bodies("wall", samples).min())
|
||||
self.assertGreater(reading.sampled, 0.0)
|
||||
return R.clearance(dressed(m, bodies, {"coupler": [("wall", "p", 0.28, 0.0)]}), ram, [-60.0], bodies).pairs[("coupler", "wall")][0]
|
||||
for half in (0.01, 0.003, 1e-4, 1e-7, 1e-10):
|
||||
self.assertLess(reading(half), 0.0, half)
|
||||
# the same walls beside the axis, 0.02 off along the hinge axis: held outside, and let
|
||||
# the same walls beside the axis, 0.02 off along the hinge axis: held outside, and let. The samples either
|
||||
# side prove the segment, so the reading is the nearer sample's (0.0242: 0.02 across, 0.0137 along), not the
|
||||
# 0.02 a point between them would read
|
||||
for half in (0.01, 1e-7):
|
||||
self.assertGreaterEqual(reading(half, 0.07), 0.02)
|
||||
# nearer the axis than the floor of the halving, a part the axis is held outside reads as touched
|
||||
self.assertLess(reading(0.01, 0.05 + 0.2 * ram.spacing() / R.FINE), 0.0)
|
||||
self.assertGreaterEqual(reading(0.01, 0.05 + 1.2 * ram.spacing() / R.FINE), 0.0)
|
||||
self.assertLess(abs(reading(half, 0.07) - reading.sampled), BESIDE, half)
|
||||
self.assertGreater(reading.sampled, 0.024)
|
||||
# nearer the axis than the floor of the halving, a part the axis is held outside reads as touched. The floor is
|
||||
# the spacing over 64, written here as the number: the doc's, and what the gate's cost was measured at
|
||||
self.assertEqual(R.FINE, 64)
|
||||
self.assertLess(reading(0.01, 0.05 + FLOOR_UNDER * ram.spacing() / 64), 0.0)
|
||||
self.assertGreaterEqual(reading(0.01, 0.05 + FLOOR_OVER * ram.spacing() / 64), 0.0)
|
||||
# a segment with one end in the zone is proved as well. Sampled 0.3 apart, the sample beyond the zone keeps its
|
||||
# 0.186 from a bead on the axis 0.008 past the last sample in the zone; the bead is read all the same
|
||||
wide = start + (at.C[0] - start) * np.linspace(0.0, 1.0, 3)[:, None]
|
||||
wide = seen(3)
|
||||
bodies, spot = r3_parts(m, ram), wide[1] + 0.012 * along
|
||||
bodies.parts["bead"], bodies.shapes["bead"] = "parent", [("capsule", spot, spot, 0.004)]
|
||||
bodies.parts["bead"], bodies.shapes["bead"] = "rocker", [("capsule", spot, spot, 0.004)]
|
||||
self.assertGreater(float(bodies("bead", wide[:2]).min()), 0.0)
|
||||
self.assertGreaterEqual(float(bodies("bead", wide[2:])[0]), near(ram, "coupler", 0.3))
|
||||
got = R.clearance(dressed(m, bodies, {"coupler": [("bead", "p", 0.25, 0.0)]}), ram, [-60.0], bodies, spacing=0.3)
|
||||
self.assertLess(got.pairs[("coupler", "bead")][0], 0.0)
|
||||
# and so is the segment whose far end alone is in the zone: a bead of the shin 0.008 short of the first sample
|
||||
# in a zone about c, the sample before it out of the zone and keeping its 0.186
|
||||
wide = seen(3, "child")
|
||||
bodies, spot = r3_parts(m, ram), wide[1] - 0.012 * (wide[2] - wide[0]) / m.lc
|
||||
bodies.parts["bead"], bodies.shapes["bead"] = "child", [("capsule", spot, spot, 0.004)]
|
||||
self.assertGreater(float(bodies("bead", wide[1:]).min()), 0.0)
|
||||
self.assertGreaterEqual(float(bodies("bead", wide[:1])[0]), near(ram, "coupler", 0.3))
|
||||
got = R.clearance(dressed(m, bodies, {"coupler": [("bead", "c", 0.25, 0.0)]}), ram, [-60.0], bodies, spacing=0.3)
|
||||
self.assertLess(got.pairs[("coupler", "bead")][0], 0.0)
|
||||
|
||||
def test_two_zones_of_one_pair_and_a_sample_at_a_zones_radius(self):
|
||||
# Soul's W1..W3. A pair zoned twice: a sample both reach is let the deeper, in either order, and each zone
|
||||
|
|
@ -718,8 +848,11 @@ class DeepKnee(unittest.TestCase):
|
|||
self.assertAlmostEqual(reading(deep, beside, far), 0.0, places=12)
|
||||
self.assertAlmostEqual(reading(beside, deep, far), 0.0, places=12)
|
||||
self.assertAlmostEqual(reading(far, beside, deep), 0.0, places=12)
|
||||
for short in ((beside, beside, far), (deep, beside), (far, deep[:2] + (0.3 * m.lr, ram.link_r))):
|
||||
self.assertLess(reading(*short), -0.9 * ram.link_r, short)
|
||||
# short of that the sample reads what it is: link_r inside its own plate where the zone holds it outside, and
|
||||
# where no zone reaches it link_r inside and all it keeps short
|
||||
own = ram.link_r + near(ram, "rocker")
|
||||
for short, reads in (((beside, beside, far), -ram.link_r), ((deep, beside), -own), ((far, deep[:2] + (0.3 * m.lr, ram.link_r)), -own)):
|
||||
self.assertLess(abs(reading(*short) - reads), ZONED, short)
|
||||
at = R.pose(m, [-60.0])
|
||||
end = at.P - np.array(X) * ((at.P - m.rocker) @ np.array(X))[:, None]
|
||||
count = int(math.ceil(m.lr / ram.spacing())) + 1
|
||||
|
|
@ -727,7 +860,7 @@ class DeepKnee(unittest.TestCase):
|
|||
across = np.linalg.norm(R._flat(pts - m.rocker, np.array(X)), axis=2)[0]
|
||||
edge, beyond = float(across[3]), m.lr - 0.5 * float(across[3] + across[4])
|
||||
self.assertAlmostEqual(reading(("rocker plates", "rocker", edge, ram.link_r), ("rocker plates", "p", beyond, ram.link_r), degrees=[-60.0]), 0.0, places=12)
|
||||
self.assertLess(reading(("rocker plates", "rocker", float(np.nextafter(edge, 0.0)), ram.link_r), ("rocker plates", "p", beyond, ram.link_r), degrees=[-60.0]), -0.9 * ram.link_r)
|
||||
self.assertLess(abs(reading(("rocker plates", "rocker", float(np.nextafter(edge, 0.0)), ram.link_r), ("rocker plates", "p", beyond, ram.link_r), degrees=[-60.0]) + own), ZONED)
|
||||
|
||||
def test_a_pin_stood_inside_what_it_stands_beside_is_refused(self):
|
||||
# Soul's moved-x probes: the rocker's x moved from its plate's place (0.3675) into the bracket's 0.13..0.35,
|
||||
|
|
@ -843,8 +976,13 @@ class OracleRule(unittest.TestCase):
|
|||
lugged = two(a=seats.shapes["a"] and ("parent", seats.shapes["a"]), b=("child", seats.shapes["b"]), **{"b.lug": ("child", seats.shapes["b"])})
|
||||
got = R.clearance(dressed(m, lugged, zones), ram, 0.0, lugged)
|
||||
self.assertEqual({pair: round(reading[0], 9) for pair, reading in got.pairs.items() if reading[0] < 0.0}, {("rod[0]", "b.lug"): round(-0.03 - near(ram, "rod"), 9)})
|
||||
for crossed in ({"barrel": [("b", "b", 0.2, 0.03)], "rod": [("a", "a", 0.2, 0.03)]}, {"barrel": [("a", "b", 0.2, 0.03)], "rod": [("b", "a", 0.2, 0.03)]}):
|
||||
self.assertLess(float(R.clearance(dressed(m, seats, crossed), ram, 0.0, seats).margin[0]), 0.0)
|
||||
crossed = {"barrel": [("b", "b", 0.2, 0.03)], "rod": [("a", "a", 0.2, 0.03)]}
|
||||
self.assertLess(float(R.clearance(dressed(m, seats, crossed), ram, 0.0, seats).margin[0]), 0.0)
|
||||
# and a part zoned about the pin at the member's other end, which does not join its body, is no zone at all
|
||||
for crossed, pin in (({"barrel": [("a", "b", 0.2, 0.03)]}, "barrel a pin"), ({"rod": [("b", "a", 0.2, 0.03)]}, "rod b pin")):
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
dressed(m, seats, crossed)
|
||||
self.assertEqual((caught.exception.gate, caught.exception.pin), ("record", pin))
|
||||
|
||||
def test_every_body_owns_a_part(self):
|
||||
ball = Bodies({"ball": ("parent", [("capsule", (0, 0, 0), (0, 0, 0), 0.1)])})
|
||||
|
|
@ -942,19 +1080,20 @@ class SearchBestFirst(unittest.TestCase):
|
|||
((ball.parts, {}, None), "search", "world(m) returns"), ((ball.parts, {"rod": ["parent"]}, ball), "record", "zone is (part, pin, radius, depth)"),
|
||||
((ball.parts, {"rod": [("parent", "c", 1.0, 0.0)]}, ball), "record", "a pin it rides (a, b)"),
|
||||
((ball.parts, {"rod": [("thigh", "b", 1.0, 0.0)]}, ball), "record", "no part of the record"),
|
||||
((ball.parts, {"rod": [("parent", "b", 1e308, 0.0)]}, ball), "record", "rod is at most"),
|
||||
((ball.parts, {"rod": [("parent", "b", 0.5, 1e308)]}, ball), "record", "rod is at most"),
|
||||
((ball.parts, {"rod": [("parent", "b", 1e9, 1e9)]}, ball), "record", "rod is at most"),
|
||||
((ball.parts, {"rod": [("parent", "b", float("inf"), 0.0)]}, ball), "record", "a finite number"),
|
||||
((ball.parts, {"rod": [("parent", "b", 0.5, float("nan"))]}, ball), "record", "a finite number"),
|
||||
((ball.parts, {"rod": [("parent", "b", 0.5, 1.2 * ram.e_b)]}, ball), "record", "rod's on b is 0.0850"),
|
||||
((ball.parts, {"rod": [("child", "b", 1e308, 0.0)]}, ball), "record", "rod is at most"),
|
||||
((ball.parts, {"rod": [("parent", "b", 0.5, 0.0)]}, ball), "record", "a body the pin joins (child); 'parent' turns with parent"),
|
||||
((ball.parts, {"rod": [("child", "b", 0.5, 1e308)]}, ball), "record", "rod is at most"),
|
||||
((ball.parts, {"rod": [("child", "b", 1e9, 1e9)]}, ball), "record", "rod is at most"),
|
||||
((ball.parts, {"rod": [("child", "b", float("inf"), 0.0)]}, ball), "record", "a finite number"),
|
||||
((ball.parts, {"rod": [("child", "b", 0.5, float("nan"))]}, ball), "record", "a finite number"),
|
||||
((ball.parts, {"rod": [("child", "b", 0.5, 1.2 * ram.e_b)]}, ball), "record", "rod's on b is 0.0850"),
|
||||
(({"ball": "rocker"}, {}, ball), "record", "turns with 'rocker'"), (({"ball": "parent"}, {}, ball), "record", "no part turns with body child")):
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
R.search("direct", self.HINGE, ram, seats, world=lambda m: made)
|
||||
self.assertEqual(caught.exception.gate, gate, said)
|
||||
self.assertIn(said, str(caught.exception))
|
||||
self.assertTrue(R.search("direct", self.HINGE, ram, seats, world=lambda m: (ball.parts, {}, ball)).found)
|
||||
self.assertTrue(R.search("direct", self.HINGE, ram, seats, world=lambda m: (ball.parts, {"rod": [("parent", "b", 0.5, ram.e_b)]}, ball)).found)
|
||||
self.assertTrue(R.search("direct", self.HINGE, ram, seats, world=lambda m: (ball.parts, {"rod": [("child", "b", 0.5, ram.e_b)]}, ball)).found)
|
||||
|
||||
def test_the_limit_is_refused_naming_the_count(self):
|
||||
seats = {"a": grid((0, -0.5, 0.4), (0, -0.2, 1.2), (1, 3, 5)), "b": grid((0, -0.5, -1.2), (0, -0.2, -0.4), (1, 3, 5))}
|
||||
|
|
@ -1021,8 +1160,8 @@ class RecordDrives(unittest.TestCase):
|
|||
data = R.record(m, ram)
|
||||
wire = json.loads(json.dumps(data))
|
||||
self.assertEqual(wire, data)
|
||||
self.assertEqual(sorted(data), ["compliance", "hinge", "kind", "offsets", "parts", "pins", "ram", "schema", "touch", "version"])
|
||||
self.assertEqual((data["schema"], data["version"], data["compliance"]), ("brokkr.ram", 1, None))
|
||||
self.assertEqual(sorted(data), ["hinge", "kind", "offsets", "parts", "pins", "ram", "schema", "touch", "version"])
|
||||
self.assertEqual((data["schema"], data["version"]), ("brokkr.ram", 2))
|
||||
again, ram2 = R.from_record(wire)
|
||||
self.assertEqual(R.record(again, ram2), data)
|
||||
self.assertEqual((again.parts, again.touch), (m.parts, m.touch))
|
||||
|
|
@ -1053,18 +1192,18 @@ class RecordDrives(unittest.TestCase):
|
|||
def test_a_record_this_version_cannot_read_is_refused_whole(self):
|
||||
data = R.record(R.Mechanism("direct", O, X, -62, 0, a=(0.05, -0.3, 0.8), b=(0.05, -0.3, -0.6)), R.Ram(BORE))
|
||||
settle = {"stiffness": 2.0e6, "damping": 4.0e3, "travel": 0.02}
|
||||
self.assertEqual(tuple(settle), R.COMPLIANCE)
|
||||
ram = dict(data["ram"], stiffness=2.0e6)
|
||||
short = {k: v for k, v in data.items() if k != "touch"}
|
||||
for change, said in (({"version": 2}, "version 2"), ({"version": 2, "compliance": settle}, "version 2"), ({"compliance": settle}, "compliance block"),
|
||||
for change, said in (({"version": 1}, "reads brokkr.ram version 2; the record is brokkr.ram version 1"), ({"version": 3}, "version 3"), ({"version": 1, "settle": settle}, "version 1"),
|
||||
({"schema": "brokkr.kit"}, "brokkr.kit"), ({"settle": settle}, "unknown ['settle']"), ({"ram": ram}, "unknown ['stiffness']"),
|
||||
({"hinge": dict(data["hinge"], rate=1.0)}, "unknown ['rate']"),
|
||||
# a block that is falsy is a block (S23); the version is the integer 1
|
||||
({"compliance": {}}, "compliance block"), ({"compliance": 0}, "compliance block"), ({"compliance": False}, "compliance block"),
|
||||
({"version": 1.0}, "version 1.0"), ({"version": True}, "version True"), ({"version": "1"}, "version '1'"),
|
||||
# a key the record does not know is refused whatever it holds, null and falsy included (S23): a ram
|
||||
# record carries no settle. The version is the integer 2
|
||||
({"settle": None}, "unknown ['settle']"), ({"settle": {}}, "unknown ['settle']"), ({"settle": False}, "unknown ['settle']"),
|
||||
({"version": 2.0}, "version 2.0"), ({"version": True}, "version True"), ({"version": "2"}, "version '2'"),
|
||||
({"kind": "scissor"}, "kind is one of"),
|
||||
# a pin this kind has not, or a key that is no pin, is refused by name; so is one missing
|
||||
({"pins": dict(data["pins"], q=[0.0, 0.0, 0.0])}, "the pins's keys are not version 1's: unknown ['q']"),
|
||||
({"pins": dict(data["pins"], q=[0.0, 0.0, 0.0])}, "the pins's keys are not version 2's: unknown ['q']"),
|
||||
({"pins": dict(data["pins"], parts={})}, "unknown ['parts']"), ({"pins": {"a": data["pins"]["a"]}}, "missing ['b']"),
|
||||
({"pins": [1, 2]}, "(pin pins): an object, got list"), ({"ram": None}, "(pin ram): an object, got NoneType"),
|
||||
# every number is a finite number, the bore over 0; three of them make a point
|
||||
|
|
@ -1082,7 +1221,8 @@ class RecordDrives(unittest.TestCase):
|
|||
({"parts": {"knee": "parent"}, "touch": {"rod": "knee"}}, "rod's zones are a list"),
|
||||
({"parts": {"knee": "parent"}, "touch": {"rod": [{"part": "knee", "pin": "b", "radius": 0.1}]}}, "missing ['depth']"),
|
||||
({"parts": {"knee": "parent"}, "touch": {"rod": [{"part": "knee", "pin": "b", "radius": 0.1, "depth": 0.0, "whole": True}]}}, "unknown ['whole']"),
|
||||
({"parts": {"knee": "parent"}, "touch": {"rod": [{"part": "knee", "pin": "b", "radius": None, "depth": 0.0}]}}, "(pin rod knee radius)")):
|
||||
({"parts": {"knee": "parent"}, "touch": {"rod": [{"part": "knee", "pin": "b", "radius": None, "depth": 0.0}]}}, "(pin rod knee radius)"),
|
||||
({"parts": {"knee": "parent"}, "touch": {"rod": [{"part": "knee", "pin": "b", "radius": 0.1, "depth": 0.0}]}}, "(pin rod knee pin): rod may touch about b a part of a body the pin joins (child)")):
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
R.from_record({**data, **change})
|
||||
self.assertEqual(caught.exception.gate, "record", change)
|
||||
|
|
@ -1090,7 +1230,7 @@ class RecordDrives(unittest.TestCase):
|
|||
with self.assertRaises(R.RamError) as caught:
|
||||
R.from_record([data])
|
||||
self.assertIn("a record is an object, got list", str(caught.exception))
|
||||
zoned = R.from_record({**data, "parts": {"knee": "parent"}, "touch": {"rod": [{"part": "knee", "pin": "b", "radius": 0.1, "depth": 0}]}})[0]
|
||||
zoned = R.from_record({**data, "parts": {"knee": "child"}, "touch": {"rod": [{"part": "knee", "pin": "b", "radius": 0.1, "depth": 0}]}})[0]
|
||||
self.assertEqual(zoned.touch, {"rod": (("knee", "b", 0.1, 0.0),)})
|
||||
# a ram refuses the same numbers when built by hand
|
||||
for bad in ({"bore": -0.05}, {"bore": 0.0}, {"bore": None}, {"bore": True}, {"bore": 0.05, "gap": float("nan")}, {"bore": 0.05, "tail": float("inf")}, {"bore": 0.05, "rod": "0.02"}):
|
||||
|
|
@ -1144,6 +1284,8 @@ class Refusals(unittest.TestCase):
|
|||
self.refused("record", "rod knee radius", **knee, touch={"rod": [("knee", "d", "0.1", 0.0)]})
|
||||
self.refused("record", "rod knee depth", **knee, touch={"rod": [("knee", "d", 0.1, -0.01)]})
|
||||
self.refused("record", "rod knee depth", **knee, touch={"rod": [("knee", "d", 0.1, float("nan"))]})
|
||||
self.assertIn("a body the pin joins (rocker); 'knee' turns with parent", str(self.refused("record", "rod knee pin", **knee, touch={"rod": [("knee", "d", 0.1, 0.0)]})))
|
||||
self.assertEqual(R.Mechanism("four_bar", O, X, -125, 0, **{name: yz(DEEP[name]) for name in DEEP}, **knee, touch={"rod": [("knee", "a", 0.1, 0.0)]}).touch["rod"], (("knee", "a", 0.1, 0.0),))
|
||||
self.refused("record", "a", a=(0, 1))
|
||||
self.refused("record", "c", c=(0, float("nan"), 1))
|
||||
self.refused("record", "b", b=(0, 0, -1)) # a four-bar has no b
|
||||
|
|
@ -1167,6 +1309,239 @@ class Refusals(unittest.TestCase):
|
|||
self.assertEqual((caught.exception.gate, caught.exception.pin), ("arm", "b"))
|
||||
self.assertIn(f"arm at {caught.exception.angle:g} deg (pin b)", str(caught.exception))
|
||||
|
||||
def test_overlapping_solids_wind_by_their_count(self):
|
||||
# two boxes that cut through one another in one mesh, each with its own vertices, then sharing the one index
|
||||
# at the corner they have in common (all a merge by distance welds): the winding number is the count of
|
||||
# boxes about the point, 2 in the overlap, where crossing parity read outside
|
||||
big, small = block((0, 0, 0), (1, 1, 1)), block((0, 0, 0), (2, 0.5, 0.5))
|
||||
pts = np.random.default_rng(1).uniform(-0.2, 2.2, (6000, 3))
|
||||
count = sum(((pts >= lo) & (pts <= hi)).all(axis=1).astype(int) for lo, hi in (((0, 0, 0), (1, 1, 1)), ((0, 0, 0), (2, 0.5, 0.5))))
|
||||
self.assertGreater(int((count == 2).sum()), 50)
|
||||
for weld in (False, True):
|
||||
verts, tris = joined(big, small, weld)
|
||||
self.assertEqual(len(verts), 15 if weld else 16)
|
||||
self.assertLess(float(np.abs(R.winding(verts, tris, pts) - count).max()), WHOLE, weld)
|
||||
|
||||
def test_the_plates_overlapping_bars_wind_by_their_count(self):
|
||||
# the jointlib rocker plates: four closed bars in one mesh, a side's two overlapping. Every inside point of
|
||||
# the fixture winds 1, or 2 where two bars overlap
|
||||
fixture = json.loads((SURFACE / "tests" / "fixtures" / "ram_plates.json").read_text(encoding="utf-8"))
|
||||
w = R.winding(fixture["verts"], fixture["faces"], fixture["inside"])
|
||||
self.assertLess(float(np.abs(w - np.round(w)).max()), WHOLE)
|
||||
self.assertEqual((int((np.round(w) == 1).sum()), int((np.round(w) == 2).sum())), (16, 13))
|
||||
|
||||
def test_a_staircase_winds_whole(self):
|
||||
# a nonconvex prism of three steps, which a line crosses up to six times: 1 inside, 0 outside
|
||||
verts, tris = staircase()
|
||||
g = np.arange(-0.375, 3.5, 0.25)
|
||||
pts = np.array([(x, y, z) for x in g for y in (-0.25, 0.125, 0.5, 0.875, 1.25) for z in g])
|
||||
truth = (pts[:, 1] > 0) & (pts[:, 1] < 1) & (pts[:, 0] > 0) & (pts[:, 0] < 3) & (pts[:, 2] > 0) & (pts[:, 2] < np.ceil(pts[:, 0]))
|
||||
self.assertGreater(min(int(truth.sum()), int((~truth).sum())), 200)
|
||||
self.assertLess(float(np.abs(R.winding(verts, tris, pts) - truth).max()), WHOLE)
|
||||
|
||||
def test_an_open_cube_winds_by_what_its_hole_takes(self):
|
||||
# a unit cube less its top face: about a point on the hole's axis the winding number is 1 less the hole's
|
||||
# share of the sphere inside, and that share outside, 4 asin(a^2 / (a^2 + h^2)) of 4 pi for a square of half
|
||||
# side a seen from h off its centre. So it is over 0.5 everywhere inside and under 0.5 over the hole, and
|
||||
# passes through 0.5 on the hole's plane, where no face is. Less one triangle of the top it is the same
|
||||
verts, tris = block((0, 0, 0), (1, 1, 1))
|
||||
top = [k for k, t in enumerate(tris) if (verts[t][:, 2] == 1.0).all()]
|
||||
self.assertEqual(len(top), 2)
|
||||
z = np.array((0.5, 0.9, 0.999, 1.001, 1.1, 1.5))
|
||||
share = np.arcsin(0.25 / (0.25 + (1.0 - z) ** 2)) / math.pi
|
||||
w = R.winding(verts, np.delete(tris, top, axis=0), np.stack([np.full(6, 0.5), np.full(6, 0.5), z], axis=1))
|
||||
self.assertLess(float(np.abs(w - np.where(z < 1, 1.0 - share, share)).max()), WHOLE)
|
||||
self.assertTrue((w[:3] > 0.5).all() and (w[3:] < 0.5).all(), w.tolist()) # 0.001 under the plane 0.5009, 0.001 over it 0.4991
|
||||
# no point inside either open cube, down to 0.001 from its faces and its hole, winds under 0.5: a count
|
||||
inner = np.random.default_rng(3).uniform(0.001, 0.999, (4000, 3))
|
||||
for gone in (top, top[:1]):
|
||||
self.assertEqual(int((R.winding(verts, np.delete(tris, gone, axis=0), inner) < 0.5).sum()), 0)
|
||||
|
||||
def test_inside_is_half_a_winding_or_more(self):
|
||||
# the bound, on a mesh only a test may read: a unit cube less its top winds 0.527 on the hole's axis 0.03
|
||||
# under the hole's plane and 0.473 as far over it (1 less, and plainly, asin(0.25 / 0.2509) / pi). A bound
|
||||
# of 0.45 reads the point over the hole inside and one of 0.55 the point under it outside: 0.473 and 0.527
|
||||
# stand at the geometric means of 0.5 and those two, 1.06 from each, all the room there is between them
|
||||
verts, tris = block((0, 0, 0), (1, 1, 1))
|
||||
opened = np.delete(tris, [k for k, t in enumerate(tris) if (verts[t][:, 2] == 1.0).all()], axis=0)
|
||||
pts = np.array([(0.5, 0.5, 0.97), (0.5, 0.5, 1.03)])
|
||||
w = R.winding(verts, opened, pts)
|
||||
self.assertLess(float(np.abs(w - (0.5270, 0.4730)).max()), 1e-4)
|
||||
self.assertEqual(R.inside(verts, opened, pts).tolist(), [True, False])
|
||||
# about closed solids the number is whole, so there the bound reads as any over 0 and up to 1 would
|
||||
cloud = np.random.default_rng(5).uniform(-0.2, 1.2, (500, 3))
|
||||
self.assertEqual(R.inside(verts, tris, cloud).tolist(), ((cloud > 0) & (cloud < 1)).all(axis=1).tolist())
|
||||
|
||||
def test_solids_are_the_closed_pieces_of_a_part(self):
|
||||
# the jointlib rocker plates are four closed bars, each wound outward: none is refused. Two boxes that cut
|
||||
# through one another are two solids, sharing a corner's index or not
|
||||
fixture = json.loads((SURFACE / "tests" / "fixtures" / "ram_plates.json").read_text(encoding="utf-8"))
|
||||
self.assertEqual(np.bincount(R.solids("plates", fixture["verts"], fixture["faces"])).tolist(), [84, 84, 84, 84])
|
||||
for weld in (False, True):
|
||||
verts, tris = joined(block((0, 0, 0), (1, 1, 1)), block((0, 0, 0), (2, 0.5, 0.5)), weld)
|
||||
self.assertEqual(R.solids("boxes", verts, tris).tolist(), [0] * 12 + [1] * 12)
|
||||
self.assertEqual(R.solids("stairs", *staircase()).tolist(), [0] * 28)
|
||||
|
||||
def test_an_open_part_is_refused_by_its_edge_count(self):
|
||||
# a cube less a triangle has 3 edges no face runs back along, less its top 4, less two adjacent faces 6
|
||||
# (the edge between them is gone with both); one triangle turned over leaves its 3 edges run twice one way
|
||||
verts, tris = block((0, 0, 0), (1, 1, 1))
|
||||
top = [k for k, t in enumerate(tris) if (verts[t][:, 2] == 1.0).all()]
|
||||
side = [k for k, t in enumerate(tris) if (verts[t][:, 1] == 1.0).all()]
|
||||
turned_over = tris.copy()
|
||||
turned_over[0] = tris[0][::-1]
|
||||
less = lambda gone: (verts, np.delete(tris, gone, axis=0))
|
||||
for name, mesh, count, solid in (("a triangle off", less(top[:1]), 3, "solid 0 of 1"), ("the top off", less(top), 4, "solid 0 of 1"), ("two faces off", less(top + side), 6, "solid 0 of 1"),
|
||||
("a triangle turned over", (verts, turned_over), 3, "solid 0 of 1"), ("the second of two open", joined(block((2, 0, 0), (3, 1, 1)), less(top), False), 4, "solid 1 of 2")):
|
||||
with self.assertRaises(R.RamError, msg=name) as caught:
|
||||
R.solids("cube", *mesh)
|
||||
self.assertEqual(caught.exception.gate, "signed", name)
|
||||
self.assertIn(f"part 'cube' is open: {solid} has {count} edges no face runs the other way", str(caught.exception), name)
|
||||
|
||||
def test_a_seam_of_coincident_vertices_is_no_hole(self):
|
||||
# a cube whose every triangle has its own three vertices is closed to the eye and to the winding number, and
|
||||
# is one solid. Its top stood off by a third of WELD of the extent is a seam and closes; by 3.4 times WELD
|
||||
# it is a hole of 4 edges on the box and 4 on the lid
|
||||
verts, tris = block((0, 0, 0), (1, 1, 1))
|
||||
soup = verts[tris].reshape(-1, 3)
|
||||
self.assertEqual(R.solids("soup", soup, np.arange(36).reshape(-1, 3)).tolist(), [0] * 12)
|
||||
top = np.flatnonzero((verts[tris][:, :, 2] == 1.0).all(axis=1))
|
||||
for gap, closes in ((R.WELD / 3.0, True), (R.WELD * 3.4, False)):
|
||||
lifted = soup.copy()
|
||||
lifted[(3 * top[:, None] + np.arange(3)).ravel(), 2] += gap * math.sqrt(3.0)
|
||||
if closes:
|
||||
self.assertEqual(R.solids("lid", lifted, np.arange(36).reshape(-1, 3)).tolist(), [0] * 12)
|
||||
else:
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
R.solids("lid", lifted, np.arange(36).reshape(-1, 3))
|
||||
self.assertIn("part 'lid' is open: solid 0 of 2 has 4 edges no face runs the other way", str(caught.exception))
|
||||
# weld alone: the nearest are one, a chain is one, and nothing is joined at no tolerance
|
||||
row = np.array([(0, 0, 0), (0.5, 0, 0), (9, 0, 0), (9, 0.9, 0), (9, 1.8, 0), (20, 0, 0)], float) * 1e-3
|
||||
self.assertEqual(R.weld(row, 1e-3).tolist(), [0, 0, 2, 2, 2, 5])
|
||||
self.assertEqual(R.weld(row, 0.0).tolist(), [0, 1, 2, 3, 4, 5])
|
||||
|
||||
def test_weld_joins_within_the_tolerance_and_no_farther_wherever_it_stands(self):
|
||||
# a pair 0.99 of the tolerance apart is one vertex and a pair 1.01 apart is two, at 100 places beside a
|
||||
# vertex that stands still (so the pair falls anywhere in a cell), along each axis and along all three: the
|
||||
# tolerance is along every axis, and a pair 0.99 apart on all three (1.71 in all) is one
|
||||
tolerance, still = 1e-3, (-7.0, -7.0, -7.0)
|
||||
places = np.random.default_rng(11).uniform(-5.0, 5.0, (100, 3))
|
||||
for step in ((1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 1, 1), (-1, 1, -1)):
|
||||
for at in places:
|
||||
for share, reads in ((0.99, [0, 1, 1]), (1.01, [0, 1, 2])):
|
||||
self.assertEqual(R.weld([still, at, at + share * tolerance * np.array(step)], tolerance).tolist(), reads, (step, at.tolist(), share))
|
||||
# one axis past the tolerance parts a pair the other two hold together
|
||||
for at in places:
|
||||
self.assertEqual(R.weld([still, at, at + tolerance * np.array((0.99, 1.01, 0.99))], tolerance).tolist(), [0, 1, 2])
|
||||
|
||||
def test_an_inside_out_solid_is_refused_by_its_volume(self):
|
||||
# a cube with every face turned over, or mirrored with its winding kept, holds a negative volume (-1 of an
|
||||
# extent cubed of 3 sqrt 3) and winds -1 inside: every face stands before that region
|
||||
verts, tris = block((0, 0, 0), (1, 1, 1))
|
||||
for name, v, t in (("turned over", verts, tris[:, ::-1]), ("mirrored", verts * (-1, 1, 1), tris)):
|
||||
with self.assertRaises(R.RamError, msg=name) as caught:
|
||||
R.solids("cube", v, t)
|
||||
self.assertEqual(caught.exception.gate, "signed", name)
|
||||
self.assertIn("part 'cube' is wound inside out: solid 0 of 1 has a volume of -0.192 of the part's extent cubed, and 12 of its faces, from face 0, stand before a region that winds -1", str(caught.exception), name)
|
||||
# a bar turned over beside the cube is a solid of its own, of negative volume, and the same bar wound outward
|
||||
# passes
|
||||
bar = block((2, 0, 0), (3, 1, 0.5))
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
R.solids("pair", *joined((verts, tris), (bar[0], bar[1][:, ::-1]), False))
|
||||
self.assertIn("part 'pair' is wound inside out: solid 1 of 2 has a volume of -0.0137 of the part's extent cubed, and 12 of its faces, from face 12, stand before a region that winds -1", str(caught.exception))
|
||||
self.assertEqual(len(R.solids("pair", *joined((verts, tris), bar, False))), 24)
|
||||
|
||||
def test_the_least_turned_solid_is_refused(self):
|
||||
# the bound on a turned solid's volume is zero (verdict cut-kit-ram-lows.s4, thin-hides-small-inversions): a
|
||||
# cube of side 0.2 turned over beside a whole bar 6 by 0.3 by 0.3 holds 2.1e-5 of the extent cubed, a plate 1
|
||||
# by 1 by 1e-5 turned over holds 3.5e-6, and a cube of side 0.01 by the bar 2.9e-9: each is under THIN and
|
||||
# each is wound inside out. The same wound outward pass
|
||||
bar = block((0, 0, 0), (6, 0.3, 0.3))
|
||||
over = lambda mesh: (mesh[0], mesh[1][:, ::-1])
|
||||
for name, whole, turned, said, first in (("a cube by a bar", joined(bar, block((7, 0, 0), (7.2, 0.2, 0.2)), False), joined(bar, over(block((7, 0, 0), (7.2, 0.2, 0.2))), False), "solid 1 of 2 has a volume of -2.13e-05", 12),
|
||||
("a plate", block((0, 0, 0), (1, 1, 1e-5)), over(block((0, 0, 0), (1, 1, 1e-5))), "solid 0 of 1 has a volume of -3.54e-06", 0),
|
||||
("a speck by a bar", joined(bar, block((7, 0, 0), (7.01, 0.01, 0.01)), False), joined(bar, over(block((7, 0, 0), (7.01, 0.01, 0.01))), False), "solid 1 of 2 has a volume of -2.89e-09", 12)):
|
||||
self.assertEqual(len(R.solids("least", *whole)), len(whole[1]), name)
|
||||
with self.assertRaises(R.RamError, msg=name) as caught:
|
||||
R.solids("least", *turned)
|
||||
self.assertIn(f"part 'least' is wound inside out: {said} of the part's extent cubed, and 12 of its faces, from face {first}, stand before a region that winds -1", str(caught.exception), name)
|
||||
|
||||
def test_a_part_that_crosses_itself_is_refused_by_its_region_and_where(self):
|
||||
# a bar turned over and welded to the cube along an edge or on a face is one solid with it, of positive
|
||||
# volume (0.96 and 0.8): no solid is inside out, and the faces before the region that winds -1 are named as
|
||||
# the part crossing itself, with the region's centre and reach. On the face the cube's own face lies on the
|
||||
# bar's and stands before the bar with it: 14 faces, the cube's two first. The same bars wound outward pass
|
||||
verts, tris = block((0, 0, 0), (1, 1, 1))
|
||||
for name, bar, said, about in (("on an edge", block((1, 0, -0.2), (1.2, 1, 0)), "12 faces, from face 12 of solid 0 of 1", (1.1, 0.5, -0.1)), ("on a face", block((1, 0, 0), (1.2, 1, 1)), "14 faces, from face 2 of solid 0 of 1", None)):
|
||||
with self.assertRaises(R.RamError, msg=name) as caught:
|
||||
R.solids("pair", *joined((verts, tris), (bar[0], bar[1][:, ::-1]), True))
|
||||
self.assertEqual(caught.exception.gate, "signed", name)
|
||||
self.assertIn(f"part 'pair' crosses itself: {said}, stand before a region that winds -1 and holds ", str(caught.exception), name)
|
||||
self.assertIn("and no solid there has a negative volume", str(caught.exception), name)
|
||||
self.assertNotIn("inside out", str(caught.exception), name)
|
||||
centre = [float(x) for x in str(caught.exception).split("about (")[1].split(")")[0].split(", ")]
|
||||
reach = float(str(caught.exception).split("and within ")[1].split(" of it")[0])
|
||||
inside_bar = all(lo - 1e-9 <= x <= hi + 1e-9 for x, lo, hi in zip(centre, bar[0].min(axis=0), bar[0].max(axis=0)))
|
||||
self.assertTrue(inside_bar and 0.5 <= reach <= 0.55, (name, centre, reach)) # the bar is 1 long: its end faces' centres are 0.5 from the middle
|
||||
if about:
|
||||
self.assertLess(max(abs(a - b) for a, b in zip(centre, about)), 1e-3, name)
|
||||
self.assertEqual(len(R.solids("pair", *joined((verts, tris), bar, True))), 24, name)
|
||||
|
||||
def test_a_cavity_and_a_sliver_are_not_turned_over(self):
|
||||
# a cube of half side 1 with a cube of half side 0.5 turned over in it is a hollow mass: the winding number
|
||||
# is 0 in the cavity, 1 in the wall and 0 outside, before every face of the inner shell is the cavity, and
|
||||
# the part passes as two solids
|
||||
hollow = joined(block((-1, -1, -1), (1, 1, 1)), (lambda v, t: (v, t[:, ::-1]))(*block((-0.5, -0.5, -0.5), (0.5, 0.5, 0.5))), False)
|
||||
self.assertEqual(R.solids("hollow", *hollow).tolist(), [0] * 12 + [1] * 12)
|
||||
self.assertLess(float(np.abs(R.winding(*hollow, [(0, 0, 0), (0.75, 0, 0), (0, 0.75, 0.75), (1.5, 0, 0)]) - (0, 1, 1, 0)).max()), WHOLE)
|
||||
# the inner shell's volume is negative and none of its faces is turned. With a crossing the part is let (a bar
|
||||
# of side SMALL[0] turned over and welded along the outer cube's edge) it is a cavity still, and passes
|
||||
bar = block((1, -1, -1 - SMALL[0]), (1 + SMALL[0], 1, -1))
|
||||
self.assertEqual(R.solids("hollow", *joined(hollow, (bar[0], bar[1][:, ::-1]), True)).tolist(), [0] * 12 + [1] * 12 + [0] * 12)
|
||||
# a sliver is two sheets back to back, a closed solid of no volume: before either sheet is the outside, and
|
||||
# it passes alone, beside a cube and sharing a corner of one
|
||||
sheet = np.array([(0, 0, 0), (1, 0, 0), (0, 1, 0)], float), np.array([(0, 1, 2), (0, 2, 1)])
|
||||
self.assertEqual(R.solids("sliver", *sheet).tolist(), [0, 0])
|
||||
self.assertEqual(R.solids("beside", *joined(block((2, 0, 0), (3, 1, 1)), sheet, False)).tolist(), [0] * 12 + [1] * 2)
|
||||
self.assertEqual(R.solids("welded", *joined(block((-1, -1, -1), (0, 0, 0)), sheet, True)).tolist(), [0] * 12 + [1] * 2)
|
||||
|
||||
def test_a_crossing_is_read_by_what_its_region_holds(self):
|
||||
# THIN, by a bar of side s and length 1 turned over and welded along a unit cube's edge (one solid of positive
|
||||
# volume, extent about 1.74): its faces stand before a region measured by the rungs their normals reach. Side
|
||||
# 0.009 holds 6.75e-5 and passes; side 0.015 holds 1.93e-4 and is refused. So a bound of 6.75e-5 or of
|
||||
# 1.93e-4 is seen, as near THIN as the mech parts either side of it
|
||||
verts, tris = block((0, 0, 0), (1, 1, 1))
|
||||
small = lambda s: joined((verts, tris), (lambda v, t: (v, t[:, ::-1]))(*block((1, 0, -s), (1 + s, 1, 0))), True)
|
||||
self.assertEqual(len(R.solids("small", *small(SMALL[0]))), 24)
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
R.solids("small", *small(SMALL[1]))
|
||||
self.assertIn("part 'small' crosses itself: 12 faces, from face 12 of solid 0 of 1, stand before a region that winds -1 and holds ", str(caught.exception))
|
||||
held = float(str(caught.exception).split("holds ")[1].split(" of")[0])
|
||||
self.assertTrue(1.83e-4 < held < 2.03e-4, held)
|
||||
# the nudge, from below: a cube turned over and turned 0.3, 0.5 and 0.7 radians about x, y and z has no face
|
||||
# along an axis. Its sides are held at 1e-6 of the extent and to 1e-8; at 1e-9 they are not and it would pass
|
||||
(ca, sa), (cb, sb), (cc, sc) = ((math.cos(t), math.sin(t)) for t in (0.3, 0.5, 0.7))
|
||||
spin = np.array([[1, 0, 0], [0, ca, -sa], [0, sa, ca]]) @ np.array([[cb, 0, sb], [0, 1, 0], [-sb, 0, cb]]) @ np.array([[cc, -sc, 0], [sc, cc, 0], [0, 0, 1]])
|
||||
with self.assertRaises(R.RamError):
|
||||
R.solids("spun", (verts - 0.5) @ spin.T, tris[:, ::-1])
|
||||
|
||||
def test_a_mirrored_mesh_is_placed_turned_back(self):
|
||||
# a part mirrored by a negative scale is wound as its own mesh is: placed by its matrix the faces are turned
|
||||
# back and it passes; carried with its winding kept it is the mirrored cube above. A matrix that does not
|
||||
# mirror keeps every face, and the vertices are carried either way
|
||||
verts, tris = block((0, 0, 0), (1, 1, 1))
|
||||
faces = [tuple(int(i) for i in t) for t in tris]
|
||||
mirror, shift = np.diag((-1.0, 1.0, 1.0, 1.0)), np.eye(4)
|
||||
mirror[:3, 3] = shift[:3, 3] = (3.0, 0.0, 0.5)
|
||||
v, f = R.placed(verts, faces, mirror)
|
||||
self.assertEqual(np.abs(v - (verts * (-1, 1, 1) + (3.0, 0.0, 0.5))).max(), 0.0)
|
||||
self.assertEqual(f, [face[::-1] for face in faces])
|
||||
self.assertEqual(R.solids("left", v, f).tolist(), [0] * 12)
|
||||
with self.assertRaises(R.RamError):
|
||||
R.solids("left", v, faces)
|
||||
v, f = R.placed(verts, faces, shift)
|
||||
self.assertEqual((np.abs(v - (verts + (3.0, 0.0, 0.5))).max(), f), (0.0, faces))
|
||||
|
||||
def test_no_blender(self):
|
||||
source = (SURFACE / "brokkr_kitbash" / "ram.py").read_text(encoding="utf-8")
|
||||
for word in ("bpy", "np.gradient"):
|
||||
|
|
@ -1176,5 +1551,116 @@ class Refusals(unittest.TestCase):
|
|||
self.assertEqual(source.count("\nclass Signed:"), 1)
|
||||
|
||||
|
||||
class Tree:
|
||||
"""Blender's BVHTree as Signed makes it, keeping only the faces it was given."""
|
||||
made = []
|
||||
|
||||
@classmethod
|
||||
def FromPolygons(cls, verts, faces, epsilon=0.0):
|
||||
cls.made.append([tuple(face) for face in faces])
|
||||
return cls()
|
||||
|
||||
|
||||
@unittest.skipIf(np is None, "numpy is not installed")
|
||||
class Exposed(unittest.TestCase):
|
||||
"""What Signed hands its trees, under a stand-in mathutils that records the polygons: the faces of all, then the
|
||||
exposed ones (verdict cut-kit-ram-lows.s4, survivors-killable-by-stub). The distances are the live suite's."""
|
||||
|
||||
def setUp(self):
|
||||
mathutils, bvhtree = types.ModuleType("mathutils"), types.ModuleType("mathutils.bvhtree")
|
||||
mathutils.Vector, bvhtree.BVHTree, Tree.made = tuple, Tree, []
|
||||
self.kept = {name: sys.modules.get(name) for name in ("mathutils", "mathutils.bvhtree")}
|
||||
sys.modules.update({"mathutils": mathutils, "mathutils.bvhtree": bvhtree})
|
||||
|
||||
def tearDown(self):
|
||||
for name, module in self.kept.items():
|
||||
if module is None:
|
||||
sys.modules.pop(name, None)
|
||||
else:
|
||||
sys.modules[name] = module
|
||||
|
||||
# two triangles of no area on one line, wound both ways: closed, and with no side to be read on
|
||||
LINE = [(5.0, 0.0, 0.0), (6.0, 0.0, 0.0), (7.0, 0.0, 0.0)], [(0, 1, 2), (0, 2, 1)]
|
||||
|
||||
def test_a_part_with_no_exposed_face_is_refused(self):
|
||||
with self.assertRaises(R.RamError) as caught:
|
||||
R.Signed({"line": [self.LINE]})
|
||||
self.assertEqual((caught.exception.gate, str(caught.exception)), ("signed", "mesh ram: signed: part 'line' has no exposed face"))
|
||||
self.assertEqual(Tree.made, [])
|
||||
|
||||
def test_a_face_of_no_area_is_not_exposed(self):
|
||||
verts, tris = block((0, 0, 0), (1, 1, 1))
|
||||
cube = [tuple(int(i) for i in t) for t in tris]
|
||||
R.Signed({"p": [(verts, cube), self.LINE]})
|
||||
every, exposed = Tree.made
|
||||
self.assertEqual((len(every), exposed), (14, cube)) # the cube's twelve are its surface; the two of no area are not
|
||||
|
||||
|
||||
@unittest.skipIf(np is None, "numpy is not installed")
|
||||
class Corpus(unittest.TestCase):
|
||||
"""The refusals against meshes nobody made for them: every part the kits build, and a sample of the 1,832 mesh
|
||||
objects the mech experiments make (r3, mcr3, seraph, spectre, walker, chimera, paladin, kestrel, as Blender
|
||||
evaluates them, each in its own frame with its world matrix). Of the 1,832, solids refuses 42: 21 open (marks,
|
||||
recesses, plates with a hole), 17 wound inside out (lathe and ball bodies, each with a solid of negative volume,
|
||||
-1.4e-3 of the extent cubed at the least) and 4 that cross themselves, every solid of positive volume: walker's
|
||||
two guns, a box whose bore and cross slots were cut and never joined, and seraph's two Torso.LowerIn plates,
|
||||
folded at a corner by a bevel over a boolean. The sample is those 21, three open, the passing parts nearest
|
||||
each bound, three mirrored parts, and ten passing parts of each mech drawn by a seeded generator from those of
|
||||
400 faces or fewer: 89 pass, so a change that refuses one passing part in twenty fails here 99 times in 100.
|
||||
|
||||
WELD 3e-4 seams close up to 3.7e-5 of the extent (seraph Torso.SideBlockR; r3 Prow.Upper 2.3e-6, chimera
|
||||
Pauldron.Band 4.1e-7); the least hole closes at 2.2e-3 (seraph PauldronR.Outer): 8 and 7 apart
|
||||
THIN 1.1e-4 the least crossing refused holds 1.88e-4 (seraph Torso.LowerInL; by 60,000 sampled points 2.4e-4
|
||||
of its extent cubed winds -1, as 2.7e-4 of walker's gun does); the greatest let be holds 6.7e-5
|
||||
(chimera CannonBody.gunmetal, 178 faces at a bevel's crossings, 1.2e-5 sampled): 1.68 each side"""
|
||||
|
||||
def test_every_kit_part_is_accepted(self):
|
||||
# every part of every kit, at its defaults, all params at min, all at max, and each param at min and at max
|
||||
spec = importlib.util.spec_from_file_location("brokkr_kitbash_core_ram", SURFACE / "brokkr_kitbash" / "core.py")
|
||||
core = importlib.util.module_from_spec(spec)
|
||||
sys.modules[spec.name] = core
|
||||
spec.loader.exec_module(core)
|
||||
built, refused = 0, []
|
||||
for name in core.kit_names():
|
||||
for part_name, part in core.load_kit(name)["parts"].items():
|
||||
params = part["params"]
|
||||
variants = {"default": {}, "min": {p["name"]: p["min"] for p in params}, "max": {p["name"]: p["max"] for p in params}}
|
||||
for p in params:
|
||||
variants.update({p["name"] + " min": {p["name"]: p["min"]}, p["name"] + " max": {p["name"]: p["max"]}})
|
||||
for variant, given in variants.items():
|
||||
try:
|
||||
made = core.build(part, given)
|
||||
except core.KitError:
|
||||
continue # a corner of the params the kit itself refuses
|
||||
ends = np.cumsum(made.counts)
|
||||
built += 1
|
||||
try:
|
||||
R.solids(f"{name}.{part_name}", made.V, [tuple(int(i) for i in made.faces[a:b]) for a, b in zip(ends - made.counts, ends)])
|
||||
except R.RamError as error:
|
||||
refused.append((name, part_name, variant, str(error)))
|
||||
self.assertEqual(refused, [])
|
||||
self.assertEqual(built, KIT_VARIANTS)
|
||||
|
||||
def test_the_mech_sample_reads_as_recorded(self):
|
||||
# each mesh in its own frame, and placed by its world matrix: the twelve mirrored ones read the same both
|
||||
# ways, pass or inside out (r3's Hand.palm)
|
||||
sample = np.load(SURFACE / "tests" / "fixtures" / "ram_meshes.npz")
|
||||
rows = json.loads(str(sample["rows"]))
|
||||
got = {}
|
||||
for n, row in enumerate(rows):
|
||||
ends = np.cumsum(sample[f"counts{n}"])
|
||||
faces = [tuple(int(i) for i in sample[f"loops{n}"][a:b]) for a, b in zip(ends - sample[f"counts{n}"], ends)]
|
||||
for frame, mesh in (("own", (sample[f"v{n}"], faces)), ("placed", R.placed(sample[f"v{n}"], faces, sample[f"matrix{n}"]))):
|
||||
try:
|
||||
R.solids(row["name"], *mesh)
|
||||
got[row["name"], frame] = "pass"
|
||||
except R.RamError as error:
|
||||
got[row["name"], frame] = "open" if " is open: " in str(error) else "inside out" if " is wound inside out: " in str(error) else "crossing" if " crosses itself: " in str(error) else str(error)
|
||||
self.assertEqual(got, {(row["name"], frame): row["reads"] for row in rows for frame in ("own", "placed")})
|
||||
reads = [row["reads"] for row in rows]
|
||||
self.assertEqual(tuple(reads.count(kind) for kind in ("inside out", "crossing", "open", "pass")) + (sum(row["mirrored"] for row in rows),), MECH_SAMPLE)
|
||||
self.assertEqual(sorted(row["name"] for row in rows if row["reads"] == "crossing"), ["seraph:Torso.LowerInL", "seraph:Torso.LowerInR", "walker:GunL.gunmetal", "walker:GunR.gunmetal"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
|
|
@ -717,6 +717,538 @@ class FitTests(unittest.TestCase):
|
|||
core.fit_sheet(sheet_, kit.sheet(sheet_), FIT_FRAME, traces, cams)
|
||||
|
||||
|
||||
EYE = [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]
|
||||
PLATE = [f"c{i}" for i in range(5)]
|
||||
ON_Y = {"point": [0, 0, 0], "normal": [0, 1, 0]}
|
||||
|
||||
|
||||
def plate_camera(azimuth, distance=17.6, f=663.0):
|
||||
"""A camera `distance` off the origin, level, turned `azimuth` degrees from looking along +y: Paladin's hero's
|
||||
lens and range (663 px, 17.6 m)."""
|
||||
a = math.radians(azimuth)
|
||||
C = distance * np.array([math.sin(a), -math.cos(a), 0.0])
|
||||
right = np.cross(-C / distance, [0, 0, 1.0])
|
||||
right /= np.linalg.norm(right)
|
||||
return {"C": C.tolist(), "R": np.stack([right, np.cross(right, -C / distance), C / distance]).tolist(), "f": f, "c": [500.0, 500.0]}
|
||||
|
||||
|
||||
def pentagon(bow, lateral=0.0, twist=0.15):
|
||||
"""The sides of a pentagon plate 1.2 m across facing -y, as five-point cage chains: its corners `twist` metres
|
||||
off the plane y = 0 (a twisted plate), each side bowed `bow` of its length toward -y, which a view from there
|
||||
sees end on, and `lateral` of it outward in the plate."""
|
||||
angles = [2 * math.pi * i / 5 + 0.3 for i in range(5)]
|
||||
P = np.array([[0.6 * math.cos(t), twist * math.cos(2 * t), 0.6 * math.sin(t)] for t in angles])
|
||||
s, sides = np.linspace(0, 1, 5)[:, None], []
|
||||
for a, b in zip(P, np.roll(P, -1, axis=0)):
|
||||
sides.append(a + s * (b - a) + np.sin(math.pi * s) * np.linalg.norm(b - a) * (bow * np.array([0, -1.0, 0]) + lateral * (a + b) / np.linalg.norm(a + b)))
|
||||
return sides
|
||||
|
||||
|
||||
def plate_traces(cams, sides, sigma=0.0, seed=7):
|
||||
"""(views, traces) of a plate's sides as built, drawn through each camera in 12 points, `sigma` px of noise."""
|
||||
rng, views, traces = np.random.default_rng(seed), [], []
|
||||
for i, side in enumerate(sides):
|
||||
for k, cam in enumerate(cams):
|
||||
u = core.resampled(core.project(cam, core.crease_run(core.crease_run(side))), 12)
|
||||
traces.append({"camera": f"View{k}", "from": PLATE[i], "to": PLATE[(i + 1) % 5], "side": 1, "line": (u + rng.normal(0, sigma, u.shape)).tolist()})
|
||||
views.append((cam, EYE))
|
||||
return views, traces
|
||||
|
||||
|
||||
def crown_chains(out):
|
||||
"""Per side of a block_plate report, its crown vertices in the sheet."""
|
||||
n, first, chains = sum(side["points"] - 1 for side in out["sides"]), 0, []
|
||||
for side in out["sides"]:
|
||||
chains.append([(first + m) % n for m in range(side["points"])])
|
||||
first += side["points"] - 1
|
||||
return chains
|
||||
|
||||
|
||||
def off_run(out, chain, truth):
|
||||
"""The furthest a blocked side as built stands from a true cage chain as built, metres."""
|
||||
built = core.crease_run(core.crease_run(np.array(out["sheet"]["verts"])[chain]))
|
||||
return core._off(built, core.resampled(core.crease_run(core.crease_run(np.asarray(truth, float))), 400))
|
||||
|
||||
|
||||
def off_plate(out, sides):
|
||||
return max(float(off_run(out, chain, side).max()) for chain, side in zip(crown_chains(out), sides))
|
||||
|
||||
|
||||
def blocked_plate(views, traces, **more):
|
||||
return core.block_plate(views, {"corners": PLATE}, traces, kit.sheet, **more)
|
||||
|
||||
|
||||
def rendered(name, corners, sigma=0.0, close=0.0, seed=0, take=None, off=None):
|
||||
"""(views, plate, traces, the true sides, the fixture's plate) of a plate of tests/fixtures/spectre_truth.json
|
||||
with `corners` of its loop named: each stroke traced from the renders is cut at the named corners it passes
|
||||
through, every point `sigma` px off, a closing stroke moved `close` px as one. The strokes are the fixture's
|
||||
own, searched from the truth's projection, or those of its `take`, searched from a seed off it, or with
|
||||
`off` (d, degrees) no search at all: the truth's projection, each point of each stroke in turn moved d px
|
||||
in its own direction."""
|
||||
fixture = json.loads((Path(__file__).resolve().parent / "fixtures" / "spectre_truth.json").read_text(encoding="utf-8"))
|
||||
plate, rng, views, traces = fixture["plates"][name], np.random.default_rng(seed), [], []
|
||||
turns = iter(np.radians(off[1])) if off else None
|
||||
for k, stroke in enumerate(plate["strokes"]):
|
||||
line = np.array(stroke["line"] if take is None else plate["takes"][take]["lines"][k])
|
||||
if off:
|
||||
line = core.seen(fixture["cameras"][stroke["view"]], fixture["frames"][stroke["view"]], np.array([plate["truth"][corner] for corner in stroke["through"]]) * [stroke["side"], 1, 1])
|
||||
line = line + off[0] * np.array([[math.cos(turn), math.sin(turn)] for _, turn in zip(line, turns)])
|
||||
line = line + (rng.normal(0, sigma, line.shape) if sigma else 0.0)
|
||||
if stroke["closing"] and close:
|
||||
turn = rng.uniform(0, 2 * math.pi)
|
||||
line = line + close * np.array([math.cos(turn), math.sin(turn)])
|
||||
cuts = [k for k, corner in enumerate(stroke["through"]) if corner in corners]
|
||||
for a, b in zip(cuts, cuts[1:]):
|
||||
traces.append({"camera": stroke["view"], "from": stroke["through"][a], "to": stroke["through"][b], "side": stroke["side"], "line": line[a:b + 1].tolist(),
|
||||
**({"frame": fixture["frames"]["hero"]} if stroke["view"] == "hero" else {})})
|
||||
views.append((fixture["cameras"][stroke["view"]], fixture["frames"][stroke["view"]]))
|
||||
loop, named = plate["loop"], [corner for corner in plate["loop"] if corner in corners]
|
||||
sides = []
|
||||
for i, corner in enumerate(named):
|
||||
a, b = loop.index(corner), loop.index(named[(i + 1) % len(named)])
|
||||
sides.append(np.array([plate["truth"][loop[k % len(loop)]] for k in range(a, (b if b > a else b + len(loop)) + 1)]))
|
||||
return views, {"corners": named, "mirror": True, "seam": [corner for corner in plate["seam"] if corner in corners]}, traces, sides, (fixture, plate)
|
||||
|
||||
|
||||
def off_projection(fixture, plate, take):
|
||||
"""The furthest a point of a take's strokes stands from the truth's projection, px."""
|
||||
worst = 0.0
|
||||
for stroke, line in zip(plate["strokes"], plate["takes"][take]["lines"]):
|
||||
drawn = core.seen(fixture["cameras"][stroke["view"]], fixture["frames"][stroke["view"]], np.array([plate["truth"][corner] for corner in stroke["through"]]) * [stroke["side"], 1, 1])
|
||||
worst = max(worst, float(np.linalg.norm(np.array(line) - drawn, axis=1).max()))
|
||||
return worst
|
||||
|
||||
|
||||
def off_rendered(out, sides):
|
||||
"""(the furthest a blocked corner stands from its own, the furthest a side as built and its true edge, a polyline
|
||||
through the truth's corners, stand apart either way), metres."""
|
||||
verts, chains = np.array(out["sheet"]["verts"]), crown_chains(out)
|
||||
edge = 0.0
|
||||
for chain, side in zip(chains, sides):
|
||||
built = core.crease_run(core.crease_run(verts[chain]))
|
||||
edge = max(edge, float(core._off(built, side).max()), float(core._off(core.resampled(side, 300), built).max()))
|
||||
return max(float(np.linalg.norm(verts[chain[0]] - side[0])) for chain, side in zip(chains, sides)), edge
|
||||
|
||||
|
||||
@unittest.skipIf(np is None, "numpy")
|
||||
class BlockTests(unittest.TestCase):
|
||||
"""block_plate: a plate's first cage from traces of its outline. Bounds follow
|
||||
lodur:ruling:deterministic-bound-margin; the other numbers are tolerances round a known truth. Mutants, each
|
||||
run once on a copy:
|
||||
M1 no end terms test_spectre_roof_and_cheek, test_every_point_as_far_off_bounds_the_rendered_roof
|
||||
M2 a point prior (fit_shell's) for the plane distance test_one_view_and_a_plane_block_a_bowed_plate, test_fairness_is_set_by_the_rendered_roof
|
||||
M3 a seam corner's x free test_spectre_roof_and_cheek, test_the_rendered_roof_blocks_from_traces_of_its_renders
|
||||
M4 no fairness test_fairness_is_set_by_the_rendered_roof
|
||||
M5 the 66 degree guard off test_a_plane_far_off_square_on_to_its_one_view_is_refused, test_a_seam_corner_says_what_decided_it
|
||||
M6 no growth (K_MAX 2) test_a_side_grows_until_its_trace_is_explained, test_spectre_roof_and_cheek
|
||||
F5 FAIR 0.5, F05 FAIR 0.05 test_fairness_is_set_by_the_rendered_roof; test_a_side_grows_until_its_trace_is_explained
|
||||
S1 a seam point labelled mirror whatever its share test_a_seam_corner_says_what_decided_it
|
||||
S2 a seam corner never sent to the plane's guard test_a_seam_corner_says_what_decided_it
|
||||
I1 a side's label from its first point only, never plane test_a_side_says_what_decided_its_inner_points
|
||||
T06, T08, T2, T26, T3 START 0.6, 0.8, 2.0, 2.6, 3.3 test_views_5_degrees_apart_take_their_depth_from_a_plane_or_are_refused
|
||||
K1 a skirt of fixed metres test_a_plate_keeps_its_proportions_at_any_size
|
||||
|
||||
What the blocking is worth against a known truth is test_the_rendered_roof_blocks_from_traces_of_its_renders:
|
||||
a built plate, rendered, its edges traced off the renders. test_spectre_roof_and_cheek and
|
||||
test_paladin_plates_one_view_each read agreement with another fit and with a harness's lift on the same
|
||||
pixels, not accuracy."""
|
||||
|
||||
def test_a_twisted_bowed_plate_blocks_from_two_views(self):
|
||||
"""block-synthetic. Views 60 and 19 degrees apart, traces 0.5 and 1.5 px off: every trace is explained with
|
||||
two points a side, and the crown as built ends 39.3, 52.1 (60 degrees) and 65.0, 135.1 mm (19) from the
|
||||
truth: the 56 mm bow toward the first camera reads under 2 px, the default tol explains it with a straight
|
||||
side, and the bow is the error. At 60 degrees every corner is decided by the views (prior_share 0.138 at
|
||||
most, under core.VIEWS by 1.45); at 19 the plane has 0.30 to 0.38 of each. A side of two points has no
|
||||
point of its own: it says corners."""
|
||||
sides = pentagon(0.08)
|
||||
for apart, sigma, most, by in ((60, 0.5, 0.06, "views"), (60, 1.5, 0.08, "views"), (19, 0.5, 0.1, "plane"), (19, 1.5, 0.2, "plane")):
|
||||
out = blocked_plate(*plate_traces([plate_camera(0), plate_camera(apart)], sides, sigma))
|
||||
self.assertLess(off_plate(out, sides), most, (apart, sigma))
|
||||
self.assertEqual({corner["decided_by"] for corner in out["corners"]}, {by}, (apart, sigma))
|
||||
self.assertLess(max(abs(corner["parallax_deg"] - apart) for corner in out["corners"]), 1.5)
|
||||
self.assertEqual(out["plane"]["from"], "corners")
|
||||
self.assertEqual([(side["decided_by"], side["inner"]) for side in out["sides"]], [("corners", [])] * 5)
|
||||
kit.sheet(out["sheet"])
|
||||
|
||||
def test_views_5_degrees_apart_take_their_depth_from_a_plane_or_are_refused(self):
|
||||
"""block-low-parallax, T06, T3, T08, T2, T26 (Soul s2, start-unpinned-and-comment-stale). The views start a
|
||||
corner where one pixel moves their meeting point less than core.START x share x the plate's extent, the
|
||||
prior's own scale; with no plane a plate blocks when three corners start. START is 1, the prior's own
|
||||
unit: it is not derived from a measurement, it is pinned between two. At Paladin's lens and range the
|
||||
pentagon's third corner starts at START 0.724 with the views 19 degrees apart, 0.831 at 16.5 and 2.729 at 5;
|
||||
at 11 this test's plate (0.5 px, seed 7) turns from refused to blocked between START 1.22 and 1.23. So
|
||||
at 16.5 degrees it blocks with no plane (73.0 mm from the truth) and at 11 it is refused naming its
|
||||
corners: 1 stands 1.20 over the one reading and 1.22 under the other, the two's geometric mean within
|
||||
1%. START 0.6 and 0.8 refuse the 16.5 degrees; 2.0, 2.6 and 3.3 block the 11 (104.4
|
||||
mm off; the line switches blocking and refusal and is no cliff in accuracy). At 5 degrees the corners
|
||||
triangulate 0.25 to 1.5 m off: with a plane every corner is decided by it (prior_share 0.795 to 0.838),
|
||||
with none the plate is refused. The line is metres a pixel, not degrees: through a lens three times as
|
||||
long the same plate 7 degrees apart starts at 0.648 and blocks from its views, 60.5 mm from the truth
|
||||
(65.0 at 19 degrees through the short lens)."""
|
||||
sides = pentagon(0.08)
|
||||
self.assertEqual(blocked_plate(*plate_traces([plate_camera(0), plate_camera(16.5)], sides, 0.5))["plane"]["from"], "corners")
|
||||
with self.assertRaisesRegex(core.ReferenceFitError, r"^plane: none was given, and 'c0', 'c1', 'c2', 'c3', 'c4' are decided by no view"):
|
||||
blocked_plate(*plate_traces([plate_camera(0), plate_camera(11)], sides, 0.5))
|
||||
views, traces = plate_traces([plate_camera(0), plate_camera(5)], pentagon(0.08), 0.5)
|
||||
out = blocked_plate(views, traces, plane=ON_Y)
|
||||
self.assertEqual([corner["decided_by"] for corner in out["corners"]], ["plane"] * 5)
|
||||
self.assertGreater(min(corner["prior_share"] for corner in out["corners"]), 0.7)
|
||||
self.assertEqual(out["plane"]["from"], "given")
|
||||
with self.assertRaisesRegex(core.ReferenceFitError, r"^plane: none was given, and 'c0', 'c1', 'c2', 'c3', 'c4' are decided by no view"):
|
||||
blocked_plate(views, traces)
|
||||
sides = pentagon(0.08)
|
||||
out = blocked_plate(*plate_traces([plate_camera(0, f=1989.0), plate_camera(7, f=1989.0)], sides, 0.5))
|
||||
self.assertEqual(out["plane"]["from"], "corners")
|
||||
self.assertLess(off_plate(out, sides), 0.1)
|
||||
|
||||
def test_a_side_grows_until_its_trace_is_explained(self):
|
||||
"""block-growth, M6. A straight-sided plate blocks with its corners alone, 1.9 mm from the truth (the plane
|
||||
draws its twisted corners in). Sides bowed 35% of their length in the plate grow to three points and every
|
||||
trace reads under 1 px; M6 refuses the plate, its first side not explained at two points. The grown crown
|
||||
ends 41.6 mm off: fairness holds the bow in while the traces stay explained (M4, in the class's notes)."""
|
||||
cams = [plate_camera(0), plate_camera(60)]
|
||||
out = blocked_plate(*plate_traces(cams, pentagon(0.0)))
|
||||
self.assertEqual(([side["points"] for side in out["sides"]], out["rounds"], len(out["sheet"]["verts"])), ([2] * 5, 1, 11))
|
||||
self.assertLess(off_plate(out, pentagon(0.0)), 0.004)
|
||||
sides = pentagon(0.08, 0.35)
|
||||
out = blocked_plate(*plate_traces(cams, sides))
|
||||
self.assertEqual(([side["points"] for side in out["sides"]], out["rounds"], len(out["sheet"]["verts"])), ([3] * 5, 2, 21))
|
||||
self.assertLess(max(trace["unexplained_px"] for side in out["sides"] for trace in side["traces"]), core.TOL / 1.2)
|
||||
self.assertLess(off_plate(out, sides), 0.06)
|
||||
|
||||
def test_a_side_says_what_decided_its_inner_points(self):
|
||||
"""interior-points (Soul s1), I1. The bowed pentagon from exact traces 60 degrees apart, asked at tol 0.1:
|
||||
the sides grow to 4, 4, 4, 3, 4 points and every trace reads under 0.12 px, every corner is decided by the
|
||||
views, and the side from c3 still ends 52.8 mm off the truth (the others 2.4 to 7.4). Its one inner point
|
||||
has prior_share 0.405, twice core.VIEWS: the side says plane, and its inner point says why. A side whose
|
||||
trace is explained is not thereby a side the views decided."""
|
||||
sides = pentagon(0.08)
|
||||
out = blocked_plate(*plate_traces([plate_camera(0), plate_camera(60)], sides), tol=0.1)
|
||||
self.assertEqual([side["points"] for side in out["sides"]], [4, 4, 4, 3, 4])
|
||||
self.assertEqual([len(side["inner"]) for side in out["sides"]], [2, 2, 2, 1, 2])
|
||||
self.assertEqual({corner["decided_by"] for corner in out["corners"]}, {"views"})
|
||||
self.assertLess(max(trace["unexplained_px"] for side in out["sides"] for trace in side["traces"]), 0.12)
|
||||
off = [float(off_run(out, chain, side).max()) for chain, side in zip(crown_chains(out), sides)]
|
||||
self.assertEqual(int(np.argmax(off)), 3)
|
||||
self.assertEqual((out["sides"][3]["decided_by"], out["sides"][3]["inner"][0]["decided_by"]), ("plane", "plane"))
|
||||
self.assertGreater(out["sides"][3]["inner"][0]["prior_share"], 1.2 * core.VIEWS)
|
||||
self.assertEqual(set(out["sides"][3]["inner"][0]), {"decided_by", "m_per_px", "prior_share"})
|
||||
|
||||
def test_a_seam_corner_says_what_decided_it(self):
|
||||
"""seam-corner-grazing (Soul s1), S1, S2, M5. A mirrored plate, its seam a to b on x = 0, traced in one view
|
||||
0.5 px off with the plane y = 0.05 given. From 60 degrees off the mirror plane the seam's corners are
|
||||
decided by it (prior_share 0.135 and 0.117, under core.VIEWS by 1.48; 7 mm off). From 10 degrees the sight
|
||||
lines run along x = 0: the seam's corners are lifted onto the plane as any corner one view sees, and read
|
||||
plane (0.571 and 0.513; 33 mm off): S1 reads them mirror. With a plane the view also runs along (its
|
||||
normal 73 degrees off x) there is no depth at all, and the plate is refused naming the seam's corner: S2
|
||||
and M5 block it."""
|
||||
P, names = np.array([[0, 0, 0.6], [0, 0, -0.6], [0.5, 0.1, -0.5], [0.45, 0.1, 0.5]]), ["a", "b", "c", "d"]
|
||||
|
||||
def block(azimuth, normal):
|
||||
rng, cam, traces = np.random.default_rng(1), plate_camera(azimuth), []
|
||||
for i in range(4):
|
||||
u = core.project(cam, P[[i, (i + 1) % 4]])
|
||||
traces.append({"from": names[i], "to": names[(i + 1) % 4], "side": 1, "line": (np.linspace(u[0], u[1], 6) + rng.normal(0, 0.5, (6, 2))).tolist()})
|
||||
return core.block_plate([(cam, EYE)] * 4, {"corners": names, "mirror": True, "seam": ["a", "b"]}, traces, kit.sheet, plane={"point": [0, 0.05, 0], "normal": normal})
|
||||
|
||||
out = block(60, [0, 1, 0])
|
||||
self.assertEqual([corner["decided_by"] for corner in out["corners"]], ["mirror", "mirror", "plane", "plane"])
|
||||
self.assertLess(max(corner["prior_share"] for corner in out["corners"][:2]), core.VIEWS / 1.2)
|
||||
self.assertLess(max(float(np.linalg.norm(np.array(out["sheet"]["verts"])[k] - P[k])) for k in (0, 1)), 0.012)
|
||||
out = block(10, [0, 1, 0])
|
||||
self.assertEqual([corner["decided_by"] for corner in out["corners"]], ["plane"] * 4)
|
||||
self.assertGreater(min(corner["prior_share"] for corner in out["corners"][:2]), 1.2 * core.VIEWS)
|
||||
self.assertEqual([float(x) for x in np.array(out["sheet"]["verts"])[:2, 0]], [0.0, 0.0])
|
||||
with self.assertRaisesRegex(core.ReferenceFitError, r"^plate\.corners\[0\] 'a': the plane stands 83 degrees off square-on to the view of traces\[0\]"):
|
||||
block(10, [1, 0.3, 0])
|
||||
|
||||
def test_a_plate_keeps_its_proportions_at_any_size(self):
|
||||
"""plate-template (Soul s1), K1. The pentagon at 0.1, 1 and 10 times its size through cameras as many times
|
||||
as far: the skirt stands 0.078 of the crown's extent from the crown and the centre 0.017 of it proud at
|
||||
every size, where a skirt of fixed metres stood 0.81 of a 0.11 m plate's extent out and 0.008 of an 11 m
|
||||
one's. The crown blocks within a ten-thousandth of the extent at each."""
|
||||
for scale in (0.1, 1.0, 10.0):
|
||||
sides = [side * scale for side in pentagon(0.0, twist=0.0)]
|
||||
out = blocked_plate(*plate_traces([plate_camera(0, distance=17.6 * scale), plate_camera(60, distance=17.6 * scale)], sides))
|
||||
verts = np.array(out["sheet"]["verts"])
|
||||
extent = float(np.linalg.norm(verts[:5, None] - verts[None, :5], axis=2).max())
|
||||
self.assertAlmostEqual(float(np.linalg.norm(verts[5:10] - verts[:5], axis=1).mean()) / extent, math.hypot(core.FLARE, core.DROP), places=4)
|
||||
self.assertAlmostEqual(float(np.linalg.norm(verts[10] - verts[:5].mean(0))) / extent, core.DOME, places=4)
|
||||
self.assertLess(off_plate(out, sides), 1e-4 * extent)
|
||||
|
||||
def test_one_view_and_a_plane_block_a_bowed_plate(self):
|
||||
"""M2. A flat plate in the plane it is given, its sides bowed 35% in the plate, traced exactly in one view
|
||||
30 degrees off square-on: every corner is decided by the plane, the sides grow to three points and the
|
||||
crown ends 85.1 mm off the truth. M2, which holds each point where it was started instead of to the plane,
|
||||
ends 109.7 mm off: the bound is their geometric mean, separation 1.14 each side (1.29 across), the least
|
||||
the ruling takes."""
|
||||
sides = pentagon(0.0, 0.35, twist=0.0)
|
||||
out = blocked_plate(*plate_traces([plate_camera(30)], sides), plane=ON_Y)
|
||||
self.assertEqual([corner["decided_by"] for corner in out["corners"]], ["plane"] * 5)
|
||||
self.assertEqual([corner["parallax_deg"] for corner in out["corners"]], [0.0] * 5)
|
||||
self.assertEqual([side["points"] for side in out["sides"]], [3] * 5)
|
||||
self.assertLess(off_plate(out, sides), 0.0966)
|
||||
|
||||
def test_a_plane_far_off_square_on_to_its_one_view_is_refused(self):
|
||||
"""M5: the guard promoted from the Paladin harness (paladin_limbs.plate, the 8 m pauldron). One view 64
|
||||
degrees off the plane's normal blocks the plate on it; at 68 degrees (cosine 0.375, under core.SQUARE) the
|
||||
plate is refused naming the corner, the trace and the angle. M5 blocks it."""
|
||||
sides = pentagon(0.0, twist=0.0)
|
||||
out = blocked_plate(*plate_traces([plate_camera(64)], sides), plane=ON_Y)
|
||||
self.assertLess(off_plate(out, sides), 1e-4)
|
||||
with self.assertRaisesRegex(core.ReferenceFitError, r"^plate\.corners\[0\] 'c0': the plane stands 67 degrees off square-on to the view of traces\[0\]"):
|
||||
blocked_plate(*plate_traces([plate_camera(68)], sides), plane=ON_Y)
|
||||
|
||||
def spectre(self, name):
|
||||
fixture = json.loads((Path(__file__).resolve().parent / "fixtures" / "spectre_plates.json").read_text(encoding="utf-8"))
|
||||
plate = fixture["plates"][name]
|
||||
traces = [{"camera": trace["view"], **{key: trace[key] for key in ("from", "to", "side", "line")}, **({"frame": fixture["frames"]["hero"]} if trace["view"] == "hero" else {})} for trace in plate["traces"]]
|
||||
return fixture, plate, core.block_plate([(fixture["cameras"][trace["view"]], fixture["frames"][trace["view"]]) for trace in plate["traces"]], plate["plate"], traces, kit.sheet)
|
||||
|
||||
def test_spectre_roof_and_cheek(self):
|
||||
"""block-spectre, M1, M3, M6. SPECTRE's roof and cheek from no blocking (tests/fixtures/spectre_plates.json:
|
||||
the brow, ridge and chine are hand traces, the sides nobody traced are edges of the fitted cage). Roof: the
|
||||
brow's free corner is decided by the views (62.8 degrees, prior_share 0.054), the ridge's two by the mirror
|
||||
plane; the ridge, traced in the side view alone, is built 7.3 mm at most from the fitted ridge and the brow
|
||||
a median of 8.4 mm from the fitted brow (78.6 at most), in four points. M1 reads 27.7 and 18.9 (M4 19.8 on the brow): the bounds
|
||||
are the geometric means, separations 1.95 and 1.50 each side. Cheek: the jaw, where the two hand traces
|
||||
disagree by 0.27 m, stays on x = 0. M3 lands the roof's nose at x = -0.049 and the jaw at -0.140 and the
|
||||
cage's parser refuses both; M1 puts the cheek's skirt across the plane and it is refused; M6 refuses both
|
||||
at two points a side."""
|
||||
fixture, plate, out = self.spectre("roof")
|
||||
self.assertEqual([(corner["name"], corner["decided_by"]) for corner in out["corners"]], [("ridge_rear", "mirror"), ("nose", "mirror"), ("brow_rear", "views")])
|
||||
self.assertLess(out["corners"][2]["prior_share"], core.VIEWS / 1.2)
|
||||
self.assertGreater(out["corners"][2]["parallax_deg"], 60)
|
||||
ridge, brow, rear = crown_chains(out)
|
||||
self.assertEqual([side["points"] for side in out["sides"]], [2, 4, 2])
|
||||
self.assertLess(float(off_run(out, ridge, plate["reference"]["ridge"]).max()), 0.0142)
|
||||
self.assertLess(float(np.median(off_run(out, brow, plate["reference"]["brow"]))), 0.0126)
|
||||
verts = np.array(out["sheet"]["verts"])
|
||||
self.assertEqual(float(np.abs(verts[ridge, 0]).max()), 0.0)
|
||||
self.assertEqual(out["left_out"], [1, 3]) # the hero poses the hull 3 degrees down: fit_shell has one frame
|
||||
self.assertEqual([trace["run"] for trace in out["fit_traces"]], [{"verts": ridge}, {"verts": brow[::-1]}, {"verts": rear}])
|
||||
fixture, plate, out = self.spectre("cheek")
|
||||
self.assertEqual([(corner["name"], corner["decided_by"]) for corner in out["corners"]], [("chine_rear", "views"), ("jaw", "mirror"), ("chin", "mirror")])
|
||||
chine, seam, _ = crown_chains(out)
|
||||
self.assertEqual([float(x) for x in np.array(out["sheet"]["verts"])[seam, 0]], [0.0, 0.0])
|
||||
self.assertEqual(out["sheet"]["mirror"], True)
|
||||
self.assertEqual(out["sheet"]["poles"], [seam[0], seam[1], len(out["sheet"]["verts"]) - 1])
|
||||
|
||||
def test_the_rendered_roof_blocks_from_traces_of_its_renders(self):
|
||||
"""block-truth (Soul s1, real-readings-not-accuracy; Soul s2, bound-premise-seeded-by-truth), M3. SPECTRE's
|
||||
pass-3 roof, a hard mirrored cage of 11 known vertices, built by brokkr_kitbash.shell, rendered through
|
||||
SPECTRE's two solved cameras at the sheet's pixel size and its edges traced off the renders: one plate,
|
||||
one pair of views. The ridge is traced in the side view alone, the lip, the outer edge and the rear edge
|
||||
in the hero's mirrored half and in the side view, 62 degrees apart; the side view's pixel is 27.6 mm
|
||||
across at the plate, the hero's 11.6.
|
||||
|
||||
The traces are the fixture's takes (tests/fixtures/spectre_truth.json says how): a search for the
|
||||
strongest brightness step across each edge, from a seed that is not on the answer. Six families of twelve
|
||||
draws: the truth's projection moved as one by 0.5, 1 and 1.5 px in a drawn direction (a 2.5 px window),
|
||||
and each of its vertices moved by a normal draw of 1 and 2 px (3.5 px) and of 3 px (6 px). Such a take's
|
||||
points stand 2.1 to 30.7 px from the truth's projection, 6.8 at the median: a stroke ends where it
|
||||
crosses its neighbours, and two that run nearly along each other cross far off. 62 of the 72 block (12,
|
||||
12, 11, 10, 10, 7 by family; nine are refused at a side not explained at six points, one at the cage's
|
||||
parser), every one with the ridge's six corners decided by the mirror plane and the outer edge's five by
|
||||
the views (prior_share 0.037 at most).
|
||||
|
||||
What the takes read: a blocked plate's worst corner over its take's worst point x the coarser view's
|
||||
pixel is 1.18 at most (1.12, 1.16, 1.18, 1.04, 1.06, 1.11 by family), 33 to 929 mm, 142 at the median;
|
||||
the three draws that grow a side stand at 0.51, 0.75 and 1.08. That is no bound: a take's worst point is
|
||||
one far crossing, and it inflates the denominator (Soul s3, bound-is-the-takes-outliers). The bound is
|
||||
BOUND, set by test_every_point_as_far_off_bounds_the_rendered_roof, and the takes are held to it. M3
|
||||
lands the ridge off x = 0 and every take is refused. No bound is stated in the takes' rms: against the
|
||||
rms the same readings reach 5.3. A search seeded on the truth's projection itself is no reading: its
|
||||
2.5 px window ends its strokes 2.5 px off and its plate 39 mm off."""
|
||||
corners = ["ridge_rear", "r4", "r3", "r2", "r1", "nose", "a", "b", "c", "d", "e"]
|
||||
views, plate, traces, sides, (fixture, record) = rendered("roof", corners)
|
||||
middle = np.mean(list(record["truth"].values()), axis=0)
|
||||
pixel = max(float(np.linalg.norm(np.array(cam["C"]) - middle)) / cam["f"] for cam in fixture["cameras"].values())
|
||||
self.assertAlmostEqual(pixel, 0.0276, places=4)
|
||||
self.assertEqual(len(record["takes"]), 72)
|
||||
blocked = 0
|
||||
for take in range(len(record["takes"])):
|
||||
views, plate, traces, sides, _ = rendered("roof", corners, take=take)
|
||||
try:
|
||||
out = core.block_plate(views, plate, traces, kit.sheet)
|
||||
except core.ReferenceFitError:
|
||||
continue
|
||||
blocked += 1
|
||||
self.assertEqual([corner["decided_by"] for corner in out["corners"]], ["mirror"] * 6 + ["views"] * 5, take)
|
||||
self.assertLess(max(corner["prior_share"] for corner in out["corners"]), core.VIEWS / 1.2, take)
|
||||
self.assertGreater(min(corner["parallax_deg"] for corner in out["corners"][6:]), 59, take)
|
||||
self.assertEqual(max(abs(float(np.array(out["sheet"]["verts"])[chain[0], 0])) for chain in crown_chains(out)[:6]), 0.0, take)
|
||||
self.assertLess(off_rendered(out, sides)[0], self.BOUND * off_projection(fixture, record, take) * pixel, take)
|
||||
self.assertGreaterEqual(blocked, 52)
|
||||
|
||||
BOUND = 2.08 # a blocked plate's worst corner, in its worst traced point x the coarser view's pixel: one plate, one pair of views
|
||||
FAR = [0, 107, 45, 33, 216, 300, 270, 165, 99, 150, 45, 30, 90, 270, 180, 285, 345, 270, 90, 240, 125, 184, 321, 279] # degrees, a point: the worst a search found
|
||||
|
||||
def test_every_point_as_far_off_bounds_the_rendered_roof(self):
|
||||
"""block-bound (Soul s3, bound-is-the-takes-outliers, bound-families-left-out), M1. The worst a trace
|
||||
does for its worst point is to have no outlier: every point of every stroke the same d px off the
|
||||
truth's projection. No search, no renders: the rendered roof's truth drawn through its two cameras and
|
||||
moved. Each view moved as one, 12 directions by 12 at 1 px: all 144 block and the worst corner stands
|
||||
1.005 to 1.505 x d x the coarser view's pixel off (1.096 at the median; 1.504 and 1.502 at 2 and 3 px).
|
||||
M1 reads 2.865 there: BOUND, 2.08, is the geometric mean, separation 1.38 each side. Each stroke its own
|
||||
direction reaches 1.582 (a coordinate ascent over 12 and 36 directions, six starts) and each point its
|
||||
own 1.666 at 1 px and 1.659 at 3: FAR, a coordinate ascent over 8 directions from nine starts, which
|
||||
end at 1.57 to 1.65, the best refined over 24. FAR is the worst found, not the worst there is; BOUND
|
||||
stands 1.25 over it and claims no mutant there (M1 reads 1.994). The eight families of searched takes,
|
||||
40 fresh draws each, read 1.11 to 1.33 (docs/reference.md), every one under the 1.505."""
|
||||
corners = ["ridge_rear", "r4", "r3", "r2", "r1", "nose", "a", "b", "c", "d", "e"]
|
||||
_, _, _, _, (fixture, record) = rendered("roof", corners)
|
||||
middle = np.mean(list(record["truth"].values()), axis=0)
|
||||
pixel = max(float(np.linalg.norm(np.array(cam["C"]) - middle)) / cam["f"] for cam in fixture["cameras"].values())
|
||||
|
||||
def reads(d, degrees):
|
||||
views, plate, traces, sides, _ = rendered("roof", corners, off=(d, degrees))
|
||||
return off_rendered(core.block_plate(views, plate, traces, kit.sheet), sides)[0] / (d * pixel)
|
||||
|
||||
moved = [reads(1.0, [side if stroke["view"] == "side" else hero for stroke in record["strokes"] for _ in stroke["through"]])
|
||||
for hero in range(0, 360, 30) for side in range(0, 360, 30)]
|
||||
self.assertLess(max(moved), self.BOUND)
|
||||
for d in (1.0, 3.0):
|
||||
self.assertLess(1.6, reads(d, self.FAR), d) # still the far draw
|
||||
self.assertLess(reads(d, self.FAR), self.BOUND, d)
|
||||
|
||||
def test_fairness_is_set_by_the_rendered_roof(self):
|
||||
"""fair (Soul s1, fair-default-tuned-to-a-fit), F5, M4, M2. The rendered roof with four corners named
|
||||
(ridge_rear, nose, a, e), so the ridge and the outer edge are one side each and grow through their knees:
|
||||
from the traces as taken they grow to three points and stand 196.0 mm from the true edges at most, the
|
||||
hard knees cut by a run that reads as explained within tol (5.2 px is 144 mm in the side view). With every
|
||||
point 2 px off and the closing strokes moved 3 px, 24 draws: 15 block, and nine tenths of those stand
|
||||
within 196.9 mm. FAIR 0.5 reads 369.5 there, no fairness 394.0, M2 388.8: the bound is the geometric mean
|
||||
of 196.9 and 369.5, separation 1.37 each side. Over ten cells of known truth at 1 and 2 px (this roof four
|
||||
ways, and the bowed pentagon at 60 and 30 degrees and in one view) the mean of the cells' 90th percentiles
|
||||
reads 194, 184, 178, 178, 179, 186, 193, 196 mm at FAIR 0.1, 0.15, 0.2, 0.25, 0.3, 0.4, 0.5, 1 and the
|
||||
worst draw 301, 275, 273, 272, 312, 382, 494, 577, over the draws that blocked: 19, 20, 23, 24, 24, 25,
|
||||
26, 27 of the 168 are refused and counted in neither. FAIR is flat from 0.1 to 0.3: 0.2 and 0.25
|
||||
tie here, and on Soul's seeds (verdict cut-trace-block.s3) 0.1, 0.15 and 0.2 read 196, 196, 195. 0.2 is
|
||||
kept as a point on that plateau, not a resolved lowest (docs/reference.md has all three sets). The roof's strokes here are the fixture's
|
||||
own, searched from the truth's projection, with the noise added on top. From exact traces weaker
|
||||
fairness is nearer the truth (the bowed pentagon: 41.6 mm at 0.2, 16.2 at 0.5, 12.1 with none); nobody
|
||||
traces exactly, and at 1 px the difference is 16 mm at 60 degrees and the other way at 30."""
|
||||
corners = ["ridge_rear", "nose", "a", "e"]
|
||||
views, plate, traces, sides, _ = rendered("roof", corners)
|
||||
out = core.block_plate(views, plate, traces, kit.sheet)
|
||||
self.assertEqual([side["points"] for side in out["sides"]], [3, 2, 3, 2])
|
||||
self.assertLess(off_rendered(out, sides)[1], 0.235)
|
||||
edges = []
|
||||
for seed in range(24):
|
||||
views, plate, traces, sides, _ = rendered("roof", corners, 2.0, 3.0, seed)
|
||||
try:
|
||||
edges.append(off_rendered(core.block_plate(views, plate, traces, kit.sheet), sides)[1])
|
||||
except core.ReferenceFitError:
|
||||
pass
|
||||
self.assertGreaterEqual(len(edges), 12)
|
||||
self.assertLess(sorted(edges)[math.ceil(0.9 * len(edges)) - 1], 0.270)
|
||||
|
||||
def test_raptor_plate_from_two_views(self):
|
||||
"""block-raptor (tests/fixtures/raptor_plates.json): the hull plate bearing RAPTOR's 27, its corners marked
|
||||
by eye in the hero (right flank) and in the SIDE view (left flank, side -1). The hero camera is solved
|
||||
from hull marks alone (the nose, both emitters, the plate's corners): the seven admit none under 25.1 px
|
||||
rms at 50 mm (the sheet's hero and SIDE view do not draw one rigid hull), where the first hero, solved
|
||||
from leg joints, stood 18.5 degrees from the SIDE view and drew the hull tens of pixels off. Through it
|
||||
the plate blocks from its two views: sight lines 33.9 to 40.1 degrees apart, every trace explained
|
||||
within 3.2 px, the corners on the right flank at x 0.87 to 1.72 m. The prior has 0.173 to 0.197 of each
|
||||
corner, under core.VIEWS by less than the margin, so the label is not asserted: on this sheet two views
|
||||
decide a flank corner only just. No truth exists for the plate and four of the camera's seven marks are
|
||||
its corners: this is two views agreeing, pinned as it read, not an accuracy."""
|
||||
fixture = json.loads((Path(__file__).resolve().parent / "fixtures" / "raptor_plates.json").read_text(encoding="utf-8"))
|
||||
solved = core.solve(fixture["world"], fixture["pixels"], fixture["box"], model="rolled", lens=50)
|
||||
self.assertGreater(solved["rms"], 20)
|
||||
self.assertLess(float(np.abs(np.array(solved["C"]) - fixture["cameras"]["hero"]["C"]).max()), 1e-6)
|
||||
traces = [{key: trace[key] for key in ("from", "to", "side", "line")} for trace in fixture["traces"]]
|
||||
out = core.block_plate([(fixture["cameras"][trace["view"]], EYE) for trace in fixture["traces"]], fixture["plate"], traces, kit.sheet)
|
||||
self.assertGreater(min(corner["parallax_deg"] for corner in out["corners"]), 30)
|
||||
self.assertLess(max(corner["prior_share"] for corner in out["corners"]), 1.2 * core.VIEWS)
|
||||
self.assertLess(max(trace["unexplained_px"] for side in out["sides"] for trace in side["traces"]), core.TOL / 1.2)
|
||||
self.assertEqual((out["plane"]["from"], [side["points"] for side in out["sides"]]), ("corners", [2] * 4))
|
||||
crown = np.array(out["sheet"]["verts"])[:4]
|
||||
self.assertTrue((crown[:, 0] > 0.8).all() and (crown[:, 0] < 1.8).all(), crown[:, 0])
|
||||
|
||||
def test_paladin_plates_one_view_each(self):
|
||||
"""block-paladin (tests/fixtures/paladin_plates.json). Paladin's 16 traced plates, each a polygon traced in
|
||||
one view with the plane the agent gave it: every corner is decided by the plane (prior_share 1.00 to 2.13:
|
||||
over 1 where the sight line leans on the plane), every side stays two points, and the crown is the one the
|
||||
harness lifted onto that plane, within 1 mm (its fit_shell read 0.65 to 1.0 on the same plates). None of
|
||||
the 16 planes stands over 66 degrees off its view at e688951 (ForearmL.Outer, 61.6, is the furthest): the
|
||||
guard is claimed by test_a_plane_far_off_square_on_to_its_one_view_is_refused. The thigh shields as
|
||||
partners, the left's polygon seen as the right's reflection in the left thigh's frame, are refused, a side
|
||||
19.0 px unexplained at six points: the sheet's two polygons are not one plate mirrored (their lifted corners
|
||||
stand 0.16 to 0.77 m apart), so no Paladin plate has a corner decided by a partner view here."""
|
||||
fixture = json.loads((Path(__file__).resolve().parent / "fixtures" / "paladin_plates.json").read_text(encoding="utf-8"))
|
||||
|
||||
def block(name):
|
||||
plate = fixture["plates"][name]
|
||||
views = [(fixture["cameras"][trace["view"]], fixture["frames"][trace["frame"]]) for trace in plate["traces"]]
|
||||
return plate, core.block_plate(views, plate["plate"], [{key: trace[key] for key in ("from", "to", "side", "line")} for trace in plate["traces"]], kit.sheet, plane=plate.get("plane"))
|
||||
|
||||
single = sorted(name for name in fixture["plates"] if name != "ThighShield.partners")
|
||||
self.assertEqual(len(single), 16)
|
||||
for name in single:
|
||||
plate, out = block(name)
|
||||
n = len(plate["plate"]["corners"])
|
||||
self.assertEqual(({corner["decided_by"] for corner in out["corners"]}, [side["points"] for side in out["sides"]], out["plane"]["from"]), ({"plane"}, [2] * n, "given"), name)
|
||||
self.assertGreater(min(corner["prior_share"] for corner in out["corners"]), 0.9, name)
|
||||
crown, lifted = np.array(out["sheet"]["verts"])[:n], np.array(plate["reference"]["crown"]) # the harness turned some crowns to face out: the same ring from another corner, or the other way round
|
||||
self.assertLess(min(float(np.abs(crown - np.roll(lifted[::way], turn, axis=0)).max()) for way in (1, -1) for turn in range(n)), 0.001, name)
|
||||
with self.assertRaisesRegex(core.ReferenceFitError, r"^the side from 'c0' to 'c1' is not explained at 6 points, the most a side is given: traces\[0\] is not explained"):
|
||||
block("ThighShield.partners")
|
||||
|
||||
def test_the_blocking_goes_to_the_parser_and_to_fit_shell(self):
|
||||
"""block-then-fit without Blender (tests/live/reference_block.py builds it): the sheet is one the cage's
|
||||
parser takes, fit_traces name each side as a run of authored vertices, and fit_sheet takes both. On the
|
||||
straight plate fit_shell's own prior moves no point 5 mm (2.2 at most: the plane had drawn the twisted
|
||||
corners in); on the bowed plate it moves the grown points up to 74 mm, back toward the bow fairness held in."""
|
||||
cams = [plate_camera(0), plate_camera(60)]
|
||||
for sides, most in ((pentagon(0.0), 0.005), (pentagon(0.08, 0.35), 0.09)):
|
||||
views, traces = plate_traces(cams, sides)
|
||||
out = blocked_plate(views, traces)
|
||||
self.assertEqual((len(out["fit_traces"]), out["left_out"]), (10, []))
|
||||
self.assertEqual(set(out["fit_traces"][0]), {"camera", "run", "side", "line"})
|
||||
fit = core.fit_sheet(out["sheet"], kit.sheet(out["sheet"]), EYE, out["fit_traces"], [cam for cam, _ in views])
|
||||
self.assertLess(max(point["moved_m"] for point in fit["points"]), most)
|
||||
self.assertLess(len(json.dumps(out, separators=(",", ":"))), core.RESULT_LIMIT)
|
||||
|
||||
def test_block_refusals_name_their_field(self):
|
||||
"""block-refusals."""
|
||||
cams = [plate_camera(0), plate_camera(60)]
|
||||
views, traces = plate_traces(cams, pentagon(0.0))
|
||||
|
||||
def refused(pattern, views_=views, traces_=traces, plate=None, parse=None, **more):
|
||||
with self.assertRaisesRegex(core.ReferenceFitError, pattern):
|
||||
core.block_plate(views_, plate or {"corners": PLATE}, traces_, parse or kit.sheet, **more)
|
||||
|
||||
keep = [k for k, trace in enumerate(traces) if trace["from"] != "c2"]
|
||||
refused(r"^the side from 'c2' to 'c3' is traced in no view", [views[k] for k in keep], [traces[k] for k in keep])
|
||||
keep = [k for k, trace in enumerate(traces) if trace["from"] not in ("c1", "c2")]
|
||||
refused(r"^plate\.corners\[2\] 'c2': no trace ends at it", [views[k] for k in keep], [traces[k] for k in keep])
|
||||
refused(r"^traces\[0\]\.from 'c0' and \.to 'c2' are not consecutive corners", traces_=[{**traces[0], "to": "c2"}] + traces[1:])
|
||||
refused(r"^traces\[0\]\.from and \.to must name corners", traces_=[{**traces[0], "to": "c9"}] + traces[1:])
|
||||
refused(r"^traces\[3\]\.camera 'View1' is no camera of this plate", views[:3] + [(None, EYE)] + views[4:])
|
||||
refused(r"^traces\[1\]\.frame must be a 4 x 4 that only turns and moves", views[:1] + [(cams[1], (2 * np.eye(4)).tolist())] + views[2:])
|
||||
refused(r"^traces\[2\]\.side must be 1, or -1", traces_=traces[:2] + [{**traces[2], "side": 2}] + traces[3:])
|
||||
refused(r"^traces\[2\]\.line must be two or more", traces_=traces[:2] + [{**traces[2], "line": [[1, 2]]}] + traces[3:])
|
||||
refused(r"^traces\[2\] must be \{camera, box, frame, from, to, side, line\}", traces_=traces[:2] + [{**traces[2], "run": {}}] + traces[3:])
|
||||
refused(r"^plate\.corners must be three or more different names", plate={"corners": ["a", "b"]})
|
||||
refused(r"^plate\.seam must name two or more corners next to each other", plate={"corners": PLATE, "mirror": True, "seam": ["c0"]})
|
||||
refused(r"^plate\.seam must name two or more corners next to each other", plate={"corners": PLATE, "seam": ["c0", "c1"]})
|
||||
refused(r"^plane must be \{point: \[x, y, z\], normal: \[x, y, z\]\}", plane={"point": [0, 0, 0], "normal": [0, 0, 0]})
|
||||
|
||||
def no(document):
|
||||
raise kit.KitError("sheet.verts[0] is not to its taste")
|
||||
|
||||
refused(r"^sheet: the cage's parser does not take the plate as blocked \(sheet\.verts\[0\] is not to its taste\)", parse=no)
|
||||
long = [{**trace, "line": core.resampled(np.array(trace["line"]), 160).round(1).tolist()} for trace in traces]
|
||||
refused(r"^traces: the sheet and its report could be about \d+ characters, over the 16000", traces_=long)
|
||||
# a mirrored plate's corner drawn across the mirror plane from the others
|
||||
P, names = np.array([[0, 0, 0.5], [0, 0, -0.5], [0.5, 0.1, -0.4], [-0.05, 0.1, 0.4]]), ["a", "b", "c", "d"]
|
||||
mirrored = [{"from": names[i], "to": names[(i + 1) % 4], "side": 1, "line": core.project(cam, P[[i, (i + 1) % 4]]).tolist()} for i in range(4) for cam in cams]
|
||||
refused(r"^plate\.corners\[3\] 'd' starts at x = -0\.050, across the mirror plane", [(cam, EYE) for _ in range(4) for cam in cams], mirrored, {"corners": names, "mirror": True, "seam": ["a", "b"]})
|
||||
|
||||
|
||||
@unittest.skipIf(np is None, "numpy")
|
||||
class CameraTests(unittest.TestCase):
|
||||
CAM = {"C": [3.0, -7.0, 2.5], "f": 1400.0, "c": [640.0, 395.0], "box": BOX}
|
||||
|
|
@ -780,8 +1312,8 @@ class HostFileTests(unittest.TestCase):
|
|||
|
||||
def test_the_row_names_the_operator_and_properties_the_add_on_defines(self):
|
||||
source = (SURFACE / "brokkr_reference" / "__init__.py").read_text(encoding="utf-8")
|
||||
self.assertEqual([row["name"] for row in self.document["actions"]], ["brokkr_reference.solve_camera", "brokkr_reference.flow_score", "brokkr_reference.fit_shell"])
|
||||
self.assertEqual(source.count("bl_idname = "), 3)
|
||||
self.assertEqual([row["name"] for row in self.document["actions"]], ["brokkr_reference.solve_camera", "brokkr_reference.flow_score", "brokkr_reference.fit_shell", "brokkr_reference.block_plate"])
|
||||
self.assertEqual(source.count("bl_idname = "), 4)
|
||||
for row in self.document["actions"]:
|
||||
self.assertIn(f'bl_idname = "{row["name"]}"', source)
|
||||
self.assertEqual(row.get("result"), "brokkr_mesh_polish_result")
|
||||
|
|
@ -807,6 +1339,11 @@ class HostFileTests(unittest.TestCase):
|
|||
for bad in ({"tol": 0}, {"share": 11}, {"traces": ""}, {"object_name": "x" * 64}):
|
||||
with self.assertRaises(at.IntentInvalid):
|
||||
at.validate({**fit, **bad}, self.host)
|
||||
block = {**self.envelope, "action": "brokkr_reference.block_plate", "frame_object": "Frame", "plate": "{}", "traces": "[{}]"}
|
||||
self.assertEqual((at.validate(block, self.host)["share"], at.validate(block, self.host)["tol"], at.validate(block, self.host)["plane"]), (0.1, core.TOL, ""))
|
||||
for bad in ({"tol": 0}, {"share": 11}, {"traces": ""}, {"plate": ""}, {"frame_object": "x" * 64}, {"plane": "x" * 201}):
|
||||
with self.assertRaises(at.IntentInvalid):
|
||||
at.validate({**block, **bad}, self.host)
|
||||
|
||||
|
||||
class OwnershipTests(unittest.TestCase):
|
||||
|
|
@ -827,7 +1364,7 @@ class OwnershipTests(unittest.TestCase):
|
|||
decided by matching trace points to each other."""
|
||||
for path in (SURFACE / "brokkr_reference").glob("*.py"):
|
||||
text = path.read_text(encoding="utf-8")
|
||||
self.assertIsNone(re.search(r"def pair|_smoothest|cage_through|on_plane", text), path.name)
|
||||
self.assertIsNone(re.search(r"def pair|_smoothest|cage_through|on_plane|epipolar", text), path.name)
|
||||
self.assertIsNone(re.search(r"SHELL\] *=|kit_shell\"\] *=|\.data\.vertices|foreach_set|from_pydata", text), path.name)
|
||||
|
||||
def test_no_other_package_names_this_one(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue