001package com.fs.starfarer.api.combat; 002 003import java.util.List; 004 005import org.lwjgl.util.vector.Vector2f; 006 007/** 008 * The bounds HAVE to be a polygon - can't just be a disconnected set of segments. 009 * 010 * The polygon can be either concave or convex. 011 * 012 * 013 * @author Alex Mosolov 014 * 015 * Copyright 2012 Fractal Softworks, LLC 016 */ 017public interface BoundsAPI { 018 public interface SegmentAPI { 019 Vector2f getP1(); 020 Vector2f getP2(); 021 void set(float x1, float y1, float x2, float y2); 022 } 023 024 /** 025 * Updates the coordinates of the bounds to reflect the specified location and facing. 026 */ 027 void update(Vector2f location, float facing); 028 029 List<SegmentAPI> getSegments(); 030 031 032 /** 033 * Remove all segments. 034 */ 035 void clear(); 036 037 /** 038 * Add a new segment. Coordinates are relative to entity center, with entity facing 0 degrees (i.e., to the right). 039 * @param x1 040 * @param y1 041 * @param x2 042 * @param y2 043 */ 044 void addSegment(float x1, float y1, float x2, float y2); 045 046 /** 047 * Adds a segment using the end of the previously added segment as the starting point. 048 * @param x2 049 * @param y2 050 */ 051 void addSegment(float x2, float y2); 052 053 List<SegmentAPI> getOrigSegments(); 054}