import '../../../globals.js';
// Copyright 2023-2024, University of Colorado Boulder
/**
 * Represents the state passed through RenderProgram evaluation
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import Bounds2 from '../../../dot/js/Bounds2.js';
import Vector2 from '../../../dot/js/Vector2.js';
import { alpenglow, PolygonalFace } from '../imports.js';
export default class RenderEvaluationContext {
    constructor() {
        // if null AND we have a need set for a face, it is fully covered
        this.face = null;
        // TODO: documentation!
        this.area = 0;
        this.centroid = new Vector2(0, 0);
        this.minX = 0;
        this.minY = 0;
        this.maxX = 0;
        this.maxY = 0;
    }
    set(face, area, centroid, minX, minY, maxX, maxY) {
        this.face = face;
        this.area = area;
        this.centroid.set(centroid);
        this.minX = minX;
        this.minY = minY;
        this.maxX = maxX;
        this.maxY = maxY;
        return this;
    }
    getFace() {
        return this.face ? this.face : PolygonalFace.fromBoundsValues(this.minX, this.minY, this.maxX, this.maxY);
    }
    getBounds() {
        return new Bounds2(this.minX, this.minY, this.maxX, this.maxY);
    }
    getCenterX() {
        return (this.minX + this.maxX) / 2;
    }
    getCenterY() {
        return (this.minY + this.maxY) / 2;
    }
    hasArea() {
        return isFinite(this.area);
    }
    hasCentroid() {
        return this.centroid.isFinite();
    }
    writeBoundsCentroid(centroid) {
        centroid.setXY((this.minX + this.maxX) / 2, (this.minY + this.maxY) / 2);
        return centroid;
    }
}
alpenglow.register('RenderEvaluationContext', RenderEvaluationContext);
//# sourceMappingURL=RenderEvaluationContext.js.map