Files
vpn-dns-gateway/demo/tikzrefinery/code/src/geometry/ShapeGeometryLimits.h
T
vsun1 27b82c169e
vpn-dns-gateway/pipeline/head This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good
Add frozen TikZRefinery demo baseline and build pipeline
2026-11-25 22:46:33 -05:00

35 lines
1.4 KiB
C++

#pragma once
#include "model/EditorTypes.h"
#include "ShapeTypes.h"
namespace TikzRefinery {
// Shared with parsing: gesture bounds must include the same ink envelope.
struct ShapeGeometryLimits
{
static constexpr qreal rMinimumRectangleCentimeters = ShapeApi::rMinimumRectangleCentimeters;
static constexpr int iCoordinateDecimals = ShapeApi::iCoordinateDecimals;
static constexpr qreal rCoordinateStepsPerCentimeter = ShapeApi::rCoordinateStepsPerCentimeter;
static constexpr qreal rCentimetersPerInch = 2.54;
static constexpr qreal rTexPointsPerInch = 72.27;
static constexpr qreal rHalfStroke = 0.5;
static constexpr qreal rArrowTipBasePoints = 0.28;
static constexpr qreal rArrowTipWidthFactor = 0.3;
static constexpr qreal rArrowTipSpanFactor = 4.0;
static constexpr qreal rArrowStrokeFactor = 0.4;
};
inline qreal outlineMarginCentimeters(const ElementRecord &element)
{
using Limits = ShapeGeometryLimits;
const qreal rEnvelopePoints = element.elementKind == ElementKind::Arrow
? Limits::rArrowTipSpanFactor * (Limits::rArrowTipBasePoints
+ Limits::rArrowTipWidthFactor * element.rLineWidthPoints)
+ Limits::rArrowStrokeFactor * element.rLineWidthPoints
: Limits::rHalfStroke * element.rLineWidthPoints;
return rEnvelopePoints * Limits::rCentimetersPerInch / Limits::rTexPointsPerInch;
}
} // namespace TikzRefinery