USTRUCT(BlueprintType) struct MPBASE_API FGeoCorners { GENERATED_BODY() UPROPERTY(EditAnywhere, Cate...

这是一段 Unreal Engine 代码,定义了两个结构体:FGeoCornersFGeoBoundingBox

FGeoCorners 结构体包含了四个属性:UpLeftUpRightDownLeftDownRight,这些属性是类型为 FGeoPosition 的结构体。它还包含一个名为 ToBoundingBox 的函数,用于转换为 FGeoBoundingBox 类型的结构体。

FGeoBoundingBox 结构体包含了两个属性:MinLocationMaxLocation,这些属性也是类型为 `FGeo

USTRUCT(BlueprintType) struct MPBASE_API FGeoCorners { GENERATED_BODY() UPROPERTY(EditAnywhere, Category = "GeoTypes | Corners") FGeoPosition UpLeft; UPROPERTY(EditAnywhere, Category = "GeoTypes | Corners") FGeoPosition UpRight; UPROPERTY(EditAnywhere, Category = "GeoTypes | Corners") FGeoPosition DownLeft; UPROPERTY(EditAnywhere, Category = "GeoTypes | Corners") FGeoPosition DownRight; FGeoBoundingBox ToBoundingBox() const; }; USTRUCT(BlueprintType) struct MPBASE_API FGeoBoundingBox { GENERATED_BODY() UPROPERTY(EditAnywhere, Category = "GeoTypes | BoundingBox") FGeoPosition MinLocation; UPROPERTY(EditAnywhere, Category = "GeoTypes | BoundingBox") FGeoPosition MaxLocation; FGeoBoundingBox() = default; FGeoBoundingBox(double minx, double miny, double maxx, double maxy) : MinLocation(minx, miny), MaxLocation(maxx, maxy) { } FGeoBoundingBox(const FGeoPosition&amp; minLoc, const FGeoPosition&amp; maxLoc) : MinLocation(minLoc), MaxLocation(maxLoc) { } bool IsValid() const { return MinLocation.IsValid() &amp;&amp; MaxLocation.IsValid() &amp;&amp; MinLocation <= MaxLocation; } bool Contains(const FGeoPosition&amp; location) const { return location.Longitude >= MinLocation.Longitude &amp;&amp; location.Latitude >= MinLocation.Latitude &amp;&amp; location.Longitude <= MaxLocation.Longitude &amp;&amp; location.Latitude <= MaxLocation.Latitude; } FGeoBoundingBox&amp; operator+=(const FGeoPosition&amp; Location); FGeoBoundingBox&amp; operator+=(const FGeoBoundingBox&amp; GeoBox); bool Intersect(const FGeoBoundingBox&amp; Other) const; bool Contains(const FGeoBoundingBox&amp; Other) const; FGeoBoundingBox Intersection(const FGeoBoundingBox&amp; Other) const; bool IsInside(const FGeoPosition &amp; TestPoint) const { return ((TestPoint.Longitude > MinLocation.Longitude) &amp;&amp; (TestPoint.Longitude < MaxLocation.Longitude) &amp;&amp; (TestPoint.Latitude > MinLocation.Latitude) &amp;&amp; (TestPoint.Latitude < MaxLocation.Latitude)); } bool IsInside(const FGeoBoundingBox&amp; Other) const { return (IsInside(Other.MinLocation) &amp;&amp; IsInside(Other.MaxLocation)); } FGeoPosition GetCenter() const; FGeoCorners ToCorners() const; double GetDeltaLongitude() const { return MaxLocation.Longitude - MinLocation.Longitude; } double GetDeltaLatitude() const { return MaxLocation.Latitude - MinLocation.Latitude; } };代码含义
02-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值