【UE4】通过顶点数组自动剖分三角网格的算法

  • Post author:
  • Post category:其他


Build.cs中增加模块

// Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool;

public class GeoJsonRead : ModuleRules
{
	public GeoJsonRead(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" , "ProceduralMeshComponent" });

		PrivateDependencyModuleNames.AddRange(new string[] {  });

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		
		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
	}
}
//GetField.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
//#include "BooleanV2.h"
#include "GetField.generated.h"

class liangpeng
{
private:
	struct point3d    //3d点数组
	{
		FVector p;
		int index;
	};
	struct point    //2d点数组
	{
		FVector2D p;
		int index;
		bool aotu;
	};

	struct face     //2d三角形
	{
		int index;   //第几个三角形
		int  O;       //三个点的点的index
		int  P;
		int  Q;
		TArray<point> R;
	};
public:
	TArray<int> OutTriange;
	liangpeng(TArray<FVector> inputpoint);
private:
	TArray<FVector> MoveLost(TArray<FVector> dian);
	TArray<point3d> guodu(TArray<FVector> dian);
	TArray<point> aotudian(TArray<point3d> dian);
	bool  isout(FVector2D a, FVector2D b, FVector2D c, FVector2D d);
	TArray<face> Triange(TArray<point> ddian);
	TArray<FVector2D> threeto(TArray<FVector> dian);
	TArray<point3d> movepoint(TArray<point3d> dian);
	TArray<int> caifen(TArray<FVector> ddian);
};

UCLASS()
class GEOJSONREAD_API UGetField : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
	
public:
	UFUNCTION(BlueprintPure, Category = "mianjijisuan")
		static TArray<int> SanJiaoPouFen(TArray<FVector> dianji);
	UFUNCTION(BlueprintCallable, Category = "mianjijisuan")
		static bool xifen(const TArray<FVector> &oldpoint, const TArray<int> &oldface, const int num, TArray<FVector> &newpoint, TArray<int> &newface);
	//UFUNCTION(BlueprintCallable, Category = "mianjijisuan")
		//static bool Get_UV(const TArray<FVector> &point, const TArray<int> &face, TArray<FVector> &outpoint, TArray<int> &outface, TArray<FVector>&normal, TArr



版权声明:本文为o0pk2008原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。