// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.worldgen.cave.shape.distorted;

import com.hypixel.hytale.procedurallib.logic.GeneralNoise;
import com.hypixel.hytale.server.worldgen.cave.CaveType;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.server.worldgen.util.bounds.IWorldBounds;

public interface DistortedShape extends IWorldBounds
{
    Vector3d getStart();
    
    Vector3d getEnd();
    
    Vector3d getAnchor(final Vector3d p0, final double p1, final double p2, final double p3);
    
    default boolean hasGeometry() {
        return this.getHighBoundX() > this.getLowBoundX() && this.getHighBoundY() > this.getLowBoundY() && this.getHighBoundZ() > this.getLowBoundZ();
    }
    
    double getProjection(final double p0, final double p1);
    
    boolean isValidProjection(final double p0);
    
    double getYAt(final double p0);
    
    double getWidthAt(final double p0);
    
    double getHeightAt(final double p0);
    
    double getHeightAtProjection(final int p0, final double p1, final double p2, final double p3, final double p4, final CaveType p5, final ShapeDistortion p6);
    
    default double getCeiling(final double x, final double z, final double centerY, final double height) {
        return centerY + height;
    }
    
    default double getFloor(final double x, final double z, final double centerY, final double height) {
        return centerY - height;
    }
    
    public interface Factory
    {
        public static final GeneralNoise.InterpolationFunction DEFAULT_INTERPOLATION = GeneralNoise.InterpolationMode.LINEAR.function;
        
        DistortedShape create(final Vector3d p0, final Vector3d p1, final double p2, final double p3, final double p4, final double p5, final double p6, final double p7, final double p8, final GeneralNoise.InterpolationFunction p9);
        
        default DistortedShape create(final Vector3d origin, final Vector3d direction, final double length, final double startWidth, final double startHeight, final double midWidth, final double midHeight, final double endWidth, final double endHeight) {
            return this.create(origin, direction, length, startWidth, startHeight, midWidth, midHeight, endWidth, endHeight, Factory.DEFAULT_INTERPOLATION);
        }
        
        default DistortedShape create(final Vector3d origin, final Vector3d direction, final double length, final double startWidth, final double startHeight, final double endWidth, final double endHeight, final GeneralNoise.InterpolationFunction interpolation) {
            final double midWidth = (startWidth + endWidth) * 0.5;
            final double midHeight = (startHeight + endHeight) * 0.5;
            return this.create(origin, direction, length, startWidth, startHeight, midWidth, midHeight, endWidth, endHeight, interpolation);
        }
        
        default DistortedShape create(final Vector3d origin, final Vector3d direction, final double length, final double startWidth, final double startHeight, final double endWidth, final double endHeight) {
            return this.create(origin, direction, length, startWidth, startHeight, endWidth, endHeight, Factory.DEFAULT_INTERPOLATION);
        }
        
        default DistortedShape create(final Vector3d origin, final Vector3d direction, final double length, final double width, final double height, final GeneralNoise.InterpolationFunction interpolation) {
            return this.create(origin, direction, length, width, height, width, height, width, height, interpolation);
        }
    }
}
