001 /* 002 * BoxFilter 003 * 004 * Copyright (c) 2002 Marco Schmidt. 005 * All rights reserved. 006 */ 007 008 package net.sourceforge.jiu.geometry; 009 010 /** 011 * A box filter (also known as nearest neighbor). 012 * @author Marco Schmidt 013 * @since 0.10.0 014 * @see Resample 015 * @see ResampleFilter 016 */ 017 public class BoxFilter extends ResampleFilter 018 { 019 public float apply(float value) 020 { 021 if (value > -0.5f && value <= 0.5f) 022 { 023 return 1.0f; 024 } 025 else 026 { 027 return 0.0f; 028 } 029 } 030 031 public String getName() 032 { 033 return "Box"; 034 } 035 036 public float getRecommendedSamplingRadius() 037 { 038 return 0.5f; 039 } 040 }