[UE]碰撞和Trace检测

news2024/7/6 19:08:42

UE的碰撞和Trace检测

  • 基础概念
  • 碰撞相关概念
  • Overlap和Hit事件
    • 概念和条件
    • 使用示例
  • Trace检测
    • 引擎 World.h 中的Trace
    • UKismetSystemLibrary 中的 Trace
    • HitResult
    • Trace示例
      • LineTrace
      • SphereTraceSingle
      • BoxSweep
      • SphereTrace
      • CapsuleTrace
  • 记录
    • SetActorLocation中的Sweep和Teleport
    • 为啥打开物理模拟后 Actor会穿过地面

基础概念

UE物理引擎原理分析(一):碰撞检测World层

碰撞响应参考

UE4物理精粹Part 3:Collision

碰撞相关概念

碰撞概述
在这里插入图片描述
几个概念:

Simulate Physics:物理模拟,如果要触发Hit事件,这个属性需要设置True,
对应的C++函数为UPrimitiveComponent::SetSimulatePhysics(bool bSimulate)

Simulation Generates Hit Events:在开启物理模拟时,物体被撞击时是否触发事件,Hit事件和开启物理模拟强绑定,所以如果只想注册碰撞相关的事件,而不需要物理模拟时,不要用Hit Event,用Overlap吧。
对应的C++属性为FBodyInstance::bNotifyRigidBodyCollision,C++函数为:UPrimitiveComponent::SetNotifyRigidBodyCollision(bool bNewNotifyRigidBodyCollision)

Generate Overlap Events:开启才会有重叠事件产生

Collision Preset:一个碰撞预设会指定一个默认的Object Type和Collision Enabled类型

Collision Enabled:
No Collision-无碰撞
Physics Only-仅用于物理模拟
QueryOnly(No Physics Collision):仅开启查询
CollisionEnabled(Query and Physics):开启查询和物理模拟

Object Type:对象类型
Object Responses: 对象响应类型,不同对象类型之间可以设定ignore、Overlap、Block三种响应类型
只要有一个物体将碰撞对象设置为Ignore,碰撞都不会触发任何事件或者物理现象。
只有两个物体之间都是Block时,碰撞时才会阻挡
如果一个物体Overlap,另外一个Block,则是Overlap

Overlap和Hit事件

概念和条件

[UE4]C++创建BoxCollision(BoxComponent)并注册Overlap和Hit事件回调函数

1.所有UPrimitiveComponent及其子类都可以产生Overlap和Hit事件
UPrimitiveComponent :拥有几何表示的场景组件,用于渲染视觉元素或与物理对象发生碰撞或重叠。

2.除了在每个UPrimitiveComponent及其子类对象上可以产生Overlap和Hit事件,还有直接在Actor上产生Overlap和Hit事件,
What is the difference between OnActorHit and OnComponentHit?

当一个Actor有多个PrimitiveComponent组件时,每个PrimitiveComponent组件都有自己的碰撞体积,它们可以单独检测碰撞。
但是,当Actor整体发生碰撞时,引擎会根据Actor的所有PrimitiveComponent组件的碰撞体积来计算整个Actor的碰撞。

  1. 产生Overlap 的条件

1.1 首先 两个物体都要选中 Generate Overlap Events
1.2 其次 最少有一个物体的碰撞设置为Overlap 另一个物体需要为Overlap 或者 Block 都可以触发

  1. 产生Hit 的条件

2.1 首先 需要响应Hit事件的物体 必须选中了Simulation GeneratesHitEvents,对应的C++属性叫做FBodyInstance::bNotifyRigidBodyCollision,C++函数叫:UPrimitiveComponent::SetNotifyRigidBodyCollision(bool bNewNotifyRigidBodyCollision)
2.2 有一个物体必须选中SimulatePhysis,对应的C++函数:UPrimitiveComponent::SetSimulatePhysics(bool bSimulate)
2.3 两个物体的CollisionEnable 必须有Physics Collisiion
2.4 两个物体的碰撞属性必须都互相为Block

使用示例

1.UPrimitiveComponent及其子类的Overlap和Hit事件示例

// UPrimitiveComponent及其子类的Overlap和Hit事件示例
OnComponentBeginOverlap
OnComponentEndOverlap
OnComponentHit

AMyActor::AMyActor()
{
    PrimaryActorTick.bCanEverTick = true;
    CollisionComponent = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComponent"));
    CollisionComponent->BodyInstance.SetCollisionProfileName(TEXT("Projectile"));
    CollisionComponent->OnComponentBeginOverlap.AddDynamic(this, &AMyActor ::OnMyCompBegionOverlap);
	CollisionComponent->OnComponentEndOverlap.AddDynamic(this, &AMyActor ::OnMyCompEndOverlap);
    CollisionComponent->OnComponentHit.AddDynamic(this, &AMyActor::OnMyCompHit);
}

void AMyActor ::OnMyCompBegionOverlap(UPrimitiveComponent* OverlappedComponent,
									  AActor* OtherActor,    //触发时间的主体,通常是控制的人
		                              UPrimitiveComponent* OterComp,
		                              int32 OtherBodyIndex,
		                              bool bFromSweep,
		                              const FHitResult& SweepResult)
{
}

void AMyActor ::OnMyCompEndOverlap(UPrimitiveComponent* OverlappedComponent,
		                           AActor* OtherActor,
                                   UPrimitiveComponent* OtherComp,
                                   int32 OtherBodyIndex)
{
}

void AMyActor ::OnMyCompHit(UPrimitiveComponent* HitComponent,
                            AActor* OtherActor,
                            UPrimitiveComponent* OtherComponent,
                            FVector NormalImpulse,
                            const FHitResult& Hit)
{

}
或者
AMyOnComponentHit::AMyOnComponentHit()
{
	MyComp = CreateDefaultSubobject<UBoxComponent>(TEXT("BoxComp"));
	MyComp->SetSimulatePhysics(true);
    MyComp->SetNotifyRigidBodyCollision(true);
	MyComp->BodyInstance.SetCollisionProfileName("BlockAllDynamic");
	MyComp->OnComponentHit.AddDynamic(this, &AOnMyComponentHit::OnMyCompHit);
}
void AOnMyComponentHit::OnMyCompHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
}

2.Actor的Overlap和Hit事件示例

// Actor的Overlap和Hit事件示例
OnActorBeginOverlap
OnActorEndOverlap
OnActorHit

AMyActor::AMyActor()
{
    OnActorBeginOverlap.AddDynamic(this, &AMyActor::OnOverlap);
    OnActorHit.AddDynamic(this, &AMyActor::OnMyActorHit);
}
void AMyActor::OnOverlap(AActor* OverlappedActor, AActor* OtherActor)
{ 

}


void AMyActor::OnMyActorHit(AActor* SelfActor,
                            AActor* OtherActor,
                            FVector NormalImpulse,
                            const FHitResult& Hit)
{
	UE_LOG(LogTemp, Warning, TEXT("Actor %s hit %s at location %s with normal %s"), *SelfActor->GetName(), *OtherActor->GetName(), *Hit.ImpactPoint.ToString(), *Hit.ImpactNormal.ToString());
    //遍历了当前Actor的所有PrimitiveComponent组件,并与碰撞信息中的Component进行比较,以确定哪个组件发生了碰撞
    for (UPrimitiveComponent* Component : GetComponentsByClass(UPrimitiveComponent::StaticClass()))
    {
        if (Hit.Component == Component)
        {
            UE_LOG(LogTemp, Warning, TEXT("Hit component %s of actor %s"), *Component->GetName(), *SelfActor->GetName());
        }
    }
}



Trace检测

【UE4】LineTrace 功能详解
UE4的移动碰撞

引擎 World.h 中的Trace

Trace 类型有两种:LineTrace、SweepTrace
Trace 数量有两种: TraceSingle、TraceMulti
Trace 方式有三种:ByChannel、ByObjectType、ByProfile

【UE4 C++】 射线检测 LineTrace 及 BoxTrace、SphereTrace、CapsuleTrace API

(UE4 4.20)UE4 碰撞(Collision)之光线检测(RayTrace ) [详细测试了TraceSingle和TraceMulti的区别]

连续碰撞检测(CCD)介绍

UKismetSystemLibrary 中的 Trace

UKismetSystemLibrary 中的 Trace 有 LineTrace、BoxTrace、SphereTrace、CapsuleTrace 四种类型,每种又分为 xxxTraceSingle、xxxTraceMulti 两种。

UKismetSystemLibrary 里的 Trace 都是调用的 World 里的 Trace。调用对应关系如下:
在这里插入图片描述

也就是 UKismetSystemLibrary 里默认是 ByChannel,也有对应其他方式的,比如 UKismetSystemLibrary::LineTraceSingleForObjects 对应 World->LineTraceSingleByObjectType,其他同理。
  即 Line 对应 Line,其他对应 Sweep。

HitResult

UE4 微笔记 之 HitResult (持续更新)
射线检测的结果会存储在一个名为HitResult的结构体中。该结构体包含了与射线相交的物体、碰撞点、法向量等信息

USTRUCT(BlueprintType, meta = (HasNativeBreak = "Engine.GameplayStatics.BreakHitResult", HasNativeMake = "Engine.GameplayStatics.MakeHitResult"))
struct ENGINE_API FHitResult
{
    GENERATED_BODY()

    /** Face index we hit (for complex hits with triangle meshes). */
    //被击中物体表面上的三角形索引。当射线与一个静态网格碰撞时,该值将告诉您哪个三角形被命中
    UPROPERTY()
    int32 FaceIndex;

    /**
    * 'Time' of impact along trace direction (ranging from 0.0 to 1.0) if there is a hit, indicating time between TraceStart and TraceEnd.
    * For swept movement (but not queries) this may be pulled back slightly from the actual time of impact, to prevent precision problems with adjacent geometry.
    */
    UPROPERTY()
    float Time;
    
    /** The distance from the TraceStart to the Location in world space. This value is 0 if there was an initial overlap (trace started inside another colliding object). */
    // 起始位置到碰撞点之间的距离
    UPROPERTY()
    float Distance; 
    
    /**
    * The location in world space where the moving shape would end up against the impacted object, if there is a hit. Equal to the point of impact for line tests.
    * Example: for a sphere trace test, this is the point where the center of the sphere would be located when it touched the other object.
    * For swept movement (but not queries) this may not equal the final location of the shape since hits are pulled back slightly to prevent precision issues from overlapping another surface.
    */
    //被击中物体表面上的位置
    UPROPERTY()
    FVector_NetQuantize Location;

    /**
    * Location in world space of the actual contact of the trace shape (box, sphere, ray, etc) with the impacted object.
    * Example: for a sphere trace test, this is the point where the surface of the sphere touches the other object.
    * @note: In the case of initial overlap (bStartPenetrating=true), ImpactPoint will be the same as Location because there is no meaningful single impact point to report.
    */
    //碰撞点在世界坐标系下的位置
    UPROPERTY()
    FVector_NetQuantize ImpactPoint;
    
    /**
    * Normal of the hit in world space, for the object that was swept. Equal to ImpactNormal for line tests.
    * This is computed for capsules and spheres, otherwise it will be the same as ImpactNormal.
    * Example: for a sphere trace test, this is a normalized vector pointing in towards the center of the sphere at the point of impact.
    */
    // 碰撞表面法向量方向
    UPROPERTY()
    FVector_NetQuantizeNormal Normal;
    
    /**
    * Normal of the hit in world space, for the object that was hit by the sweep, if any.
    * For example if a sphere hits a flat plane, this is a normalized vector pointing out from the plane.
    * In the case of impact with a corner or edge of a surface, usually the "most opposing" normal (opposed to the query direction) is chosen.
    */
    UPROPERTY()
    FVector_NetQuantizeNormal ImpactNormal;
    
    /**
    * Start location of the trace.
    * For example if a sphere is swept against the world, this is the starting location of the center of the sphere.
    */
    // 追踪起点 
    UPROPERTY()
    FVector_NetQuantize TraceStart;

    /**
    * End location of the trace; this is NOT where the impact occurred (if any), but the furthest point in the attempted sweep.
    * For example if a sphere is swept against the world, this would be the center of the sphere if there was no blocking hit.
    */
    // 追踪终点  
    UPROPERTY()
    FVector_NetQuantize TraceEnd;
    
    /**
    * If this test started in penetration (bStartPenetrating is true) and a depenetration vector can be computed,
    * this value is the distance along Normal that will result in moving out of penetration.
    * If the distance cannot be computed, this distance will be zero.
    */
    //射线与被击中物体之间的穿透深度:指的是从射线命中点到物体表面最近点的距离
    UPROPERTY()
    float PenetrationDepth;
    
    /** If the hit result is from a collision this will have extra info about the item that hit the second item. */
    UPROPERTY()
    int32 MyItem;
    
    /** Extra data about item that was hit (hit primitive specific). */
    UPROPERTY()
    int32 Item;
    
    /** Index to item that was hit, also hit primitive specific. */
    UPROPERTY()
    uint8 ElementIndex;
    
    /** Indicates if this hit was a result of blocking collision. If false, there was no hit or it was an overlap/touch instead. */
    // True: 发生了碰撞,并且是blocking 
    // False: 发生了碰撞,但是overlap只重叠,不碰撞
    UPROPERTY()
    uint8 bBlockingHit : 1;

    /**
    * Whether the trace started in penetration, i.e. with an initial blocking overlap.
    * In the case of penetration, if PenetrationDepth > 0.f, then it will represent the distance along the Normal vector that will result in
    * minimal contact between the swept shape and the object that was hit. In this case, ImpactNormal will be the normal opposed to movement at that location
    * (ie, Normal may not equal ImpactNormal). ImpactPoint will be the same as Location, since there is no single impact point to report.
    */
    //表示射线是否从物体内部开始穿透。如果该值为true,则表示射线在物体内部,并且已经开始穿透;如果该值为false,则表示射线从物体外部击中
    UPROPERTY()
    uint8 bStartPenetrating : 1;
    
    /**
    * Physical material that was hit.
    * @note Must set bReturnPhysicalMaterial on the swept PrimitiveComponent or in the query params for this to be returned.
    */
    UPROPERTY()
    TWeakObjectPtr<class UPhysicalMaterial> PhysMaterial;
    
    /** Handle to the object hit by the trace. */
    UPROPERTY()
    FActorInstanceHandle HitObjectHandle;
    
    /** PrimitiveComponent hit by the trace. */
    UPROPERTY()
    TWeakObjectPtr<class UPrimitiveComponent> Component;
    
    /** Name of bone we hit (for skeletal meshes). */
    UPROPERTY()
    FName BoneName;
    
    /** Name of the _my_ bone which took part in hit event (in case of two skeletal meshes colliding). */
    UPROPERTY()
    FName MyBoneName;

...
}

Trace示例

注意:
如果自定义的TraceChannel枚举类型为A,在调用SphereTraceSingle指定TraceChannel参数为A,则需要确保要检测的Actor已经设置为允许被扫描通道A所包含。

LineTrace

//Called every frame
void AUnrealCPPCharacter::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	FHitResult OutHit;
	FVector Start = FP_Gun->GetComponentLocation();
	// alternatively you can get the camera location
	// FVector Start = FirstPersonCameraComponent->GetComponentLocation();

	FVector ForwardVector = FirstPersonCameraComponent->GetForwardVector();
	FVector End = ((ForwardVector * 1000.f) + Start);
	FCollisionQueryParams CollisionParams;

	DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1, 0, 1);
	if(GetWorld()->LineTraceSingleByChannel(OutHit, Start, End, ECC_Visibility, CollisionParams)) 
	{
		if(OutHit.bBlockingHit)
		{
			GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Red, FString::Printf(TEXT("You are hitting: %s"), *OutHit.GetActor()->GetName()));
			GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Red, FString::Printf(TEXT("Impact Point: %s"), *OutHit.ImpactPoint.ToString()));
			GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Red, FString::Printf(TEXT("Normal Point: %s"), *OutHit.ImpactNormal.ToString()));
		}
	}

}

SphereTraceSingle

SphereTraceSingle是一个用于在游戏中进行球形sweep检测的函数。它可以检测从指定位置发出的球形射线是否与场景中的任何物体相交,并返回最近相交点和相交物体信息。

TArray<FHitResult> OutHits;
FVector MyLocation = GetActorLocation();

// create a collision sphere
FCollisionShape MyColSphere = FCollisionShape::MakeSphere(500.0f);
// draw collision sphere
DrawDebugSphere(GetWorld(), GetActorLocation(), MyColSphere.GetSphereRadius(), 50, FColor::Cyan, true);
    
// check if something got hit in the sweep
// Sweep的开始位置和结束位置可以相同。。。
bool isHit = GetWorld()->SweepMultiByChannel(OutHits, MyLocation, MyLocation, FQuat::Identity, ECC_WorldStatic, MyColSphere);

BoxSweep

/*首先
创建了一个FCollisionQueryParams对象BoxParams,用于设置射线查询参数
SCENE_QUERY_STAT(FreeCam)表示使用FreeCam作为查询名称(用于统计性能数据),
false表示不需要复杂的碰撞检测(只需判断是否有阻挡即可),
this表示忽略当前Actor对象。
*/
CollisionQueryParams BoxParams(SCENE_QUERY_STAT(FreeCam), false, this);
/*OutVT.Target这个Actor被添加到忽略列表中,避免对结果产生影响*/
BoxParams.AddIgnoredActor(OutVT.Target);
FHitResult Result;

/*然后
调用GetWorld()->SweepSingleByChannel()方法进行射线查询
从Loc点向Pos点发射一条以ECC_Camera通道为类型、形状为12x12x12盒子的射线,并返回第一个被击中的物体信息(如果没有则返回空)
*/
GetWorld()->SweepSingleByChannel(Result, Loc, Pos, FQuat::Identity, ECC_Camera,
    FCollisionShape::MakeBox(FVector(12.f)), BoxParams);

/*最后
根据查询结果来更新OutVT.POV.Location和OutVT.POV.Rotation属性。
如果没有击中任何物体,则直接使用Pos作为自由相机位置;
否则使用Result.Location作为新位置(第一个被击中的物体信息)。
*/
OutVT.POV.Location = !Result.bBlockingHit ? Pos : Result.Location;
OutVT.POV.Rotation = Rotator;

SphereTrace

同BoxTrace

调用World->SweepSingleByChannel
参数换成FCollisionShape::MakeSphere

CapsuleTrace

同BoxTrace

调用World->SweepSingleByChannel
参数换成FCollisionShape::MakeCapsule

记录

SetActorLocation中的Sweep和Teleport

Sweep英文释义:Whether we sweep to the destination location,triggering overlaps along the way and stopping short of the target if blocked by something.
Only the root component is swept and checked for blocking collision,child components move without sweeping,if collision is off,this has no effect.

Sweep中文翻译:我们是否扫瞄到目标位置,触发沿途的重叠,如果被什么东西挡住就会停在目标附近。
只有根组件被清除和检查阻塞碰撞,子组件移动而不清除,如果Collision是关闭的,这没有影响。

Teleport英文释义:Whether we teleport the physics state(if physics collision is enabled for this object). if true,physics velocity for this object is unchanged(so ragdoll parts are not affected by change in location). If false,physics velocity is updated based on the change in position(affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire swept volume.

Teleport中文翻译:我们是否传送物理状态(如果这个对象启用了物理碰撞)。
如果为true,这个物体的物理速度是不变的(所以布偶部件不会受到位置变化的影响)。
如果为false,物理速度将根据位置的变化进行更新(影响布偶部件)。
如果CCD是开启的,而不是传送,这将影响沿整个扫描体积的物体。

Sweep与Teleport作用说明
Sweep用来阻止运动穿透,这个应该就是charactor不会穿透cube的原因
Teleport开启时,物体瞬间从一个位置移动到另一个位置,自身会产生一个很大的速度(瞬间移动时间很短,物理引擎正常会计算物体速度s/t,因为t很小,所以导致物体会有个很大的速度,teleport开启就不会计算这个自身的速度,物体瞬间移动后速度保持为0)

为啥打开物理模拟后 Actor会穿过地面

# 发现两个CapsuleComponent组成直接的父子关系时,最终会影响整体和其他物体的碰撞关系
# 下面的根组件和地面是Block, 但是不小心挂了一个CapsuleComponent子组件,和地面是ignore,会导致物体穿过地面。。。。
CapsuleComponent(根组件,和地面Block)
    Capsule Collision(也是CapsuleComponent组件,受击盒,和地面是ignore)

# 修改成下面的方式,就不会穿过地面了
CapsuleComponent(根组件,和地面Block)
    SkeletalMeshComponent
        Capsule Collision(受击盒,和地面是重叠)

注意:
UCLASS(ClassGroup="Collision", editinlinenew, hidecategories=(Object,LOD,Lighting,TextureStreaming), meta=(DisplayName="Capsule Collision", BlueprintSpawnableComponent))
class ENGINE_API UCapsuleComponent : public UShapeComponent
{
    GENERATED_UCLASS_BODY()
    ...
}
其中包含了多个类标记,具体含义如下:
ClassGroup="Collision":
	指定该组件属于“Collision”类别
hidecategories=(Object,LOD,Lighting,TextureStreaming):
	指定在编辑器中隐藏了“Object”、“LOD”、“Lighting”和“TextureStreaming”这几个类别。
meta=(DisplayName="Capsule Collision", BlueprintSpawnableComponent):
	指定一些额外的信息。其中,DisplayName用于指定在编辑器中显示的名称为“Capsule Collision”; BlueprintSpawnableComponent用于指定该组件可以在蓝图中创建。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1015858.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

CocosCreator3.8研究笔记(十九)CocosCreator UI组件(三)

前面的文章已经介绍了Layout 组件 、ScrollView 组件 、PageView 组件 。 想了解的朋友&#xff0c;请查看 CocosCreator3.8研究笔记&#xff08;十八&#xff09;CocosCreator UI组件&#xff08;二&#xff09;。 今天我们主要介绍CocosCreator 常用组件&#xff1a;Butt…

Windows 10 Enterprise LTSC 2021 (x86) - DVD (Chinese-Simplified)文件分享

Windows 10 Enterprise LTSC 2021 (x64) - DVD (Chinese-Simplified) SW_DVD9_WIN_ENT_LTSC_2021_64BIT_ChnSimp_MLF_X22-84402.ISO 镜像文件&#xff1a; 链接&#xff1a;https://pan.quark.cn/s/2f8f61ec4a98 Windows 10 Enterprise LTSC 2021 (x86) - DVD (Chinese-Simpli…

辐射威胁:揭示辐射对人体健康和肠道菌群的影响及防护

谷禾健康 辐射对人体的影响是一个长期以来备受关注的问题。长时间暴露在辐射环境下可能会导致细胞损伤、突变和癌症等健康问题。 辐射包括电离辐射&#xff08;X光机、CT、伽马刀、钴60治疗机、碘-131&#xff09;和非电离辐射&#xff08;手机辐射、微波炉、电热毯、高压电塔、…

LeetCode(力扣)968. 监控二叉树Python

LeetCode968. 监控二叉树 题目链接代码 题目链接 https://leetcode.cn/problems/binary-tree-cameras/description/ 代码 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val0, leftNone, rightNone): # self.val val # …

翻牌闯关游戏

翻牌闯关游戏 3关&#xff1a;关卡由少至多12格、20格、30格图案&#xff1a;12个玩法&#xff1a;点击两张卡牌&#xff0c;图案一到即可消除掉 记忆时长(毫秒)&#xff1a;memoryDurationTime:5000 可配置&#xff0c;默认5000 提示游戏玩法&#xff1a;showTipsFlag:1 可…

算法宝典2——Java版本(此系列持续更新,这篇文章目前3道)(有题目的跳转链接)(此份宝典包含了二叉树的算法题)

注&#xff1a;由于字数的限制&#xff0c;我打算把算法宝典做成一个系列&#xff0c;一篇文章就20题&#xff01;&#xff01;&#xff01; 目录 一、二叉树的算法题&#xff08;目前3道&#xff09; 1. 平衡二叉树&#xff08;力扣&#xff09; 2. 对称二叉树&#xff0…

合肥先进光源国家重大科技基础设施项目及配套工程启动会纪念

合肥先进光源国家重大科技基础设施项目及配套工程启动会纪念 卡西莫多 合肥长丰岗集里 肥鸭从此别泥塘 先平场地设围栏 进而工地筑基忙 光阴似箭指日争 源流汇智山水长 国器西北扩新地 家校又添新区园 重器托举有群力 大步穿梭两地间 科教兴邦大国策 技术盈身坦荡行…

Sourcetree 无法打开/闪退问题

Sourcetree在某次开机以后无法打开或者是闪退。 Sourcetree是一款Git的可视化图形管理界面,提供了Windows和Mac的免费Git客户端,很方便的管理项目的代码版本 出现问题的环境 win11&#xff0c;sourcTree版本&#xff1a;3.4.12.0 在开始菜单搜索sourcetree&#xff0c;打开…

Golang中的GMP调度模型

GMP调度模型 Golang调度器的由来 单进程时代不需要调度器 1.单一的执行流程&#xff0c;计算机只能一个任务一个任务处理。 2.进程阻塞所带来的CPU时间浪费。 后来操作系统就具有了最早的并发能力&#xff1a;多进程并发&#xff0c;当一个进程阻塞的时候&#xff0c;切换…

polygon yolo

[1] : github: https://github.com/HRan2004/Yolo-ArbPolygon [2] https://github.com/XinzeLee/PolygonObjectDetection [3] https://github.com/AlbinZhu/yolov7-polygon-detection 链接&#xff1a;https://pan.baidu.com/s/1Zpl1bIGfMli6p5LQdbET0w?pwddw2b 提取码&#…

C++之std::holds_alternative与std::get应用实例(二百一十九)

简介&#xff1a; CSDN博客专家&#xff0c;专注Android/Linux系统&#xff0c;分享多mic语音方案、音视频、编解码等技术&#xff0c;与大家一起成长&#xff01; 优质专栏&#xff1a;Audio工程师进阶系列【原创干货持续更新中……】&#x1f680; 人生格言&#xff1a; 人生…

Peppertype:AI写作工具

【产品介绍】 名称 Peppertype 具体描述 Peppertype是一款人工智能AI内容生成工具&#xff0c;它通过使用机器学习来理解用户的需求。适合在写作过程中寻求帮助的作家&#xff0c;而无需花时间自己学习如何使用。Peppertypeai支持快速制作电子邮件&#xff0c;30…

nginx 全相联结构的引申

修改 nginx 纯属巧合&#xff0c;任务是将 reuseport 的支持换一种方式。目前 nginx 的方式是 master 创建 worker 数量个 reuseport listening socket&#xff0c;由 worker 继承。在这种实现方式下&#xff0c;效果是 “所有 worker 可以处理所有 listening socket” 这不就是…

安卓内部存储不需要申请权限,外部文件需要申请权限

内部存储和外部存储的访问权限区别&#xff1a; 内部路径&#xff1a;/data/user/0/com.xxx.xxx/ getExternalFilesDir可以获取到属于 App 自身的文件路径&#xff0c;通常是~/Android/data/<package-name>/**/。在该目录中读写文件均不需要申请权限,随着APP卸载就会删…

华为云云耀云服务器L实例评测|Git 私服搭建指南

前言 本文为华为云云耀云服务器L实例测评文章&#xff0c;测评内容是 云耀云服务器L实例 Git 私有服务器搭建指南 系统配置&#xff1a;2核2G 3M Ubuntu 20.04 我们平时在使用代码托管服务的时候&#xff0c;可能某些代码托管平台对成员有限制&#xff0c;或是由于内容原因会对…

自动编码器

Autoencoder is designed in a way to perform task of data encoding plus data decoding to reconstruct input. -- Anushka Jain 前言 两兄弟 N.Coder 和 D.Coder 经营着一家艺术画廊。一周末&#xff0c;他们举办了一场特别奇怪的展览&#xff0c;因为它只有一面墙&#x…

nginx中sent_timeout属性使用注意事项

send_timeout使用注意事项 send_timeout:指客户端向服务器发送请求并且等待服务器返回数据的时间&#xff0c;超过这个时间链接就断开。如果咱们返回的数据复杂&#xff0c;很耗时&#xff0c;就将该值设置大些。注意该时间指准备过程&#xff0c;不是传输过程&#xff08;下载…

在线海报图片设计器、图片编辑器源码/仿照稿定设计源码

在线海报设计系统素材设计源码是一个漂亮且功能强大的在线海报图片设计器&#xff0c;仿照稿定设计而成。该系统适用于多种场景&#xff0c;包括海报图片生成、电商分享图、文章长图、视频/公众号封面等。用户无需下载软件&#xff0c;即可轻松实现创意&#xff0c;迅速完成排版…

7-38 掉入陷阱的数字

输入样例: 5 输出样例: 1:16 2:22 3:13 4:13 ACcode: #include <bits/stdc.h>using namespace std;int main(){int n;cin >> n;vector<int> ans;int limit 1;ans.push_back(n);for(int i0; i<limit; i){//各位数字的和int sum 0;int num ans[i];w…

独立开发了一款Material3风格的RSS阅读器 - Agr Reader

截图 背景&#x1f4d6; 在之前接触到RSS后&#xff0c;发现RSS真是一个十分不错的信息聚合的方式&#xff0c;虽然现在看来RSS的时代已经开始落幕&#xff0c;但是至少目前还是处于能用的阶段。 在我用了Android上好几个RSS阅读App后&#xff0c;发现很多在全文解析方面不是…