diff --git a/src/entities/dimension.rs b/src/entities/dimension.rs index bf83b6b69..e5eb32b73 100644 --- a/src/entities/dimension.rs +++ b/src/entities/dimension.rs @@ -1449,10 +1449,9 @@ fn text_fill_rect( let (sr, cr) = rot.sin_cos(); let hx = approx_w * 0.5; let hy = approx_h * 0.5; - let [ox, oy, oz] = [0.0_f64; 3]; - let cx = (pos.x - ox) as f32; - let cy = (pos.y - oy) as f32; - let cz = (pos.z - oz) as f32; + let cx = (pos.x) as f32; + let cy = (pos.y) as f32; + let cz = (pos.z) as f32; let corner = |dx: f64, dy: f64| -> [f32; 3] { let lx = dx * cr - dy * sr; let ly = dx * sr + dy * cr; diff --git a/src/entities/leader.rs b/src/entities/leader.rs index db510c0a2..b1a08cfdc 100644 --- a/src/entities/leader.rs +++ b/src/entities/leader.rs @@ -589,9 +589,8 @@ impl LeaderTess for Leader { entity_color }; let name = handle.value().to_string(); - let [ox, oy, oz] = [0.0_f64; 3]; let p3 = |v: &acadrust::types::Vector3| -> [f32; 3] { - [(v.x - ox) as f32, (v.y - oy) as f32, (v.z - oz) as f32] + [(v.x) as f32, (v.y) as f32, (v.z) as f32] }; let nan = [f32::NAN; 3]; diff --git a/src/entities/text_support.rs b/src/entities/text_support.rs index 234fa5f47..3820d3a03 100644 --- a/src/entities/text_support.rs +++ b/src/entities/text_support.rs @@ -1722,9 +1722,8 @@ pub(crate) fn text_baseline_points( return vec![]; } let n_lines = n_lines.max(1); - let [ox, oy, oz] = [0.0_f64; 3]; let cast = |p: [f64; 3]| -> [f32; 3] { - [(p[0] - ox) as f32, (p[1] - oy) as f32, (p[2] - oz) as f32] + [(p[0]) as f32, (p[1]) as f32, (p[2]) as f32] }; let bl = cast(corners[0]); let br = cast(corners[1]); @@ -1782,9 +1781,8 @@ pub(crate) fn text_greek_obb_tris( return vec![]; } let n_lines = n_lines.max(1); - let [ox, oy, oz] = [0.0_f64; 3]; let cast = |p: [f64; 3]| -> [f32; 3] { - [(p[0] - ox) as f32, (p[1] - oy) as f32, (p[2] - oz) as f32] + [(p[0]) as f32, (p[1]) as f32, (p[2]) as f32] }; let bl = cast(corners[0]); let br = cast(corners[1]); diff --git a/src/scene/cache/block_cache.rs b/src/scene/cache/block_cache.rs index c98a222c0..42f202759 100644 --- a/src/scene/cache/block_cache.rs +++ b/src/scene/cache/block_cache.rs @@ -673,17 +673,16 @@ pub fn expand_insert( let name = ins_handle.value().to_string(); let mut batches = Batches::default(); let mut visited: Vec = Vec::with_capacity(8); - let [ox, oy, _] = [0.0_f64; 3]; // `defn.aabb_local` is in the defn's offset frame — re-add // `defn.local_offset` (f64) before transforming so the world AABB is // accurate for distant content. let insert_world = transform_offset_aabb_xy(defn.aabb_local, defn.local_offset, &xform); let insert_local = [ - insert_world[0] - ox as f32, - insert_world[1] - oy as f32, - insert_world[2] - ox as f32, - insert_world[3] - oy as f32, + insert_world[0] as f32, + insert_world[1] as f32, + insert_world[2] as f32, + insert_world[3] as f32, ]; // Whole-Insert frustum cull. @@ -742,7 +741,6 @@ fn emit_greeked_text( ctx: &ExpandCtx, out: &mut Batches, ) { - let [ox, oy, oz] = [0.0_f64; 3]; let [lo_x, lo_y, lo_z] = defn_lo; // Re-add the defn's `local_offset` in f64 before composing with // `accum_xform` so the rect corners share the batch's f32 space @@ -753,7 +751,7 @@ fn emit_greeked_text( p[1] as f64 + lo_y, p[2] as f64 + lo_z, )); - [(w.x - ox) as f32, (w.y - oy) as f32, (w.z - oz) as f32] + [(w.x) as f32, (w.y) as f32, (w.z) as f32] }; // Per-line rects: split the OBB by `h_local` so each visible wrap @@ -877,7 +875,6 @@ fn emit_text_baseline( if h_local <= 0.0 { return; } - let [ox, oy, oz] = [0.0_f64; 3]; let [lo_x, lo_y, lo_z] = defn_lo; let xf = |p: [f32; 3]| -> [f32; 3] { let w = accum_xform.apply(Vector3::new( @@ -885,7 +882,7 @@ fn emit_text_baseline( p[1] as f64 + lo_y, p[2] as f64 + lo_z, )); - [(w.x - ox) as f32, (w.y - oy) as f32, (w.z - oz) as f32] + [(w.x) as f32, (w.y) as f32, (w.z) as f32] }; // Single line: just obb[0] → obb[1]. Skip when the projected length @@ -1216,12 +1213,11 @@ fn expand_defn( // `defn_lo` (in f64) before composing with `accum_xform` // so culling uses correct world-space corners. let world = transform_offset_aabb_xy(lw.aabb_local, defn_lo, accum_xform); - let [ox, oy, _] = [0.0_f64; 3]; let local = [ - world[0] - ox as f32, - world[1] - oy as f32, - world[2] - ox as f32, - world[3] - oy as f32, + world[0] as f32, + world[1] as f32, + world[2] as f32, + world[3] as f32, ]; if let Some(view) = ctx.view_aabb { if aabb_disjoint_xy(local, view) { @@ -1279,12 +1275,11 @@ fn expand_defn( nested_defn.local_offset, &composed, ); - let [ox, oy, _] = [0.0_f64; 3]; let local = [ - world[0] - ox as f32, - world[1] - oy as f32, - world[2] - ox as f32, - world[3] - oy as f32, + world[0] as f32, + world[1] as f32, + world[2] as f32, + world[3] as f32, ]; if let Some(view) = ctx.view_aabb { if aabb_disjoint_xy(local, view) { @@ -1383,7 +1378,6 @@ fn emit_wire( if lw.points.is_empty() && lw.fill_tris.is_empty() { return; } - let [ox, oy, oz] = [0.0_f64; 3]; let [lo_x, lo_y, lo_z] = defn_lo; // Resolve final style for this LocalWire against the outer Insert ctx @@ -1471,12 +1465,12 @@ fn emit_wire( p[1] as f64 + pl[1] as f64 + lo_y, p[2] as f64 + pl[2] as f64 + lo_z, )); - let qx = (v.x - ox) as f32; - let qy = (v.y - oy) as f32; - let qz = (v.z - oz) as f32; - let qx_l = ((v.x - ox) - qx as f64) as f32; - let qy_l = ((v.y - oy) - qy as f64) as f32; - let qz_l = ((v.z - oz) - qz as f64) as f32; + let qx = (v.x) as f32; + let qy = (v.y) as f32; + let qz = (v.z) as f32; + let qx_l = ((v.x) - qx as f64) as f32; + let qy_l = ((v.y) - qy as f64) as f32; + let qz_l = ((v.z) - qz as f64) as f32; let q = [qx, qy, qz]; if qx < entry.min_x { entry.min_x = qx; @@ -1501,7 +1495,7 @@ fn emit_wire( p[1] as f64 + lo_y, p[2] as f64 + lo_z, )); - entry.key_vertices.push([v.x - ox, v.y - oy, v.z - oz]); + entry.key_vertices.push([v.x, v.y, v.z]); } for (p, hint) in &lw.snap_pts { let v = accum_xform.apply(Vector3::new( @@ -1510,7 +1504,7 @@ fn emit_wire( p.z as f64 + lo_z, )); entry.snap_pts.push(( - glam::DVec3::new(v.x - ox, v.y - oy, v.z - oz), + glam::DVec3::new(v.x, v.y, v.z), *hint, )); } @@ -1527,7 +1521,7 @@ fn emit_wire( )); entry .fill_tris - .push([(v.x - ox) as f32, (v.y - oy) as f32, (v.z - oz) as f32]); + .push([(v.x) as f32, (v.y) as f32, (v.z) as f32]); } } @@ -1537,7 +1531,6 @@ fn transform_tangent( t: &Transform, defn_lo: [f64; 3], ) -> TangentGeom { - let [ox, oy, oz] = [0.0_f64; 3]; let [lo_x, lo_y, lo_z] = defn_lo; match tg { TangentGeom::Line { p1, p2 } => { @@ -1552,8 +1545,8 @@ fn transform_tangent( p2[2] as f64 + lo_z, )); TangentGeom::Line { - p1: [(q1.x - ox) as f32, (q1.y - oy) as f32, (q1.z - oz) as f32], - p2: [(q2.x - ox) as f32, (q2.y - oy) as f32, (q2.z - oz) as f32], + p1: [(q1.x) as f32, (q1.y) as f32, (q1.z) as f32], + p2: [(q2.x) as f32, (q2.y) as f32, (q2.z) as f32], } } TangentGeom::Circle { center, radius } => { @@ -1567,7 +1560,7 @@ fn transform_tangent( let sy = ((m[1][0] * m[1][0] + m[1][1] * m[1][1] + m[1][2] * m[1][2]) as f64).sqrt(); let s = ((sx + sy) * 0.5) as f32; TangentGeom::Circle { - center: [(c.x - ox) as f32, (c.y - oy) as f32, (c.z - oz) as f32], + center: [(c.x) as f32, (c.y) as f32, (c.z) as f32], radius: radius * s, } } diff --git a/src/scene/convert/tessellate.rs b/src/scene/convert/tessellate.rs index c7bdf9f4f..feba76ea2 100644 --- a/src/scene/convert/tessellate.rs +++ b/src/scene/convert/tessellate.rs @@ -145,9 +145,8 @@ pub fn tessellate( // single MTEXT can hand back N colour-distinct wires when the // value mixes inline colours. TruckObject::Text(stroke_groups) => { - let [ox, oy, oz] = [0.0_f64; 3]; let entity_zf = entity_z(entity) as f64; - let elev_v = entity_zf - oz; + let elev_v = entity_zf; // anno_scale anchors at the first group's origin so multi-line // MText lines spread apart correctly as they grow. @@ -155,8 +154,8 @@ pub fn tessellate( .first() .map(|g| g.origin) .unwrap_or([0.0, 0.0]); - let ref_lx_v = ref_origin[0] - ox; - let ref_ly_v = ref_origin[1] - oy; + let ref_lx_v = ref_origin[0]; + let ref_ly_v = ref_origin[1]; // Selection forces a single uniform colour — never split. let split_by_color = !selected; @@ -179,8 +178,8 @@ pub fn tessellate( let anno = anno_scale as f64; for group in &stroke_groups { - let lx_v = group.origin[0] - ox; - let ly_v = group.origin[1] - oy; + let lx_v = group.origin[0]; + let ly_v = group.origin[1]; let slx_v = (lx_v - ref_lx_v) * anno + ref_lx_v; let sly_v = (ly_v - ref_ly_v) * anno + ref_ly_v; let bin_key = if split_by_color { group.color } else { None }; @@ -213,7 +212,7 @@ pub fn tessellate( let key_vertices: Vec<[f64; 3]> = te .key_vertices .into_iter() - .map(|[x, y, z]| [x - ox, y - oy, z - oz]) + .map(|[x, y, z]| [x, y, z]) .collect(); // Empty input (no glyphs) → emit a single empty wire so the @@ -289,11 +288,10 @@ pub fn tessellate( TruckTessResult::Point([x, y, z], [xl, yl, zl]) => { let s = 0.1_f32; let snap_pts = te.snap_pts; - let [ox, oy, oz] = [0.0_f64; 3]; let key_vertices: Vec<[f64; 3]> = te .key_vertices .into_iter() - .map(|[kx, ky, kz]| [kx - ox, ky - oy, kz - oz]) + .map(|[kx, ky, kz]| [kx, ky, kz]) .collect(); return vec![WireModel { name, @@ -332,12 +330,11 @@ pub fn tessellate( if let TruckTessResult::Lines(points, points_low) = tessellate_edge(&e) { - let [ox, oy, oz] = [0.0_f64; 3]; let snap_pts = te.snap_pts; let key_vertices: Vec<[f64; 3]> = te .key_vertices .into_iter() - .map(|[x, y, z]| [x - ox, y - oy, z - oz]) + .map(|[x, y, z]| [x, y, z]) .collect(); return vec![WireModel { name, @@ -365,12 +362,11 @@ pub fn tessellate( if let TruckTessResult::Lines(points, points_low) = tessellate_wire(&w) { - let [ox, oy, oz] = [0.0_f64; 3]; let snap_pts = te.snap_pts; let key_vertices: Vec<[f64; 3]> = te .key_vertices .into_iter() - .map(|[x, y, z]| [x - ox, y - oy, z - oz]) + .map(|[x, y, z]| [x, y, z]) .collect(); return vec![WireModel { name, @@ -401,13 +397,12 @@ pub fn tessellate( // GPU shader pairs them so drawings at large UTM-style // coordinates keep sub-unit precision in the wire model and // don't jitter on camera movement. - let [ox, oy, oz] = [0.0_f64; 3]; let (local_pts, local_pts_low) = points_to_ds(points); let snap_pts = te.snap_pts; let key_vertices: Vec<[f64; 3]> = te .key_vertices .into_iter() - .map(|[x, y, z]| [x - ox, y - oy, z - oz]) + .map(|[x, y, z]| [x, y, z]) .collect(); let (fill_tris, fill_tris_low) = points_to_ds(te.fill_tris); return vec![WireModel { @@ -432,13 +427,12 @@ pub fn tessellate( } TruckObject::SegmentedLines(points) => { - let [ox, oy, oz] = [0.0_f64; 3]; let (local_pts, local_pts_low) = points_to_ds(points); let snap_pts = te.snap_pts; let key_vertices: Vec<[f64; 3]> = te .key_vertices .into_iter() - .map(|[x, y, z]| [x - ox, y - oy, z - oz]) + .map(|[x, y, z]| [x, y, z]) .collect(); return vec![WireModel { name, @@ -470,9 +464,8 @@ pub fn tessellate( let wire_pts = solid_wire_fallback(entity); let mut wm = WireModel::solid_f64(name, wire_pts, color, selected); // Add insertion snap at point_of_reference. - let [ox, oy, oz] = [0.0_f64; 3]; if let Some(p) = crate::entities::solid3d::point_of_reference(entity) { - let sp = glam::DVec3::new(p.x - ox, p.y - oy, p.z - oz); + let sp = glam::DVec3::new(p.x, p.y, p.z); wm.snap_pts.push((sp, SnapHint::Insertion)); } return vec![wm]; @@ -706,9 +699,8 @@ fn fallback_geometry(entity: &EntityType) -> Geometry { let pts = solid_wire_fallback(entity); let mut snap = vec![]; if let Some(p) = crate::entities::solid3d::point_of_reference(entity) { - let [ox, oy, oz] = [0.0_f64; 3]; snap.push(( - Vec3::new((p.x - ox) as f32, (p.y - oy) as f32, (p.z - oz) as f32), + Vec3::new((p.x) as f32, (p.y) as f32, (p.z) as f32), SnapHint::Insertion, )); } @@ -727,7 +719,6 @@ fn fallback_geometry(entity: &EntityType) -> Geometry { /// ACIS data. We use this as a visible fallback when the SAT tessellator /// produces no mesh (e.g. binary SAB data or unsupported geometry). fn solid_wire_fallback(entity: &EntityType) -> Vec<[f64; 3]> { - let [ox, oy, oz] = [0.0_f64; 3]; let Some(wires) = crate::entities::solid3d::fallback_wires(entity) else { return vec![]; }; @@ -741,7 +732,7 @@ fn solid_wire_fallback(entity: &EntityType) -> Vec<[f64; 3]> { continue; } for v in &wire.points { - pts.push([v.x - ox, v.y - oy, v.z - oz]); + pts.push([v.x, v.y, v.z]); } // NaN sentinel separates distinct wire segments. pts.push([f64::NAN, f64::NAN, f64::NAN]);