function applyOffsets(boat, curve, key) {
    // Define offsets
    let lengthOffset = key.toLowerCase().includes('aft') ? -boat.length : boat.length;
    let heightOffset = key.toLowerCase().includes('beam') ? boat.height : -boat.height;
    const widthOffset = key.toLowerCase().includes('keel') ? 0 : boat.width;

    if (key.toLowerCase().includes('frame')) {
        heightOffset = boat.height;
    }
    if (key.toLowerCase().includes('mid')) {
        lengthOffset = 0;
    }

    // Apply offsets
    const curveCoordinates = curve;
    if (! key.toLowerCase().includes('edge')) {
        curveCoordinates.start[0] += widthOffset;
    }
    curveCoordinates.end[0] += widthOffset;

    curveCoordinates.start[1] += heightOffset;
    if (key.toLowerCase().includes('frame')) {
        heightOffset = -heightOffset;
    }
    curveCoordinates.end[1] += heightOffset;

    curveCoordinates.end[2] += lengthOffset;
    if (key.toLowerCase().includes('edge') || key.toLowerCase().includes('frame')) {
        curveCoordinates.start[2] += lengthOffset;
    }
    return curveCoordinates;
}
// as well as positional offsets for the curve controls.
as well as positional offsets for the curve controls.
as well as positional offsets for the curve controls .
function applyOffsets(boat, curve, key) {
    let lengthOffset = key.toLowerCase().includes('aft') ? -boat.length : boat.length;
    let heightOffset = key.toLowerCase().includes('beam') ? boat.height : -boat.height;
    const widthOffset = key.toLowerCase().includes('keel') ? 0 : boat.width;
    if (key.toLowerCase().includes('frame')) {
        heightOffset = boat.height;
    }
    if (key.toLowerCase().includes('mid')) {
        lengthOffset = 0;
    }
    const curveCoordinates = curve;
    if (! key.toLowerCase().includes('edge')) {
        curveCoordinates.start[0] += widthOffset;
    }
    curveCoordinates.end[0] += widthOffset;
    curveCoordinates.start[1] += heightOffset;
    if (key.toLowerCase().includes('frame')) {
        heightOffset = -heightOffset;
    }
    curveCoordinates.end[1] += heightOffset;
    curveCoordinates.end[2] += lengthOffset;
    if (key.toLowerCase().includes('edge') || key.toLowerCase().includes('frame')) {
        curveCoordinates.start[2] += lengthOffset;
    }
    return curveCoordinates;
}
function applyOffsets ( boat , curve , key ) { let lengthOffset = key . toLowerCase ( ) . includes ( 'aft' ) ? - boat . length : boat . length ; let heightOffset = key . toLowerCase ( ) . includes ( 'beam' ) ? boat . height : - boat . height ; const widthOffset = key . toLowerCase ( ) . includes ( 'keel' ) ? 0 : boat . width ; if ( key . toLowerCase ( ) . includes ( 'frame' ) ) { heightOffset = boat . height ; } if ( key . toLowerCase ( ) . includes ( 'mid' ) ) { lengthOffset = 0 ; } const curveCoordinates = curve ; if ( ! key . toLowerCase ( ) . includes ( 'edge' ) ) { curveCoordinates . start [ 0 ] += widthOffset ; } curveCoordinates . end [ 0 ] += widthOffset ; curveCoordinates . start [ 1 ] += heightOffset ; if ( key . toLowerCase ( ) . includes ( 'frame' ) ) { heightOffset = - heightOffset ; } curveCoordinates . end [ 1 ] += heightOffset ; curveCoordinates . end [ 2 ] += lengthOffset ; if ( key . toLowerCase ( ) . includes ( 'edge' ) || key . toLowerCase ( ) . includes ( 'frame' ) ) { curveCoordinates . start [ 2 ] += lengthOffset ; } return curveCoordinates ; }
as well as positional offsets for the curve controls.
as well as positional offsets for the curve controls .
// Define offsets // Apply offsets