Package edu.tufts.hrilab.map
Class PixelMap
java.lang.Object
edu.tufts.hrilab.map.PixelMap
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSemanticLabel
(String semanticType, Integer pixelColor) Add semantic label with corresponding pixel color.List<javax.vecmath.Point2d>
getConnectedComponents
(int px, int py, boolean isPortal) gets a list of all pixels that neighbor the specified pixelcom.google.common.graph.EndpointPair<javax.vecmath.Point2d>
getDoorPoints
(MapObject door) gets the boundaries of the door as min and max x and ygetMapObjectFromId
(int id) Get MapObject from unique ID.getMapObjectFromPixel
(int px, int py) Gets a MapObject based on single pixel location.int
getPixelValue
(javax.vecmath.Point3d p) Gets the map value at a location in meters.double
getPortalNormalAngle
(MapObject portal) gets the angle of the normal vector protuding from a portalfloat
Get PGM map resolution (pixels/meter).boolean
isExistingMapObjectPixel
(int px, int py) Check if pixel is part of an existing MapObject.boolean
queries if a object type is a portal typevoid
parseMapYAML
(String filename) parses the map metadata YAML to load metadatajavax.vecmath.Point3d
toMeter
(javax.vecmath.Point2d p) converts a point in pixels to a point in meter coordinates based on the metadata provided by the map's yaml filejavax.vecmath.Point2d
toPixel
(javax.vecmath.Point3d p) converts a point in meters to a point in pixel coordinates based on the metadata provided by the map's yaml file
-
Constructor Details
-
PixelMap
public PixelMap(int floorNumber)
-
-
Method Details
-
getResolution
public float getResolution()Get PGM map resolution (pixels/meter).- Returns:
-
getMapObjectFromId
Get MapObject from unique ID. This should be the same ID used in references.- Parameters:
id
-- Returns:
-
isExistingMapObjectPixel
public boolean isExistingMapObjectPixel(int px, int py) Check if pixel is part of an existing MapObject.- Parameters:
px
-py
-- Returns:
-
getMapObjectFromPixel
Gets a MapObject based on single pixel location.- Parameters:
px
-py
-- Returns:
-
getPortalNormalAngle
gets the angle of the normal vector protuding from a portal- Parameters:
portal
- portal to get angle of- Returns:
- angle in radians
-
getDoorPoints
gets the boundaries of the door as min and max x and y- Parameters:
door
- MapObject door to get the points of- Returns:
- Two points, the first which represents the smallest x and y the door occupies, the next point representing the largest x and y
-
getConnectedComponents
gets a list of all pixels that neighbor the specified pixel- Parameters:
px
- x coordinate of pixelpy
- y coordinate of pixel- Returns:
- List of points that neighbors the pixel at px, py
-
isPortal
queries if a object type is a portal type- Parameters:
type
- Object type- Returns:
- true if color is of a portal type, false otherwise
-
getPixelValue
public int getPixelValue(javax.vecmath.Point3d p) Gets the map value at a location in meters.- Parameters:
p
- - Point in meters to get value of- Returns:
- pixel value
-
toMeter
public javax.vecmath.Point3d toMeter(javax.vecmath.Point2d p) converts a point in pixels to a point in meter coordinates based on the metadata provided by the map's yaml file- Parameters:
p
- Point in pixel-space to be converted- Returns:
- Point in meter-space
-
toPixel
public javax.vecmath.Point2d toPixel(javax.vecmath.Point3d p) converts a point in meters to a point in pixel coordinates based on the metadata provided by the map's yaml file- Parameters:
p
- Point in meter-space to be converted- Returns:
- Point in pixel-space
-
addSemanticLabel
Add semantic label with corresponding pixel color. -
parseMapYAML
parses the map metadata YAML to load metadata
-