forked from 1b-agent/opencadstudio-upstream
fix(view): Zoom Extents and All frame a drawing placed at survey coordinates (#1829)
A block whose content is only 3D solids leaves a marker wire carrying its insertion snap, and that point counted as drawing extent: a georeferenced block inserted at the origin made ZOOM E frame the origin and the model together, 860 km wide. Extents now skip those markers; the solids count through their meshes. The marker's snap also took the insertion point straight from the OCS, so a mirrored insert's snap sat on the far side of the origin. ZOOM All fitted the limits alone. In a 3D view it is now Zoom Extents, and in plan it frames the limits together with the extents. Instanced solids summed their rotated point and translation in f32 before meeting the eye, which cost up to half a metre at survey coordinates; the large terms now cancel first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
9a567d4f44
commit
f6455b22eb
5 files changed
+61
-25
No files matched your search
+17
-7
@@ -153,17 +153,27 @@ fn relative_position(
|
||||
position_low: vec3<f32>,
|
||||
instance: MeshInstance,
|
||||
) -> vec3<f32> {
|
||||
let world_high = vec3<f32>(
|
||||
dot(instance.model_row_0.xyz, position) + instance.model_row_0.w,
|
||||
dot(instance.model_row_1.xyz, position) + instance.model_row_1.w,
|
||||
dot(instance.model_row_2.xyz, position) + instance.model_row_2.w,
|
||||
// Large terms cancel before small ones join: the translation against the
|
||||
// eye first, then the rotated point, so neither a survey-placed instance
|
||||
// nor a block drawn at survey coordinates loses its low bits to an f32
|
||||
// sum (it cost up to half a metre).
|
||||
let translation_high = vec3<f32>(
|
||||
instance.model_row_0.w,
|
||||
instance.model_row_1.w,
|
||||
instance.model_row_2.w,
|
||||
);
|
||||
let world_low = vec3<f32>(
|
||||
let rotated_high = vec3<f32>(
|
||||
dot(instance.model_row_0.xyz, position),
|
||||
dot(instance.model_row_1.xyz, position),
|
||||
dot(instance.model_row_2.xyz, position),
|
||||
);
|
||||
let rotated_low = vec3<f32>(
|
||||
dot(instance.model_row_0.xyz, position_low),
|
||||
dot(instance.model_row_1.xyz, position_low),
|
||||
dot(instance.model_row_2.xyz, position_low),
|
||||
) + instance.translation_low.xyz;
|
||||
return (world_high - u.eye_high) + (world_low - u.eye_low);
|
||||
);
|
||||
return ((translation_high - u.eye_high) + rotated_high)
|
||||
+ (rotated_low + instance.translation_low.xyz - u.eye_low);
|
||||
}
|
||||
|
||||
fn mesh_instance(input: InstanceIn) -> MeshInstance {
|
||||
|
||||
Reference in new issue
Block a user