001    /*
002     * BellFilter
003     * 
004     * Copyright (c) 2002 Marco Schmidt.
005     * All rights reserved.
006     */
007    
008    package net.sourceforge.jiu.geometry;
009    
010    /**
011     * A Bell resample filter.
012     * @author Marco Schmidt
013     * @since 0.10.0
014     * @see Resample
015     * @see ResampleFilter
016     */
017    public class BellFilter extends ResampleFilter
018    {
019            public float apply(float value)
020            {
021                    if (value < 0.0f)
022                    {
023                            value = - value;
024                    }
025                    if (value < 0.5f)
026                    {
027                            return 0.75f - (value * value);
028                    }
029                    else
030                    if (value < 1.5f)
031                    {
032                            value = value - 1.5f;
033                            return 0.5f * (value * value);
034                    }
035                    else
036                    {
037                            return 0.0f;
038                    }
039            }
040    
041            public String getName()
042            {
043                    return "Bell";
044            }
045    
046            public float getRecommendedSamplingRadius()
047            {
048                    return 1.5f;
049            }
050    }