x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Extract float32 from TArray

Hi, I have a TArray of Bytes from TCP connection. I have 58 Bytes of header and 12 x 4 Bytes of Float32. I need to extraxt the 12 float32 numbers from my Array Bytes, I have try this code for extraxt the first number but the result is wrong every time:

 float ReceivedUE4float32;
 ReceivedUE4float32 = float(ReceivedData[58]); //58 index of first float32
 GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Dato intdex 58 ~> %f"), ReceivedUE4float32));

Someone can help me?

Thanks

Socket: https://github.com/openigtlink/OpenIGTLink/blob/release-3.0/Documents/Protocol/index.md

Transform(12x4 Bytes) : https://github.com/openigtlink/OpenIGTLink/blob/release-3.0/Documents/Protocol/transform.md

Product Version: UE 4.17
Tags:
more ▼

asked Dec 01 '17 at 09:51 AM in C++ Programming

avatar image

kelevra090
5 2 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I don't now the best and fastest way. But normally I'd start with something like:

  float* pfIndex = ReceivedData[58];
  for (int nIndex = 0; nIndex <  12; ++nIndex)
  {
      float fMyPrecious = *pfIndex;
      pfIndex++;
 }

Not sure about it, but that would be my first try.

(I did not compile that, it is just the basic idea)

more ▼

answered Dec 01 '17 at 11:15 AM

avatar image

BugSwat
183 9 13 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question