/* voxb_splat_tube.h --- voxel-based modeling of tubes and ropes */ /* Last edited on 2021-06-22 13:47:04 by jstolfi */ #ifndef voxb_splat_tube_H #define voxb_splat_tube_H #define _GNU_SOURCE #include #include #include #include #include #include #include /* SPLATTING TUBES, ROPES, ETC Each procedure in this section splats into the tomogram {A} an object obtained by sweeping a /brush/ along a path. The path is densely sampled so that no part of the brush moves more than a fraction of a voxel between samples. A copy of the brush is positioned at each sample point, and turned so that a fixed axis of it is tangent to the direction of travel. These copies of the brush are then united (by taking the max of their occupancy functions) to generate the worm object. If {sub} is false, the brush is a torus with outer radius {otR} and hole radius {inR}, so that the worm is a tube with outer radius {otR} and inner radius {inR}. The tube is united (splatted with {voxb_op_OR}) with the objects already in {A}. If {sub} is true, the brush is a sphere with radius {inR}, so that the worm is a wire with radius {inR}. The wire is subtracted (splatted with {voxb_op_SUB}) from the objects already in {A}. This is useful to ensure that the bore of a tube is clear even if it crosses other objects. */ void voxb_splat_tube_round_helix ( ppv_array_t *A, double t0, double t1, r3_motion_state_t *S, double len, double ang, double hht, double inR, double otR, bool_t sub, r3_motion_state_t *S0, r3_motion_state_t *S1 ); /* The midline is an arc of helix, generated by {r3_motion_helix(t,len,ang,hht)} where {t} ranges from {t0} to {t1}. When {t} is zero, the path goes through the point {S.p}. The spiral's axis will be parallel to {S.w}, and the axis is located {len/ang} units from {S.p} in the direction of {S.v}. The vector {S.u} will be tangent to the tube's midline (unless {hht} is zero), but is orthogonal to the spiral axis and tangent to the enclosing cylinder at {S.p}. Also returns in {*S0} and {*S1} (if they are not NULL) the first and last tangent states of the tube, with row 0 of the pose matrix tangent to the helix, row 1 pointing straight towards the helix axis, and row 2 perpendicular to both (not parallel to the helix axis). */ void voxb_splat_tube_round_segment ( ppv_array_t *A, r3_path_state_t *S, r3_path_state_t *T, double inR, double otR, bool_t sub ); /* The midline starts with the path state {S} and ends with path state {T}. The velocity vector is interpreted as if the path was traversed in approximately unit time. */ void voxb_splat_tube_round_bezier ( ppv_array_t *A, r3_t *p0, r3_t *p1, r3_t *p2, r3_t *p3, double inR, double otR, bool_t sub ); /* The midline is a Bezier arc that starts at point {p0} moving towards {p1}, and ends at point {p3} as if coming straight from {p2}. */ #endif